/* ============================================================
   DESIGN SYSTEM FEUDART
   Aesthétiques Moderne, Glassmorphism, Dark Mode Map & Responsive UI
   ============================================================ */

:root {
    --primary-color: #1e293b;
    --primary-dark: #0f172a;
    --accent-color: #3b82f6;
    --accent-gold: #f59e0b;
    --accent-danger: #ef4444;
    --accent-success: #10b981;

    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --header-height: 64px;
    --bottom-nav-height: 65px;
}

[data-theme="dark"] {
    --bg-main: #0b0f19;
    --bg-surface: #151c2c;
    --bg-glass: rgba(21, 28, 44, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #2a364f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

/* APP CONTAINER LAYOUT (DESKTOP DEFAULT) */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* HEADER TOP BAR */
.main-header {
    height: 70px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand-title .highlight {
    color: var(--accent-gold, #f59e0b);
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.3rem;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 550px;
    margin: 0 1rem;
}

.live-countdown-ticker {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.4rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.live-countdown-ticker .pulse-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ticker-label {
    color: var(--text-muted);
    font-weight: 600;
}

.ticker-text {
    color: var(--accent-gold, #f59e0b);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* User Dropdown Menu */
.user-dropdown-container {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.4rem 0.9rem 0.4rem 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.88rem;
}

.user-dropdown-btn:hover {
    border-color: var(--accent-gold);
    background: var(--bg-surface);
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    padding: 0.6rem;
    z-index: 1100;
    animation: fadeInDown 0.2s ease-out;
}

.user-dropdown-menu.active {
    display: block;
}

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

.dropdown-header {
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.4rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-main);
    color: var(--accent-gold);
}

.dropdown-item.danger {
    color: #ef4444;
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-main);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

/* MAIN CONTENT AREA (PANEL + MAP) */
.main-content {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* PANNEAU LATÉRAL & CARTES D'ÉVÉNEMENTS PROPRES */
.side-panel {
    width: 380px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 500;
}

.panel-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.filter-tags::-webkit-scrollbar {
    display: none;
}

.tag-chip {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tag-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.tag-chip.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.events-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* CARTE D'ÉVÉNEMENT ÉPURÉE, AÉRÉE & SANS TRONCAGE */
.event-card {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 1.1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.12);
}

.event-card-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
    color: var(--text-primary);
    word-break: break-word;
    white-space: normal;
}

.event-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.event-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.organizer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--accent-color);
    font-weight: 700;
    margin-top: 0.2rem;
}

/* MAP CONTAINER */
#map-wrapper {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* MAP CONTROLS & FLOATING BAR */
.map-floating-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.map-btn:hover {
    background: var(--bg-main);
    transform: scale(1.05);
}

/* MOBILE BOTTOM SHEET & NAVIGATION */
.bottom-nav {
    display: none;
    height: var(--bottom-nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.nav-item i {
    font-size: 1.35rem;
}

.nav-item.active {
    color: var(--accent-color);
}

/* ============================================================
   DESIGN MODALES & BOUTONS PREMIUM (GLASSMORPHISM & ACCENTS)
   ============================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 1rem;
}

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

.modal-card {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    background: var(--bg-surface);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(15px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 70px);
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* BOUTONS ET FORMULAIRES DESIGN PRO */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* BOUTONS STYLE APPLE / PREMIUM */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.btn-primary {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.btn-primary:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--text-secondary);
}

/* AUTOCOMPLETE CONTAINER */
.autocomplete-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

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

.autocomplete-item:hover {
    background: var(--bg-main);
    color: var(--accent-color);
}

/* ============================================================
   OPTIMISATION RESPONSIVE PWA MOBILE (CARTE ET LISTE DÉCOUPLÉES)
   ============================================================ */

/* ============================================================
   OPTIMISATION RESPONSIVE PWA MOBILE (HEADER ÉPURÉ & LISTE FLUIDE)
   ============================================================ */

@media (max-width: 768px) {
    /* HEADER MOBILE ULTRA ÉPURÉ : LOGO + SWAP THÈME SEULEMENT */
    .main-header {
        height: 60px;
        min-height: 60px;
        padding: 0 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
    }

    /* Masquer tous les éléments superflus sur le header mobile */
    .header-center,
    .btn-declare,
    .user-dropdown-container,
    .header-right > .btn-outline {
        display: none !important;
    }

    .header-left {
        display: flex;
        align-items: center;
    }

    .header-right {
        display: flex;
        align-items: center;
    }

    .brand {
        font-size: 1.2rem;
    }

    .brand-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    /* PANNEAU LISTE (ÉVÉNEMENTS À VENIR) SUR MOBILE */
    .side-panel {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px - var(--bottom-nav-height));
        height: calc(100dvh - 60px - var(--bottom-nav-height));
        background: var(--bg-main);
        z-index: 600;
        display: none;
        overflow-y: auto;
        border: none;
        border-radius: 0;
        padding: 1rem;
        box-sizing: border-box;
    }

    .side-panel.active-tab {
        display: block;
    }

    .mobile-close-list {
        display: inline-flex !important;
    }

    #map-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px - var(--bottom-nav-height));
        height: calc(100dvh - 60px - var(--bottom-nav-height));
        z-index: 100;
        display: block;
    }

    #map-wrapper.hidden-tab {
        display: none;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--bottom-nav-height);
        background: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
        z-index: 1500;
    }

    /* MODALES SUR MOBILE : CENTRÉES, Z-INDEX SUPERIEUR (2500) & BOUTONS 100% VISIBLES */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        padding: 1rem;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2500 !important; /* Supérieur à la bottom-nav (z-index 1500) */
        background: rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(8px);
    }

    .modal,
    .modal-card {
        max-width: 100%;
        width: 100%;
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
        border-radius: 20px;
        overflow-y: auto;
        margin: auto;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }

    .modal-body {
        max-height: calc(100vh - 160px);
        max-height: calc(100dvh - 160px);
        overflow-y: auto;
    }

    .modal-footer {
        padding-bottom: 1.25rem;
    }
}
