:root {
    --primary-color: #a0c4ff;
    --accent-color: #bdb2ff;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --dark-overlay: rgba(0, 0, 0, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide scrollbar for Chrome, Safari and Opera */
*::-webkit-scrollbar {
    display: none;
}

body {
    background-color: #0f172a;
    color: var(--text-color);
    overflow-x: hidden;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
}

.background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-overlay);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    /* Increased to be above all other sections */
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
    /* Vertical centering for all items */
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 300;
    transition: color 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Special Button for Personal Space */
.nav-btn-special {
    background: rgba(160, 196, 255, 0.05);
    border: 1px solid rgba(160, 196, 255, 0.4);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 500 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.9rem;
    line-height: 1;
}

.nav-btn-special svg {
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.nav-btn-special:hover {
    background: var(--primary-color) !important;
    color: #0f172a !important;
    box-shadow: 0 4px 15px rgba(160, 196, 255, 0.3);
    transform: translateY(-1px);
    border-color: var(--primary-color);
}

.nav-btn-special:hover svg {
    opacity: 1;
    transform: scale(1.1);
}

.nav-btn-special::after {
    display: none !important;
    /* Remove the underline effect for the button */
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 2100;
    /* Higher than navbar */
}

.mobile-menu-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text-color);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem 5%;
        /* Balanced padding between logo and burger */
        display: flex !important;
        justify-content: space-between !important;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        /* Start from top of screen */
        bottom: 0;
        right: -280px;
        /* Hide off-screen */
        width: 250px;
        height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        display: flex !important;
        /* Force flex display on mobile */
        flex-direction: column;
        gap: 0;
        padding: 5rem 0 2rem;
        /* Buffer for the navbar height */
        border-left: 1px solid var(--glass-border);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        align-items: stretch;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 2050;
        /* Between navbar and toggle */
        visibility: visible;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: center;
        /* Center links on mobile */
    }

    .nav-links a {
        padding: 1.2rem 2rem;
        width: 100%;
        justify-content: center;
        /* Center text on mobile */
        height: auto;
        font-size: 1.1rem;
    }

    .nav-links a::after {
        display: none;
    }

    .nav-btn-special {
        margin: 1.5rem auto;
        padding: 0.5rem 1rem;
        /* Very compact padding */
        font-size: 0.85rem;
        /* Smaller font for better fit */
        gap: 6px;
        justify-content: center;
        width: 60%;
        /* Compact width */
        max-width: 180px;
        /* Strong constraint on size */
        background: linear-gradient(45deg, var(--primary-color), var(--accent-color)) !important;
        color: #0f172a !important;
        box-shadow: 0 4px 12px rgba(160, 196, 255, 0.4);
        border: none;
        font-weight: 600 !important;
    }

    .nav-btn-special svg {
        width: 16px;
        height: 16px;
    }
}

/* Sections */
.section {
    min-height: 100vh;
    padding: 6rem 5% 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Map Section */
.map-section {
    padding-top: 150px !important;
    /* Increased spacing to avoid header crowding */
    min-height: auto;
    justify-content: flex-start;
}

.map-box {
    width: 100%;
    max-width: 1200px;
    padding: 1.5rem !important;
    margin: 20px auto 0;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Time Capsule Custom Picker */
.time-capsule {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    /* Darker glass */
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Live Indicator Styling */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.live-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.live-indicator.active .dot {
    background-color: #ff1744;
    box-shadow: 0 0 8px rgba(255, 23, 68, 0.4);
    animation: pulse-red 1.5s infinite;
}

.live-indicator .label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s;
}

.live-indicator.active .label {
    color: #ff1744;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(255, 23, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 23, 68, 0);
    }
}

.custom-control {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.custom-control:hover {
    opacity: 1;
}

.custom-control .icon {
    font-size: 1.1rem;
}

.time-capsule .sep {
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.2rem;
}

/* Custom Modal */
.custom-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.custom-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.custom-modal {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    width: 320px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal-overlay.active .custom-modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
}

.modal-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin: 15px 0 10px;
    font-weight: 600;
}

.modal-label:first-child {
    margin-top: 0;
}

.hours-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hour-btn {
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.hour-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hour-btn.selected {
    background: var(--primary-color);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(160, 196, 255, 0.4);
}

.minutes-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.min-btn {
    flex: 1;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
}

.min-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.min-btn.selected {
    background: var(--accent-color);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(189, 178, 255, 0.4);
}


.time-capsule input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

.map-header h2 {
    margin: 0;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#juraMap {
    height: 500px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    z-index: 1;
    /* Ensure map is below navbar/modals */
}

/* Custom Marker Styling */
.map-timeline-label {
    position: absolute;
    top: 0.8rem;
    left: 1rem;
    z-index: 900;
    /* Lower than custom modal */
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    max-width: calc(100% - 2rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-div-icon {
    background: none !important;
    border: none !important;
}

/* Marker sizes reverted to original for better visibility */
.temp-marker-container {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.temp-aura {
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    filter: blur(4px);
    z-index: -1;
    opacity: 0.8 !important;
    animation: pulse-aura 2.5s infinite ease-in-out;
}

@keyframes pulse-aura {
    0% {
        transform: scale(0.9);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.4;
    }
}

.temp-marker {
    width: 32px;
    height: 32px;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    color: white;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    z-index: 2;
    backdrop-filter: blur(4px);
}

.temp-marker:hover {
    transform: scale(1.2);
    box-shadow: 0 0 25px var(--primary-color);
    z-index: 1000 !important;
}

.map-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.8rem;
    font-size: 0.85rem;
}

.legend-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

#mapStatus {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.legend-hint {
    font-style: italic;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Ranking Table/List below Map */
.map-footer {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ranking-section {
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-header h3 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--primary-color);
}

.ranking-sort {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.sort-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.sort-mini.active {
    background: var(--primary-color);
    color: #0f172a;
    border-color: var(--primary-color);
    font-weight: 600;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ranking-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ranking-header-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary-color);
    border-bottom: none;
    padding: 6px 16px;
    border-radius: 12px 12px 0 0;
    width: 35%;
    /* 1/3 Length */
    min-width: 250px;
    margin-left: 0;
    position: relative;
    z-index: 2;
    transform: translateY(1px);
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .ranking-header-tab {
        width: 100% !important;
    }
}

.ranking-header-tab .ranking-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-color);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ranking-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    /* Unifié car temp et extremes sont groupés */
    align-items: center;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.6rem 1rem;
    border-radius: 0 0 12px 12px;
    /* Bas arrondi seulement */
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 0.4rem;
}


.ranking-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
    /* Plus subtil */
}

.ranking-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ranking-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.ranking-status {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Desktop Layout Components */
.ranking-left-col {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    justify-content: flex-start;
    padding-right: 20px;
}

.ranking-actions {
    display: flex;
    gap: 1rem;
}

.ranking-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 20px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.ranking-snow {
    font-size: 0.75rem;
    color: #a5f3fc;
    background: rgba(165, 243, 252, 0.1);
    padding: 0.1rem 0.6rem;
    border-radius: 12px;
    border: 1px solid rgba(165, 243, 252, 0.2);
    font-weight: 600;
}

/* Force Left Align */
.ranking-info {
    justify-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    /* CRITICAL: Allows grid track to shrink below content size, preventing shift */
    width: 100%;
    /* Ensure it fills the track */
}

/* Truncate Name if too long */
.ranking-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

/* Force Right Align */
/* Force Right Align */
/* Force Right Align */
.ranking-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end !important;
    /* Forces items inside (bubble) to right */
    justify-content: center;
    gap: 0.4rem;
    min-width: 140px;
    margin-left: auto !important;
    /* Pushes entire container to right */
}

.ranking-data-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 120px;
}

.ranking-temp {
    font-size: 1.7rem;
    /* Augmenté de ~30% */
    font-weight: 800;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
    min-width: 110px;
    /* Augmenté */
    white-space: nowrap;

    /* Pill Style Premium */
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    /* Augmenté */
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ranking-temp:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
}

.ranking-extremes {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    /* Plus petit pour être discret dessous */
    font-weight: 700;
    opacity: 0.9;
    white-space: nowrap;
    background: transparent;
    border: none;
    padding: 0;
    min-width: auto;
    box-shadow: none;
    backdrop-filter: none;
}



.label-tn {
    color: #4fc3f7;
    /* Soft Blue Label */
}

.label-tx {
    color: #ff5252;
    /* Vivid Red Label */
}

@media (max-width: 768px) {
    .map-section {
        padding-top: 110px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .map-box {
        padding: 1.5rem 0 !important;
        width: 100% !important;
        margin: 10px 0;
        border-radius: 16px;
    }

    #juraMap {
        height: 350px;
        width: calc(100% - 20px);
        margin: 0 auto;
        border-radius: 12px;
    }

    .map-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.8rem;
    }

    .map-legend {
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
    }

    .legend-hint {
        order: -1;
        /* Show hint above status on mobile */
        margin-bottom: 0.2rem;
    }

    .ranking-section {
        padding: 1.2rem 1rem;
    }

    /* Compact Time Picker for Mobile */
    .time-capsule {
        padding: 2px 8px;
        /* Very thin padding */
        gap: 0.2rem;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        /* More subtle border */
        background: rgba(255, 255, 255, 0.05);
    }

    .time-capsule input[type="datetime-local"] {
        font-size: 0.8rem;
        padding: 0;
        height: 24px;
        /* Force small height */
        line-height: 24px;
    }

    /* Adjust the calendar icon to be small too */
    .time-capsule input[type="datetime-local"]::-webkit-calendar-picker-indicator {
        transform: scale(0.8);
    }
}

/* Glassmorphism Card */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Home Section */
.home-section {
    text-align: center;
}

.home-section h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: #0f172a;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    margin-top: 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(160, 196, 255, 0.3);
}

/* Data Section */
.data-section h2,
.contact-section h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-align: center;
}

.cities-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 5rem;
    width: 100% !important;
    max-width: 100% !important;
}

.station-block {
    width: 75% !important;
    max-width: 1100px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2rem !important;
    margin: 0 auto !important;
}

.city-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease;
}

.clickable-card {
    cursor: pointer;
}

.clickable-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
}

.city-card h3 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.grafana-embed {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    height: 350px;
    position: relative;
    cursor: zoom-in;
}

.embed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
}

.grafana-embed:hover .embed-overlay {
    background: rgba(255, 255, 255, 0.05);
}

.placeholder-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--glass-border);
    border-radius: 12px;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

.placeholder-content .icon {
    font-size: 3rem;
    opacity: 0.3;
}

.placeholder-content p {
    font-size: 1rem;
    font-weight: 500;
    max-width: 250px;
    line-height: 1.4;
}

.placeholder-content .date-tag {
    background: var(--primary-color);
    color: #0f172a;
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(160, 196, 255, 0.3);
}

.data-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
}

.data-btn.disabled:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
}

.status {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.online {
    background-color: #4ade80;
    box-shadow: 0 0 10px #4ade80;
}

.offline {
    background-color: #f87171;
    box-shadow: 0 0 8px #f87171;
}

.gray {
    background-color: #6b7280;
}

/* Contact Section */
.email-link {
    display: inline-block;
    margin-top: 1rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
    transition: opacity 0.3s ease;
}

.email-link:hover {
    opacity: 0.8;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.9);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--glass-border);
}

.time-controls {
    display: flex;
    gap: 0.5rem;
}

.time-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
    font-weight: 300;
}

input[type="date"].time-btn,
input[type="text"].time-btn.date-picker-alt {
    min-height: 40px;
    -webkit-appearance: none;
    appearance: none;
}

/* Style for the text placeholder state */
input[type="text"].time-btn.date-picker-alt::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.date-label-mobile {
    display: none;
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 2px;
}

.mobile-close-bar {
    display: none;
}

.time-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
}

.time-btn.active {
    background: var(--primary-color);
    color: #0f172a;
    font-weight: 600;
    border-color: var(--primary-color);
}

.modal-content {
    position: relative;
    width: 95%;
    max-width: 1400px;
    height: 85vh;
    background: #111827;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-content iframe {
    width: 100%;
    flex-grow: 1;
    border: none;
}

.close-modal {
    display: block;
    position: static;
    font-size: 2.5rem;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s ease;
}

.close-modal:hover {
    transform: scale(1.1);
    color: var(--primary-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .home-section h1 {
        font-size: 2.5rem;
    }

    .nav-links {
        display: none;
    }

    .navbar {
        justify-content: center;
    }

    .modal {
        padding: 1rem;
    }

    .modal-content {
        height: 70vh;
    }
}

/* Data Table Styles */
.table-modal {
    max-width: 1000px;
    height: 80vh;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.filter-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0 1rem;
    transition: all 0.3s ease;
}

.filter-item:focus-within {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(160, 196, 255, 0.2);
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 0.6rem;
    color: var(--primary-color);
    white-space: nowrap;
}

.filter-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
    opacity: 0.8;
}

.filter-item input {
    background: transparent !important;
    border: none !important;
    color: white !important;
    padding: 0.7rem 0 !important;
    font-family: 'Outfit', sans-serif;
    outline: none !important;
    width: 100%;
}

#tableDate {
    min-width: 130px;
}

#tableDate::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    margin-left: 5px;
}

.table-modal h2 {
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.table-wrapper {
    padding: 1rem 2rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
    position: relative;
}

#weatherTable {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

#weatherTable th {
    position: sticky;
    top: 0;
    background: #111827;
    padding: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid var(--glass-border);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    z-index: 20;
}

#weatherTable th:hover {
    background: rgba(255, 255, 255, 0.05);
}

#weatherTable td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}

#weatherTable tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.sort-icon {
    font-size: 0.8rem;
    margin-left: 0.5rem;
    opacity: 0.5;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1.5rem;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.no-data {
    text-align: center;
    padding: 4rem;
    opacity: 0.6;
    font-style: italic;
}

/* Premium Button Style - Modern Rounded */
.data-btn {
    background: rgba(160, 196, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(160, 196, 255, 0.3);
    color: var(--primary-color);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    width: fit-content;
    margin: 1rem auto 0;
}

.data-btn:hover {
    background: var(--primary-color);
    color: #0f172a;
    border-color: var(--primary-color);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(160, 196, 255, 0.5);
}

.data-btn:active {
    transform: translateY(-2px);
}

.modern-glow {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.modern-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.6s ease;
    z-index: -1;
}

.modern-glow:hover::before {
    transform: scale(1);
}

@media (max-width: 768px) {
    .data-section {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .station-block {
        width: 100% !important;
        padding: 0 !important;
    }

    .city-card {
        padding: 1.2rem 0;
        border-radius: 16px;
        border: 1px solid var(--glass-border);
        width: 100%;
    }

    .city-card h3,
    .city-card .status {
        padding: 0 1.2rem;
    }

    .grafana-embed,
    .placeholder-box {
        height: 300px;
        width: calc(100% - 20px);
        margin: 0 auto;
        border-radius: 12px;
    }

    .header-left {
        gap: 2rem;
        /* Increased spacing between title and filters */
        align-items: center;
        text-align: center;
    }

    .filter-controls {
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
        align-items: center;
        /* Center the items */
    }

    .filter-item {
        border-radius: 12px !important;
        padding: 10px 15px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        height: auto !important;
        align-items: flex-start !important;
        width: 70% !important;
        /* Reduced width */
    }

    /* Hide desktop 'Jour :' label on mobile */
    .filter-label {
        display: none !important;
    }

    .date-label-mobile {
        display: block;
        margin-bottom: 4px;
        font-size: 0.8rem;
        color: #94a3b8;
        font-weight: 500;
        text-align: left;
    }

    /* Adjust input inside filter item */
    .filter-item input {
        width: 100%;
        font-size: 1rem !important;
        padding: 5px 0 !important;
        height: 30px;
    }

    /* Search icon adjustment */
    .filter-item .filter-icon {
        display: none;
        /* Hide search icon to save space or keep it? Let's hide it for cleaner text input look if wanted, or keep it. User complained about date picker. */
    }

    /* Specific fix for search input to look like date input */
    #tableSearch {
        padding-left: 0 !important;
    }

    #tableDate,
    .filter-item input {
        width: 100% !important;
        font-size: 0.9rem;
    }

    .table-modal {
        height: 95vh;
        width: 100% !important;
        border-radius: 0;
    }

    .table-wrapper {
        padding: 0.5rem;
    }

    #weatherTable th,
    #weatherTable td {
        padding: 0.8rem 0.4rem;
        font-size: 0.72rem;
        white-space: nowrap;
        font-weight: 600;
    }

    .table-wrapper {
        padding: 0.3rem;
        -webkit-overflow-scrolling: touch;
    }

    .city-card h3 {
        font-size: 1.2rem;
        text-align: center;
    }

    .data-btn {
        width: fit-content;
        padding: 0.7rem 1.5rem;
        font-size: 0.75rem;
        margin: 0.5rem auto 0;
    }

    .modal-header {
        padding: 0.8rem 1rem !important;
        position: relative;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    /* Compact title on mobile */
    .table-modal h2,
    #tableTitle {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
    }

    /* Compact header-left on mobile */
    .header-left {
        gap: 0.6rem !important;
    }

    /* Compact filter controls on mobile */
    .table-modal .filter-controls {
        gap: 0.5rem !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center;
    }

    .table-modal .filter-item {
        width: auto !important;
        padding: 6px 10px !important;
        flex: 1 1 auto;
        min-width: 100px;
        max-width: 48%;
    }

    .table-modal .filter-item input {
        font-size: 0.8rem !important;
        padding: 3px 0 !important;
        height: auto !important;
    }

    .date-label-mobile {
        font-size: 0.65rem !important;
        margin-bottom: 2px !important;
    }

    /* Compact climatology button on mobile */
    .clima-switch-btn {
        padding: 6px 12px !important;
        font-size: 0.7rem !important;
        width: 100% !important;
        margin-top: 4px;
    }

    /* New Dedicated Close Bar for Mobile */
    .mobile-close-bar {
        display: flex !important;
        justify-content: flex-end;
        width: 100%;
        padding: 12px 12px 0;
        margin-bottom: -1.5rem;
        position: relative;
        z-index: 100;
    }

    /* Hide desktop close buttons on mobile */
    .modal-header>.close-modal,
    .clima-close-desktop,
    .header-right-actions .close-modal {
        display: none !important;
    }

    #tableDate,
    .filter-item input,
    .date-picker-alt {
        text-align: center !important;
    }
}

/* === CSS CONSOLIDÉ RANKING === */
/* Ce bloc remplace et surcharge les définitions précédentes pour garantir l'alignement */

/* CSS Consolidation handles general styles, media queries handle mobile exceptions */

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

/* LEFT COLUMN */
.ranking-info {
    justify-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    width: 100%;
}

.ranking-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
    font-weight: 600;
    font-size: 0.95rem;
}

/* RIGHT COLUMN */
.ranking-values {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    min-width: 0;
    margin-left: auto;
}

/* CENTER COLUMN (Actions) */
.ranking-actions {
    justify-self: end;
    /* Aligner à droite sur Desktop */
    display: flex;
    gap: 0.8rem;
    align-items: center;
    justify-content: flex-end;
    width: auto;
}

/* ACTION BUTTONS */
.action-btn {
    background: linear-gradient(180deg, #303650 0%, #1a1e2e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.95);
    padding: 0.6rem 1.2rem;
    /* Plus grand pour PC */
    border-radius: 25px;
    font-size: 0.9rem;
    /* Plus lisible */
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    backdrop-filter: blur(8px);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn-graph:hover {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.25), inset 0 0 20px rgba(56, 189, 248, 0.1);
    color: #fff;
    transform: translateY(-2px) scale(1.02);
}

.btn-table:hover {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.25), inset 0 0 20px rgba(251, 191, 36, 0.1);
    color: #fff;
    transform: translateY(-2px) scale(1.02);
}

.action-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
}

.action-btn:hover::after {
    left: 100%;
}

/* Climatologie Button */
.btn-clima {
    border-color: rgba(148, 163, 184, 0.3);
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.15) 0%, rgba(100, 116, 139, 0.1) 100%);
    color: #94a3b8;
}

.btn-clima:hover {
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: 0 4px 20px rgba(148, 163, 184, 0.25), inset 0 0 20px rgba(148, 163, 184, 0.1);
    color: #fff;
    transform: translateY(-2px) scale(1.02);
}

/* Dark Theme Select Dropdown */
.filter-controls select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.filter-controls select:hover,
.filter-controls select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(160, 196, 255, 0.2);
}

.filter-controls select option {
    background: #0f172a;
    color: white;
}

/* Climatological Statistics */
.clima-stats {
    margin-top: 1.5rem;
    padding: 1.2rem;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.stat-row.heat {
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9800;
}

.stat-row.frost {
    background: rgba(33, 150, 243, 0.1);
    border-left: 3px solid #2196f3;
}

.stat-row.ice {
    background: rgba(156, 39, 176, 0.1);
    border-left: 3px solid #9c27b0;
}

.stat-label {
    color: rgba(255, 255, 255, 0.85);
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    min-width: 40px;
    text-align: right;
}

/* Climatology Modal Scroll Body */
.clima-modal-content {
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-scroll-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.clima-modal-content .table-wrapper {
    padding-top: 0;
    overflow-y: visible;
    /* Let the parent handle scrolling */
}

/* Climatology Table Styling */
.clima-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-family: 'Inter', 'Outfit', system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.clima-table th,
.clima-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.clima-table th {
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    padding-bottom: 1rem;
}

.clima-table td {
    font-size: 0.95rem;
    font-weight: 500;
}

.clima-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Header Right Actions (Table Modal) */
.header-right-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.clima-switch-btn {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.2) 0%, rgba(100, 116, 139, 0.15) 100%);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #94a3b8;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.clima-switch-btn:hover {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.3) 0%, rgba(100, 116, 139, 0.25) 100%);
    border-color: rgba(148, 163, 184, 0.5);
    color: white;
    box-shadow: 0 4px 15px rgba(148, 163, 184, 0.2);
}

/* RESPONSIVE - Mobile Ranking Items as Horizontal Rows */
@media (max-width: 768px) {

    /* Ranking Header - Stack vertically */
    .ranking-header {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }

    .ranking-header h3 {
        font-size: 1rem;
    }

    .ranking-sort {
        flex-wrap: wrap;
        gap: 0.4rem;
        width: 100%;
    }

    .ranking-sort>span {
        display: none;
    }

    .ranking-item {
        display: grid;
        grid-template-columns: 100px 1fr;
        /* Réduit pour s'adapter à la nouvelle taille */
        align-items: center;
        gap: 0.8rem;
        padding: 0.3rem 0.6rem;
        /* Padding vertical réduit au minimum */
        border-radius: 0 10px 10px 10px;
        border-left: 3px solid var(--primary-color);
    }

    .ranking-temp {
        font-size: 1.5rem !important;
        min-width: 90px !important;
        padding: 4px 10px !important;
        /* Padding interne réduit */
    }

    .ranking-data-block {
        gap: 2px !important;
        /* Petit espace comme demandé */
        min-width: 100px !important;
    }

    .ranking-extremes {
        font-size: 0.65rem !important;
        margin-top: 0;
        /* Suppression de la marge négative */
    }

    /* Left Column Styles Removed */

    /* Header Tab: Name + Info */
    .ranking-header-tab {
        padding: 6px 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .ranking-header-tab .ranking-name {
        font-size: 0.8rem;
    }

    /* New Header Info Container */
    .ranking-header-info {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.7rem;
        opacity: 0.8;
    }

    /* Remove old styles */
    .ranking-info {
        display: none;
    }

    .ranking-sub-info {
        display: flex;
        flex-direction: column;
        /* Stacked */
        align-items: flex-start;
        gap: 2px;
        font-size: 0.65rem;
    }

    .ranking-altitude {
        font-size: 0.6rem;
    }

    .ranking-status {
        font-size: 0.55rem;
    }

    /* Buttons */
    /* Buttons (Inside Left Col) */
    .ranking-actions {
        display: flex;
        flex-direction: row;
        gap: 6px;
        justify-content: flex-end;
        /* Aligner à droite aussi sur mobile */
    }

    .action-btn {
        padding: 7px 10px;
        /* Réduit de 20% par rapport à 9x12 */
        font-size: 0.8rem;
        /* Réduit de 0.9rem */
        font-weight: 700;
        flex: 1;
        justify-content: center;
        border-radius: 10px;
        white-space: nowrap;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }



    /* Values column - Container */
    .ranking-values {
        grid-column: 2 / 3;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        background: transparent;
        border: none;
        padding: 0;
        min-width: 0;
        width: 100%;
        gap: 6px;
    }

    /* Current Temp - Prominent Bubble */
    .ranking-temp {
        font-size: 1.1rem;
        font-weight: 800;
        background: rgba(15, 23, 42, 0.8);
        border: 1px solid rgba(74, 222, 128, 0.4);
        color: #4ade80;
        padding: 4px 8px;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        min-width: 50px;
        text-align: center;
        margin-bottom: 0;
        line-height: normal;
    }

    /* Tn/Tx - Sur une seule ligne et sans boîte sur mobile */
    .ranking-extremes {
        flex-direction: row;
        /* Une seule ligne */
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-size: 0.75rem;
        gap: 10px;
        align-items: center;
        justify-content: center;
        min-width: auto;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }

    /* Hide snow badge on mobile to save space */
    .ranking-snow {
        display: none;
    }
}

/* New Compact Climatology Stats */
.clima-stats-compact-container {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.clima-stats-col {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.clima-stats-col.heat {
    border-top: 2px solid #ff9800;
}

.clima-stats-col.cold {
    border-top: 2px solid #00b0ff;
}

.clima-stat-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    opacity: 0.8;
}

.clima-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.clima-stat-item:last-child {
    border-bottom: none;
}

.clima-stat-label {
    color: #94a3b8;
}

.clima-stat-val {
    font-weight: 700;
    color: #f1f5f9;
}

@media (max-width: 600px) {
    .clima-stats-compact-container {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 768px) {

    /* Climatology Table & Stats */
    .clima-table th,
    .clima-table td {
        font-size: 0.8rem !important;
        padding: 6px 4px !important;
    }

    .clima-stat-val {
        font-size: 0.9rem !important;
    }

    .clima-stat-item {
        font-size: 0.75rem !important;
    }

    .clima-filter-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .btn-clima-dash {
        width: 100% !important;
        margin: 5px 0 0 0 !important;
        justify-content: center !important;
    }

    /* Modal Header & Actions */
    .time-controls {
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .time-btn {
        flex: 1 1 calc(25% - 10px) !important;
        min-width: 45px !important;
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
        text-align: center !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
    }

    input[type="date"].time-btn {
        flex: 1 1 100% !important;
        min-height: 40px !important;
    }

    .date-label-mobile {
        display: block !important;
        width: 100% !important;
        margin-top: 5px !important;
    }

    .header-right-actions {
        display: flex;
        flex-direction: column-reverse;
        align-items: flex-end;
        width: 100%;
        gap: 10px;
        margin-top: 10px;
    }

    .clima-switch-btn {
        position: relative !important;
        margin: 0 !important;
        width: 70% !important;
        /* Reduced width */
        justify-content: center !important;
    }

    .header-left .filter-controls {
        margin-right: 0 !important;
    }


    /* Scroll & Centering Fixes (Final) */
    .clima-modal-content {
        height: 95vh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .modal-scroll-body {
        padding-bottom: 2rem !important;
    }

    #btnShowStats {
        margin: 10px auto 0 !important;
        display: flex !important;
        justify-content: center !important;
        text-align: center !important;
        width: fit-content !important;
    }
}

/* --- SPARKLINE STYLES --- */

@media (min-width: 769px) {
    .ranking-item {
        grid-template-columns: 200px 1fr auto !important;
        align-items: center;
    }

    .sparkline-container {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 50px;
        width: 100%;
        padding: 0 1rem;
        opacity: 0.8;
        transition: opacity 0.3s;
    }

    .sparkline-container:hover {
        opacity: 1;
    }

    .sparkline-svg {
        width: 100%;
        height: 100%;
        max-width: 100%;
        /* Fill available space */
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .ranking-item {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 8px !important;
        padding-bottom: 12px !important;
        /* Space for sparkline */
    }

    .ranking-info {
        order: 1;
    }

    .ranking-actions {
        order: 2;
    }

    .sparkline-container {
        display: flex !important;
        order: 3;
        grid-column: 1 / -1;
        width: 100%;
        height: 35px !important;
        /* Compact height for mobile */
        padding: 0 !important;
        margin-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 4px !important;
    }
}

.no-data-spark {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
}

/* Sparkline Tooltip */
.spark-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    border-radius: 8px;
    pointer-events: none;
    font-size: 0.75rem;
    color: white;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transform: translate(-50%, -120%);
    white-space: nowrap;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.spark-tooltip .sp-val {
    font-weight: 700;
    font-size: 0.9rem;
}

.spark-tooltip .sp-time {
    opacity: 0.7;
    font-size: 0.7rem;
}

/* Sparkline Dots Styling */
.spark-dot {
    transition: r 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), stroke-width 0.2s;
    cursor: crosshair;
}

.spark-dot:hover {
    r: 5;
    stroke-width: 3;
    stroke: white;
}