/* ===== VARIABLES ===== */
:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 20px 30px -10px rgba(67, 97, 238, 0.3);
    --radius: 1.25rem;
    --radius-sm: 0.75rem;
}

/* ===== BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: var(--dark);
    line-height: 1.5;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.search-container {
    max-width: 1300px;
    width: 100%;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

/* ===== EN-TÊTE ===== */
.search-header {
    margin-bottom: 2rem;
    text-align: center;
}

.search-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.search-header h1 i {
    font-size: 2rem;
    color: var(--primary);
    background: none;
}

.subtitle {
    color: var(--gray);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

/* ===== SECTION FILTRES ===== */
.filters-section {
    background: var(--light);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0; /* Évite les débordements */
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group label i {
    color: var(--primary);
    font-size: 0.9rem;
    width: 1.2rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: all 0.2s;
    background: white;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.keyword-group {
    grid-column: span 2; /* Mot-clé sur 2 colonnes */
}

.filter-actions {
    grid-column: span 1;
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-search, .btn-reset {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.btn-search {
    background: var(--gradient);
    color: white;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px var(--primary);
}

.btn-reset {
    background: white;
    color: var(--dark);
    border: 2px solid #e2e8f0;
}

.btn-reset:hover {
    background: #f1f5f9;
    border-color: var(--gray);
}

/* ===== SECTION RÉSULTATS ===== */
.results-section {
    margin-top: 2rem;
    animation: fadeInUp 0.4s ease;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.result-count {
    font-size: 1rem;
    background: #e2e8f0;
    padding: 0.2rem 0.8rem;
    border-radius: 2rem;
    font-weight: 500;
    color: var(--dark);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Cartes de résultat */
.result-card {
    background: white;
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.02);
    transition: transform 0.25s, box-shadow 0.3s;
    border: 1px solid rgba(0,0,0,0.05);
    animation: cardAppear 0.3s ease backwards;
}

.result-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 30px -12px rgba(67, 97, 238, 0.2);
}

.result-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 3px solid var(--primary-light);
}

.result-info {
    padding: 1.2rem;
}

.result-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.result-info p {
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.result-info p i {
    color: var(--primary);
    width: 1.2rem;
    font-size: 0.9rem;
}

.detail {
    font-weight: 600;
    color: var(--primary);
}

.description {
    margin-top: 0.5rem;
    font-style: italic;
    color: #64748b;
    border-top: 1px dashed #cbd5e1;
    padding-top: 0.5rem;
}

/* États vides / chargement */
.no-results, .loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--gray);
    font-size: 1.1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== MESSAGES ===== */
.message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 1rem;
    font-weight: 500;
    text-align: center;
    display: none;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    display: block;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    display: block;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 650px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: 400;
    color: var(--gray);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--primary);
}

.modal h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal h2 i {
    color: var(--primary);
}

.modal p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal label {
    font-weight: 600;
    color: #334155;
}

.modal input, .modal select, .modal textarea {
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: inherit;
}

.modal input:focus, .modal select:focus, .modal textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--gradient);
    color: white;
    font-weight: 600;
    border-radius: 2rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.file-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
}

.file-name {
    color: #334155;
    font-size: 0.95rem;
}

.modal .btn-submit {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.modal .btn-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px -5px var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .filter-row {
        grid-template-columns: repeat(2, 1fr);  /* 2 colonnes */
    }
    .keyword-group {
        grid-column: span 2;                    /* mot-clé pleine largeur */
    }
    .filter-actions {
        grid-column: span 2;                     /* boutons pleine largeur */
        justify-content: flex-start;              /* alignés à gauche */
    }
}

/* Petits écrans (≤ 600px) : on garde 2 colonnes mais on réduit les espacements */
@media (max-width: 600px) {
    .filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 colonnes qui ne débordent pas */
        gap: 0.75rem;
    }
    .filter-group label {
        font-size: 0.85rem;
    }
    .filter-group input,
    .filter-group select {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    .filter-actions {
        flex-direction: column;    /* boutons l'un sous l'autre */
        gap: 0.5rem;
    }
    .btn-search, .btn-reset {
        width: 100%;
        justify-content: center;
        padding: 0.7rem 1rem;
    }
    .modal .form-row {
        grid-template-columns: 1fr; /* modal en 1 colonne sur mobile */
    }
}

/* Très petits écrans (≤ 400px) : on réduit encore un peu */
@media (max-width: 400px) {
    .filter-group input,
    .filter-group select {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
    }
    .filter-group label {
        font-size: 0.8rem;
    }
    .btn-search, .btn-reset {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
}
/* ===== OVERLAY DE PRÉ-LANCEMENT ===== */
.site-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.site-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background: white;
    padding: 2.5rem;
    border-radius: 2rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.5);
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.overlay-content p {
    margin-bottom: 1.5rem;
    color: #334155;
}

.countdown {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.countdown span {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    min-width: 80px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.current-count {
    font-size: 1.2rem;
    font-weight: 600;
}

.condition-message {
    font-weight: 600;
    color: #e11d48;
    min-height: 2rem;
}