:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #e94560;
    --text-color: #eaeaea;
    --card-bg: #16213e;
    --border-radius: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    border-bottom: 2px solid var(--highlight-color);
    margin-bottom: 30px;
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
}

.header-content > div:first-child {
    text-align: left;
    flex: 1;
    min-width: 200px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
    text-align: left;
}

.subtitle {
    color: #a8a8a8;
    font-size: 1.1rem;
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    background: rgba(22, 33, 62, 0.5);
    border-radius: var(--border-radius);
    backdrop-filter: blur(5px);
    position: relative;
}

/* Bouton toggle pour mobile */
.filters-toggle {
    display: none; /* Visible uniquement sur mobile */
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.filters-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.filters-toggle::after {
    content: ' ▼';
    font-size: 0.9rem;
    margin-left: 8px;
}

.filters-toggle.active::after {
    content: ' ▲';
}

.filters-content {
    display: contents; /* Par défaut, tout est visible */
}

.filter-btn {
    background: var(--card-bg);
    border: 2px solid var(--accent-color);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.filter-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(233, 69, 96, 0.3);
}

.filter-btn.active {
    background: var(--highlight-color);
    border-color: var(--highlight-color);
}

.filter-category {
    width: 100%;
    text-align: center;
    color: var(--highlight-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 15px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(233, 69, 96, 0.4);
}

.filter-category:first-of-type {
    margin-top: 5px;
}

.search-bar {
    margin-bottom: 30px;
    text-align: center;
}

#searchInput {
    width: 100%;
    max-width: 600px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    border: 2px solid var(--accent-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--highlight-color);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.loading {
    text-align: center;
    padding: 50px 20px;
}

.spinner {
    border: 4px solid var(--accent-color);
    border-top: 4px solid var(--highlight-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 30px;
    background: rgba(233, 69, 96, 0.2);
    border-radius: var(--border-radius);
    border: 2px solid var(--highlight-color);
    margin: 20px 0;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.news-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    border: 2px solid var(--accent-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(233, 69, 96, 0.3);
    border-color: var(--highlight-color);
}

.news-source {
    display: inline-block;
    background: var(--highlight-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.news-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 600;
}

.news-description {
    color: #b8b8b8;
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #888;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--accent-color);
}

.news-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.read-more {
    color: var(--highlight-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.read-more:hover {
    color: #ff6b7a;
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 30px 0;
    background: rgba(22, 33, 62, 0.8);
    border-top: 2px solid var(--highlight-color);
    margin-top: 50px;
}

/* ========================================
   Nouveaux styles pour traduction/résumé
   ======================================== */

/* Badge de langue */
.language-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 10px;
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid var(--highlight-color);
    vertical-align: middle;
}

/* Boutons d'action sur les cartes */
.news-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.translate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.translate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.summary-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.summary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.action-btn:active {
    transform: translateY(0);
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 700px;
    position: relative;
    animation: slideDown 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--highlight-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--highlight-color);
}

.modal-loading {
    text-align: center;
    padding: 40px 20px;
}

.modal-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
}

.modal-loading p {
    color: #a8a8a8;
    font-size: 1rem;
}

.modal-result {
    padding: 20px 0;
}

.modal-error {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid var(--highlight-color);
    border-radius: 8px;
    padding: 20px;
    color: #ff6b6b;
    text-align: center;
    margin-top: 20px;
}

/* Boîtes de traduction */
.translation-box {
    background: rgba(15, 52, 96, 0.5);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--highlight-color);
}

.translation-box h3 {
    color: var(--highlight-color);
    font-size: 1rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.original-text,
.translated-text {
    color: var(--text-color);
    line-height: 1.8;
    font-size: 0.95rem;
}

/* Boîte de résumé */
.summary-box {
    background: rgba(15, 52, 96, 0.5);
    border-radius: 8px;
    padding: 25px;
    border-left: 4px solid #f093fb;
}

.summary-text {
    color: var(--text-color);
    line-height: 1.9;
    font-size: 1.05rem;
}

/* Indicateur de cache */
.cache-indicator {
    text-align: center;
    padding: 10px;
    margin-top: 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.cache-indicator.cached {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
    border: 1px solid #2ed573;
}

.cache-indicator.fresh {
    background: rgba(255, 184, 0, 0.2);
    color: #ffb800;
    border: 1px solid #ffb800;
}

/* Responsive tablette */
@media (max-width: 992px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive mobile */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem !important;
        text-align: center !important;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Filtres en mode mobile */
    .filters {
        padding: 15px;
    }

    .filters-toggle {
        display: block; /* Afficher le bouton sur mobile */
    }

    .filters-content {
        display: none; /* Caché par défaut sur mobile */
        flex-direction: column;
        margin-top: 10px;
    }

    .filters-content.show {
        display: flex; /* Afficher quand actif */
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .filter-category {
        margin: 10px 0 8px 0;
        font-size: 0.8rem;
    }

    .filter-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .search-bar {
        margin-bottom: 25px;
    }

    .search-bar input {
        font-size: 1rem;
        padding: 14px 20px;
    }

    /* Modales optimisées pour mobile */
    .modal-content {
        width: 96%;
        max-width: 96%;
        margin: 5vh auto;
        padding: 20px 15px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 12px;
    }

    .modal-content h2 {
        font-size: 1.4rem;
        padding-right: 30px;
    }

    .close-modal {
        font-size: 30px;
        top: 10px;
        right: 15px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(233, 69, 96, 0.2);
        border-radius: 50%;
    }

    .translation-box,
    .summary-box {
        padding: 15px;
        margin-bottom: 15px;
    }

    .translation-box h3 {
        font-size: 0.9rem;
    }

    .original-text,
    .translated-text,
    .summary-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    /* Modal de login plus grande sur mobile */
    .modal-small {
        max-width: 96%;
        width: 96%;
    }

    .form-group input {
        padding: 14px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }

    .submit-btn {
        padding: 14px;
        font-size: 1.05rem;
        min-height: 48px; /* Taille tactile minimale */
    }

    .action-btn {
        min-width: 100px;
        font-size: 0.9rem;
        padding: 10px 16px;
        min-height: 44px; /* Taille tactile */
    }

    .language-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    header {
        padding: 15px 0;
        margin-bottom: 20px;
    }

    .header-content {
        flex-direction: column;
        text-align: center !important;
        gap: 15px;
        align-items: stretch;
    }

    .header-content > div:first-child {
        text-align: center !important;
        min-width: 100%;
    }

    .auth-section {
        width: 100%;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Menu déroulant Outils sur mobile */
    .auth-section .relative {
        width: 100%;
        max-width: 300px;
    }

    .auth-section .relative button {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .user-name {
        font-size: 0.85rem;
        padding: 10px 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .logout-btn,
    .login-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        border-radius: 25px;
        min-height: 44px;
        min-width: 120px;
    }

    #userInfo {
        justify-content: center;
        width: 100%;
        gap: 10px;
        flex-wrap: wrap;
    }

    footer {
        padding: 20px 0;
    }

    footer p {
        font-size: 0.85rem;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem !important;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .news-card {
        padding: 15px;
    }

    .news-title {
        font-size: 1.1rem;
    }

    .action-btn {
        font-size: 0.8rem;
        padding: 7px 12px;
    }

    .news-actions {
        gap: 8px;
    }

    .logout-btn {
        font-size: 0.8rem;
        padding: 9px 16px;
    }

    .user-name {
        font-size: 0.85rem;
        padding: 7px 12px;
    }
}

/* ========================================
   Styles pour l'authentification
   ======================================== */

.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.auth-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
    min-width: 120px;
}

.login-btn::before {
    content: '🔐';
    font-size: 1.1rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.6);
}

.login-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 5px rgba(102, 126, 234, 0.4);
}

.logout-btn {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.9) 0%, rgba(233, 69, 96, 1) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
    font-size: 0.85rem;
    padding: 8px 16px;
    min-width: 100px;
}

.logout-btn::before {
    content: '🚪';
    font-size: 1rem;
}

.logout-btn:hover {
    background: linear-gradient(135deg, var(--highlight-color) 0%, #ff5570 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.5);
}

.logout-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 5px rgba(233, 69, 96, 0.4);
}

.admin-btn {
    background: linear-gradient(135deg, rgba(255, 184, 0, 0.9) 0%, rgba(255, 184, 0, 1) 100%);
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(255, 184, 0, 0.3);
    font-size: 0.85rem;
    padding: 8px 16px;
    min-width: 90px;
    font-weight: 700;
}

.admin-btn::before {
    content: '⚙️';
    font-size: 1rem;
}

.admin-btn:hover {
    background: linear-gradient(135deg, #ffb800 0%, #ffc933 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 184, 0, 0.5);
}

.admin-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 5px rgba(255, 184, 0, 0.4);
}

.user-name {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.4);
}

.user-name::before {
    content: '👤';
    font-size: 1.1rem;
}

#userInfo {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Modal de connexion */
.modal-small {
    max-width: 400px;
}

.login-info {
    color: #a8a8a8;
    font-size: 0.9rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 6px;
    background: rgba(15, 52, 96, 0.3);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--highlight-color);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-error {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid var(--highlight-color);
    border-radius: 6px;
    padding: 12px;
    color: #ff6b6b;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ========================================
   Menu déroulant Outils (Tailwind override)
   ======================================== */

/* Dropdown menu styles */
#toolsDropdown {
    min-width: 280px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(233, 69, 96, 0.3);
}

#toolsDropdown a {
    text-decoration: none;
}

#toolsMenuBtn {
    position: relative;
}

/* Mobile optimizations pour le dropdown */
@media (max-width: 768px) {
    #toolsDropdown {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        top: auto !important;
        bottom: 10px !important;
        width: 95% !important;
        max-width: 400px !important;
        margin: 0 !important;
        border-radius: 12px;
        box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.7);
        z-index: 9999 !important;
    }

    #toolsDropdown a {
        padding: 16px !important;
        min-height: 60px;
        display: flex !important;
        align-items: center !important;
    }

    #toolsDropdown .text-2xl {
        font-size: 1.8rem !important;
    }

    #toolsDropdown .font-semibold {
        font-size: 1rem !important;
    }

    #toolsDropdown .text-xs {
        font-size: 0.85rem !important;
    }
}
