/* style.css - v2.0 - Interface utilisateur SIVOM */

:root {
    --color-primary: #254193;
    --color-secondary: #E30513;
    --color-accent: #00973A;
    --color-warning: #FECF23;
    --color-alt1: #009EE3;
    --color-alt2: #82358B;
    --color-dark: #2A2A2A;
    --color-light: #F8F9FA;
    --color-border: #E0E0E0;
    --color-success: #00973A;
    --color-info: #009EE3;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--color-light);
    color: var(--color-dark);
    line-height: 1.6;
}

/* HEADER */
.header-sivom {
    background: linear-gradient(135deg, var(--color-primary) 0%, #1a2d5f 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-sivom .logo {
    height: 50px;
    object-fit: contain;
}

.header-sivom h1 {
    flex: 1;
    min-width: 200px;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
}

.btn-admin {
    background: var(--color-secondary);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
}

.btn-admin:hover {
    background: #c10411;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(227, 5, 19, 0.3);
}

/* MAIN CONTAINER */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* SECTION SÉLECTION */
.selection-section {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 5px solid var(--color-primary);
}

.selection-section h2 {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selection-section h2::before {
    content: '🏙️';
    font-size: 1.8rem;
}

.commune-select {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: white;
    color: var(--color-dark);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.commune-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 65, 147, 0.1);
}

.commune-select option {
    padding: 0.75rem;
    color: var(--color-dark);
}

/* BOUTONS */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

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

.btn-primary:hover:not(:disabled) {
    background: #1a2d5f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 65, 147, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    width: 100%;
    text-decoration: none;
    justify-content: center;
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 65, 147, 0.2);
}

/* SECTION CARTE */
.map-section {
    display: flex;
    gap: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 600px;
    border-top: 5px solid var(--color-accent);
}

.map-container {
    flex: 1;
    min-height: 600px;
    background: #f0f0f0;
    position: relative;
    border-radius: var(--radius) 0 0 var(--radius);
}

.map-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(37, 65, 147, 0.02), rgba(0, 158, 227, 0.02));
    pointer-events: none;
}

/* PANNEAU INFO */
.info-panel {
    width: 320px;
    padding: 2rem;
    background: linear-gradient(180deg, var(--color-light) 0%, #ffffff 100%);
    overflow-y: auto;
    border-left: 1px solid var(--color-border);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.info-panel h3 {
    color: var(--color-primary);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-accent);
}

.info-panel strong {
    display: block;
    color: var(--color-primary);
    margin: 1rem 0 0.75rem;
    font-size: 0.95rem;
}

#secteurInfo {
    font-size: 0.95rem;
    color: #555;
}

/* DATE BADGES */
.date-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--color-info) 0%, var(--color-alt1) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin: 0.4rem 0.4rem 0.4rem 0;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 158, 227, 0.3);
    transition: all 0.3s ease;
}

.date-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 158, 227, 0.4);
}

/* LEAFLET CUSTOMIZATION */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.95);
    font-size: 0.75rem;
}

.leaflet-popup-content-wrapper {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
}

.leaflet-popup-tip {
    background: white;
}

.leaflet-popup-content {
    margin: 0 !important;
    font-size: 0.9rem;
}

.leaflet-popup-content strong {
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.5rem;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
    .main-container {
        padding: 1.5rem;
    }

    .map-section {
        gap: 1rem;
        min-height: 500px;
    }

    .map-container {
        min-height: 500px;
    }

    .info-panel {
        width: 280px;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header-sivom {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .header-sivom h1 {
        width: 100%;
        font-size: 1.4rem;
        order: 2;
        margin-top: 0.75rem;
    }

    .header-sivom .logo {
        order: 1;
    }

    .btn-admin {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .main-container {
        padding: 1rem;
    }

    .selection-section {
        padding: 1.5rem;
    }

    .selection-section h2 {
        font-size: 1.2rem;
    }

    .map-section {
        flex-direction: column;
        min-height: auto;
    }

    .map-container {
        min-height: 400px;
        width: 100%;
    }

    .info-panel {
        width: 100%;
        max-height: 300px;
        padding: 1rem;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .commune-select {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-sivom {
        gap: 0.5rem;
    }

    .header-sivom h1 {
        font-size: 1.2rem;
    }

    .main-container {
        padding: 0.75rem;
    }

    .selection-section {
        padding: 1rem;
        border-radius: 6px;
    }

    .selection-section h2 {
        font-size: 1rem;
    }

    .map-container {
        min-height: 350px;
    }

    .info-panel {
        max-height: 250px;
        padding: 0.75rem;
    }

    .date-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
        margin: 0.3rem 0.3rem 0.3rem 0;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }
}

/* ANIMATIONS */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selection-section,
.map-section {
    animation: fadeIn 0.4s ease;
}

/* VERSION */
.app-version {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    color: #bbb;
    font-family: 'Courier New', monospace;
    z-index: 100;
}

/* PRINT FRIENDLY */
@media print {
    .header-sivom,
    .selection-section,
    .btn-primary,
    .btn-secondary {
        display: none;
    }

    .map-section {
        box-shadow: none;
        border: 1px solid #000;
    }
}