/* ════════════════════════════════════════════════════════════════
   Fraternité du Scoutisme — Design System
   ════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700;800&display=swap');

/* ─── CSS Variables ──────────────────────────────────────────── */
:root {
    /* Nature palette */
    --forest-900: #1a3a0a;
    --forest-800: #2D5016;
    --forest-700: #3a6b1e;
    --forest-600: #4a8528;
    --forest-500: #5a9e32;
    --forest-400: #7ab854;
    --forest-300: #a3d17e;
    --forest-200: #c8e5a8;
    --forest-100: #e8f5d4;
    --forest-50: #f4fae9;

    /* Earth tones */
    --earth-900: #3d2b1f;
    --earth-700: #6b4423;
    --earth-500: #8B6914;
    --earth-300: #c4a24f;
    --earth-100: #f5e6d3;
    --earth-50: #faf3e8;

    /* Sky & water */
    --sky-700: #1565c0;
    --sky-600: #1976d2;
    --sky-500: #2196f3;
    --sky-400: #42a5f5;
    --sky-300: #64b5f6;
    --sky-200: #90caf9;
    --sky-100: #bbdefb;
    --sky-50: #e3f2fd;

    /* Camp status */
    --camp-active: #ef4444;
    --camp-active-glow: rgba(239, 68, 68, 0.4);
    --camp-upcoming: #3b82f6;
    --camp-upcoming-glow: rgba(59, 130, 246, 0.4);

    /* Neutral */
    --neutral-950: #0a0f05;
    --neutral-900: #1a1f14;
    --neutral-800: #2a3024;
    --neutral-700: #3d4637;
    --neutral-600: #545e4e;
    --neutral-500: #6e7968;
    --neutral-400: #8c9686;
    --neutral-300: #aeb7a8;
    --neutral-200: #d0d6cb;
    --neutral-100: #e8ebe5;
    --neutral-50: #f5f7f3;

    /* UI */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-bg-light: rgba(255, 255, 255, 0.85);
    --glass-border-light: rgba(255, 255, 255, 0.6);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-primary: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(165deg, #0f1a0a 0%, #1a2e12 30%, #14261a 60%, #0d1f2d 100%);
    color: var(--neutral-100);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Subtle nature background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(45, 80, 22, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(21, 101, 192, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(139, 105, 20, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Header ─────────────────────────────────────────────────── */
.header {
    position: relative;
    z-index: 10;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 26, 10, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

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

.header-logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--forest-600), var(--forest-400));
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(74, 133, 40, 0.3);
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--forest-200), var(--earth-300));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--neutral-400);
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ─── Tab Navigation ─────────────────────────────────────────── */
.tabs-container {
    position: relative;
    z-index: 10;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(20, 30, 15, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.4rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
}

.tab-btn {
    position: relative;
    padding: 0.7rem 1.6rem;
    border: none;
    background: transparent;
    color: var(--neutral-400);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--neutral-100);
    background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
    color: var(--forest-50);
    background: linear-gradient(135deg, var(--forest-700), var(--forest-600));
    box-shadow: 0 4px 16px rgba(58, 107, 30, 0.35);
}

.tab-btn .tab-icon {
    font-size: 1.1rem;
}

/* ─── Map Container ──────────────────────────────────────────── */
.maps-wrapper {
    position: relative;
    z-index: 5;
    padding: 0 2rem 2rem;
    flex: 1;
}

.map-panel {
    display: none;
    animation: fadeSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-panel.active {
    display: block;
}

.map-card {
    background: rgba(20, 30, 15, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.map-card-header {
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.map-card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--neutral-50);
}

.map-card-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--neutral-300);
    font-weight: 500;
}

.map-card-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--forest-400);
    animation: pulse-dot 2s infinite;
}

.leaflet-container {
    height: 70vh;
    min-height: 400px;
    background: #0d1f2d;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ─── Legend ──────────────────────────────────────────────────── */
.map-legend {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 1000;
    background: rgba(15, 26, 10, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: var(--shadow-lg);
}

.legend-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--neutral-400);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--neutral-200);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.active {
    background: var(--camp-active);
    box-shadow: 0 0 8px var(--camp-active-glow);
}

.legend-dot.upcoming {
    background: var(--camp-upcoming);
    box-shadow: 0 0 8px var(--camp-upcoming-glow);
}

.legend-dot.unit {
    background: var(--forest-400);
    box-shadow: 0 0 8px rgba(122, 184, 84, 0.4);
}

/* ─── Camp Form Modal ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(165deg, #1a2e12 0%, #14261a 100%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.modal-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neutral-50);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--neutral-400);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--neutral-300);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--neutral-50);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--forest-500);
    box-shadow: 0 0 0 3px rgba(90, 158, 50, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: var(--neutral-600);
}

/* Date input styles */
.form-input[type="date"] {
    color-scheme: dark;
}

.form-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.form-submit {
    width: 100%;
    padding: 0.85rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--forest-600), var(--forest-500));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(74, 133, 40, 0.25);
}

.form-submit:hover {
    background: linear-gradient(135deg, var(--forest-500), var(--forest-400));
    box-shadow: 0 6px 20px rgba(74, 133, 40, 0.35);
    transform: translateY(-1px);
}

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

.form-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ─── Instructions Banner ────────────────────────────────────── */
.instruction-banner {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(15, 26, 10, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: 0.6rem 1.4rem;
    font-size: 0.85rem;
    color: var(--neutral-200);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    pointer-events: none;
}

.instruction-banner .inst-icon {
    font-size: 1rem;
}

/* ─── Custom Leaflet Markers ─────────────────────────────────── */
.scout-marker {
    background: none;
    border: none;
}

.marker-pin {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    position: relative;
}

.marker-pin::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

.marker-pin.unit {
    background: linear-gradient(135deg, var(--forest-600), var(--forest-400));
    border: 2px solid var(--forest-300);
}

.marker-pin.unit::after {
    border-top: 6px solid var(--forest-400);
}

.marker-pin.camp-active {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: 2px solid #fca5a5;
    animation: pulse-marker 2s infinite;
}

.marker-pin.camp-active::after {
    border-top: 6px solid #ef4444;
}

.marker-pin.camp-upcoming {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: 2px solid #93c5fd;
}

.marker-pin.camp-upcoming::after {
    border-top: 6px solid #3b82f6;
}

.marker-pin:hover {
    transform: scale(1.2);
    z-index: 1000 !important;
}

/* ─── Custom Popups ──────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
    background: rgba(15, 26, 10, 0.92) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--neutral-100) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    font-family: var(--font-primary) !important;
}

.leaflet-popup-tip {
    background: rgba(15, 26, 10, 0.92) !important;
    border: 1px solid var(--glass-border) !important;
}

.popup-content {
    padding: 0.8rem 1rem;
}

.popup-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--neutral-50);
    margin-bottom: 0.2rem;
}

.popup-dates {
    font-size: 0.78rem;
    color: var(--neutral-400);
}

.popup-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-status.active {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.popup-status.upcoming {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ─── Toast Notifications ────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: rgba(15, 26, 10, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    color: var(--neutral-100);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    min-width: 250px;
}

.toast.success {
    border-left: 3px solid var(--forest-400);
}

.toast.error {
    border-left: 3px solid #ef4444;
}

/* ─── Empty State (Carte 3) ──────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--neutral-500);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    text-align: center;
    pointer-events: none;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
    font-weight: 500;
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes pulse-marker {
    0% { box-shadow: 0 0 0 0 var(--camp-active-glow); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header {
        padding: 1rem 1.2rem;
        flex-direction: column;
        gap: 0.8rem;
    }

    .header-title {
        font-size: 1.3rem;
    }

    .tabs-container {
        padding: 0.8rem 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tabs {
        width: 100%;
        justify-content: center;
    }

    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.82rem;
    }

    .tab-btn .tab-label {
        display: none;
    }

    .tab-btn .tab-icon {
        font-size: 1.2rem;
    }

    .maps-wrapper {
        padding: 0 0.8rem 1rem;
    }

    .leaflet-container {
        height: 60vh;
        min-height: 300px;
    }

    .map-card-header {
        padding: 0.9rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .map-legend {
        bottom: 0.8rem;
        left: 0.8rem;
        padding: 0.7rem 0.9rem;
        font-size: 0.8rem;
    }

    .instruction-banner {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        max-width: 85%;
        white-space: normal;
        text-align: center;
    }

    .modal {
        width: 95%;
        padding: 1.5rem;
    }

    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header-logo {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

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

    .header-subtitle {
        font-size: 0.7rem;
    }

    .tabs {
        padding: 0.3rem;
        gap: 0.3rem;
    }

    .tab-btn {
        padding: 0.55rem 0.8rem;
    }

    .leaflet-container {
        height: 55vh;
    }

    .form-dates {
        grid-template-columns: 1fr;
    }
}

/* ─── Leaflet overrides ──────────────────────────────────────── */
.leaflet-control-zoom {
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    background: rgba(15, 26, 10, 0.85) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--neutral-200) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    transition: all 0.2s ease;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 1.1rem !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(45, 80, 22, 0.6) !important;
    color: var(--neutral-50) !important;
}

.leaflet-control-zoom a.leaflet-disabled {
    background: rgba(15, 26, 10, 0.5) !important;
    color: var(--neutral-600) !important;
    cursor: not-allowed;
}

.leaflet-control-attribution {
    background: rgba(15, 26, 10, 0.7) !important;
    color: var(--neutral-500) !important;
    font-size: 0.65rem !important;
    border-radius: var(--radius-sm) 0 0 0 !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.leaflet-control-attribution a {
    color: var(--forest-300) !important;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-700);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-600);
}
