:root {
    --primary: #4760CF;
    --secondary: #F12D70;
    --dark: #2B3E52;
    --light: #F4F6F4;
    --text: #1F2937;
    --text-muted: #808285;
    --white: #ffffff;
    --gray: #F9FAFB;
    --transition: all 0.2s linear;
}

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600;700&family=Inter:wght@400;600&family=Poppins:wght@400;600&display=swap');

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    line-height: 1.6;
    background-color: var(--white);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

h1, h2, h3, h4 {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark);
}

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

/* Back to site bar */
.back-to-site {
    background: var(--dark);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.back-to-site a:hover {
    color: white;
    gap: 8px;
}

/* Header */
.main-header {
    background: white;
    padding: 15px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    font-size: 0.85rem;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero-section {
    position: relative;
    padding: 120px 0 100px;
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    background-color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 450px;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-content h1 {
    color: white !important;
    font-size: 4rem;
    margin-bottom: 25px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6);
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.3rem;
    max-width: 800px;
    margin: 0 auto 40px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    font-weight: 600;
    color: white;
}

/* Cards Grid */
.destinations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 35px;
    padding: 50px 0;
}

.destination-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    transition: var(--transition);
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.destination-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.card-img {
    height: 240px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #f5f5f5;
}

.country-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    left: auto;
    width: auto;
    background: rgba(71,96,207,0.88);
    padding: 4px 13px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    letter-spacing: 0.3px;
    line-height: 1.5;
    display: inline-block;
    text-transform: none;
}

.card-body {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-body h3 {
    margin-bottom: 12px;
    font-size: 1.6rem;
    color: var(--dark);
    font-weight: 800;
}

.card-body p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.6;
    /* Toujours exactement 3 lignes — évite que les cartes aient des hauteurs
       différentes selon la longueur du texte */
    height: calc(1.6em * 3);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* La période idéale : toujours 2 lignes de hauteur réservée,
   qu'elle fasse 1 ligne ("Avril à Octobre") ou 2 ("Printemps (Avril-Juin)
   ou Automne (Septembre-Octobre)") */
.card-best-period {
    height: calc(1.6em * 2) !important;
    min-height: calc(1.6em * 2) !important;
    -webkit-line-clamp: 2 !important;
    margin-bottom: 14px !important;
    font-size: 0.85rem !important;
    color: #4760CF !important;
    font-weight: 700;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    line-height: 1.6 !important;
}

.btn-link {
    margin-top: auto;
    color: var(--primary);
    text-decoration: none;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    font-size: 0.95rem;
}

.destination-card:hover .btn-link {
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 30px;
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Destination Page Layout */
.destination-detail {
    background: var(--white);
}

.content-grid {
    display: grid;
    grid-template-columns: 1.6fr 0.7fr;
    column-gap: 40px;
    row-gap: 20px;
    padding: 10px 0 100px;
    align-items: start;
}

/* Placement explicite des 3 zones */
.weather-top-bar {
    grid-column: 1;
    grid-row: 1;
}
.main-info {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.sidebar {
    grid-column: 2;
    grid-row: 1 / 3;
}

.breadcrumb {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: rgba(255,255,255,0.8);
}

.breadcrumb a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #fff;
}

.weather-top-bar {
    margin-top: -40px;
    margin-bottom: 0;
}

.weather-inline-card {
    background: linear-gradient(135deg, #eef0ff 0%, #ffffff 55%);
    border-radius: 20px;
    padding: 18px 22px;
    box-shadow: 0 16px 35px rgba(71,96,207,0.12);
    border: 1px solid #dde1f7;
}

.weather-main-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.weather-temp-badge {
    width: 110px;
    height: 110px;
    border-radius: 22px;
    background: linear-gradient(135deg, #4760CF 0%, #6f84e8 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 12px 22px rgba(71,96,207,0.2);
    gap: 6px;
}

.weather-temp-badge img {
    width: 56px;
    height: 56px;
    /* Icône visible sur fond foncé quelle que soit la météo (jour/nuit) */
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.6)) brightness(1.15);
}

.temp {
    font-size: 2.1rem;
    font-weight: 900;
    color: #fff;
}

.desc-group {
    display: flex;
    flex-direction: column;
}

.city-live {
    font-weight: 800;
    color: rgba(255,255,255,0.75);
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}

.sky-desc {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 2px;
}

.weather-meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-weight: 700;
    font-size: 0.82rem;
}

.weather-meta span {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 5px 10px;
    border-radius: 999px;
}

.summary-box {
    background: #f7f8ff;
    border: 1px solid #e7eaff;
    padding: 24px 28px;
    border-radius: 18px;
}

.summary-title {
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.85rem;
}

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

.spacer-40 {
    height: 40px;
}

.section-card {
    background: #fff;
    border-radius: 20px;
    border: 1px solid #eef0f4;
    padding: 36px;
    box-shadow: 0 12px 25px rgba(0,0,0,0.03);
}

.section-card h2 {
    font-size: 2.2rem;
    margin-bottom: 20px;
}

/* ── Description ville : mise en forme du contenu AI ───────────────────── */
.description-text h2 {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    color: #2B3E52;
    margin: 32px 0 14px;
    line-height: 1.3;
}

.description-text h3 {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #4760CF;
    margin: 24px 0 10px;
    line-height: 1.4;
}

.description-text p {
    margin: 0 0 16px;
    color: #4b5563;
    font-size: 1.02rem;
    line-height: 1.8;
}

.description-text ul,
.description-text ol {
    padding-left: 22px;
    margin: 0 0 16px;
}

.description-text li {
    color: #4b5563;
    font-size: 1.02rem;
    line-height: 1.75;
    margin-bottom: 6px;
}

.description-text blockquote {
    border-left: 3px solid #4760CF;
    padding: 10px 18px;
    background: #f0f3ff;
    border-radius: 0 10px 10px 0;
    margin: 20px 0;
    color: #2B3E52;
    font-style: italic;
}

.description-text strong {
    color: #2B3E52;
    font-weight: 700;
}

.content-image-in-text {
    margin: 26px 0 30px;
}

.content-image-in-text img {
    width: 100%;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
    display: block;
}

.sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

/* Page pays — grille principale */
.country-info-grid {
    grid-template-columns: 1fr;
}
.country-info-grid--sidebar {
    grid-template-columns: 1fr 300px;
}

.sidebar-info-card {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #eef0f4;
    padding: 22px;
    box-shadow: 0 12px 25px rgba(0,0,0,0.03);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #e7e7e7;
}

.info-row:last-child {
    border-bottom: none;
}

.label {
    color: #6b7280;
    font-weight: 700;
}

.val {
    font-weight: 800;
    color: var(--dark);
}

.val-score {
    font-weight: 900;
    color: var(--primary);
}

/* Footer */
.main-footer {
    flex-shrink: 0;
    background: var(--dark);
    color: white;
    padding: 80px 0 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.main-footer h3, .main-footer h4 {
    color: white;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: 0.3s;
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-bottom p {
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Reveal Animation */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: 0.8s ease-out;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .weather-top-bar { grid-column: 1; grid-row: auto; order: 1; }
    .sidebar          { grid-column: 1; grid-row: auto; order: 2; position: static; }
    .main-info        { grid-column: 1; grid-row: auto; order: 3; }

    /* Page pays : sidebar repliée sous le texte sur tablette/mobile */
    .country-info-grid--sidebar {
        grid-template-columns: 1fr;
    }
    .country-info-grid aside {
        position: static !important;
    }
    .country-sidebar-card {
        position: static !important;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }
    .nav-links {
        display: none;
    }
    .section-card {
        padding: 26px;
    }
    .weather-main-info {
        flex-direction: column;
        align-items: flex-start;
    }
    .weather-temp-badge {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        padding: 16px;
        height: auto;
    }
    .weather-temp-badge img {
        margin-right: 12px;
    }
}
/* Header Search Button */
.header-search-btn { background: none; border: 2px solid #eee; cursor: pointer; color: var(--primary); display: flex; align-items: center; padding: 8px 10px; border-radius: 10px; transition: all 0.2s; margin-left: 8px; }
.header-search-btn:hover { background: #f0f2ff; border-color: var(--primary); }

/* Search Overlay */
.search-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 2000; background: rgba(255,255,255,0.98); backdrop-filter: blur(8px); padding: 20px; box-shadow: 0 4px 30px rgba(0,0,0,0.12); }
.search-overlay.active { display: block; }
.search-overlay-form { display: flex; align-items: center; gap: 12px; max-width: 700px; margin: 0 auto; border: 2px solid var(--primary); border-radius: 50px; padding: 10px 20px; background: white; }
.search-overlay-form input { flex: 1; border: none; outline: none; font-family: 'Quicksand', sans-serif; font-size: 1.1rem; font-weight: 600; color: #111; background: transparent; }
.search-overlay-form input::placeholder { color: #aaa; font-weight: 500; }
.search-overlay-form button[type="submit"] { background: var(--primary); border: none; border-radius: 50%; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: white; flex-shrink: 0; }
.search-overlay-form button[type="button"] { background: none; border: none; cursor: pointer; color: #999; display: flex; align-items: center; padding: 4px; flex-shrink: 0; transition: color 0.2s; }
.search-overlay-form button[type="button"]:hover { color: #333; }

/* ===================== Hero Search AJAX ===================== */
.hero-search-wrap {
    max-width: 620px;
    margin: 44px auto 0;
    position: relative;
    z-index: 10;
}
.hero-search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 60px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    padding: 7px 7px 7px 22px;
    gap: 8px;
}
.hero-search-icon {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex-shrink: 0;
    display: block;
}
.hero-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
    background: transparent;
    min-width: 0;
    line-height: 1.4;
}
.hero-search-input::placeholder { color: #bbb; font-weight: 500; }
.hero-search-submit {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 13px 26px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}
.hero-search-submit:hover { background: #3a4fb5; }

/* Dropdown */
.hero-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.22);
    overflow: hidden;
    z-index: 9999;
}
.hero-search-dropdown.open { display: block; }
.sdrop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    text-decoration: none;
    color: #111;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.12s;
}
.sdrop-item:hover { background: #f4f6ff; }
.sdrop-name { font-weight: 700; font-family: 'Quicksand', sans-serif; font-size: 0.98rem; }
.sdrop-country { font-size: 0.78rem; color: var(--primary); font-weight: 700; background: #eef0ff; border-radius: 20px; padding: 3px 10px; flex-shrink: 0; }
.sdrop-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 20px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.88rem;
    font-family: 'Quicksand', sans-serif;
    background: #f8f9ff;
    transition: background 0.12s;
}
.sdrop-all:hover { background: #eef0ff; }

/* ============= Header Search Overlay ============= */
.header-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 10px;
    margin-left: 8px;
    transition: background 0.2s;
}
.header-search-btn:hover { background: #f0f2ff; }

.search-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 2000;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
    padding: 18px 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.search-overlay.active { display: block; }
.search-overlay-form {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 680px;
    margin: 0 auto;
    background: #f5f6ff;
    border: 2px solid var(--primary);
    border-radius: 50px;
    padding: 10px 10px 10px 22px;
}
.search-overlay-form input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #111;
}
.search-overlay-form input::placeholder { color: #aaa; }
.search-overlay-form button[type="submit"] {
    background: var(--primary);
    border: none;
    border-radius: 50px;
    padding: 10px 22px;
    color: white;
    font-family: 'Quicksand', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.search-overlay-form button[type="button"] {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}
.search-overlay-form button[type="button"]:hover { background: #eee; color: #333; }

@media (max-width: 600px) {
    .hero-search-box { padding: 6px 6px 6px 16px; }
    .hero-search-input { font-size: 0.95rem; }
    .hero-search-submit { padding: 11px 16px; font-size: 0.85rem; }
}
