/* css/style.css - Style Civilization pour La Frise des Savoirs */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #0a1c2a;
    color: #d4c9a6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow-x: hidden;
}

#container {
    width: 1400px;
    max-width: 100%;
    border: 3px solid #8b7d5b;
    background-color: #1a3a4a;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.5);
    overflow: hidden;
}

#header {
    background-color: #2d4d5c;
    padding: 15px 20px;
    border-bottom: 3px solid #8b7d5b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

#header h1 {
    font-size: clamp(16px, 5vw, 24px);
    letter-spacing: 3px;
    color: #ffd78c;
    text-shadow: 3px 3px 0 #5e3a1c;
    text-transform: uppercase;
}

#main {
    display: flex;
    padding: 20px;
    gap: 20px;
    flex-direction: row;
}

@media (max-width: 900px) {
    #main {
        flex-direction: column;
    }
}

#map-container {
    flex: 2;
    background-color: #2b4b3a;
    border: 3px solid #6b8c5c;
    position: relative;
    image-rendering: pixelated;
    height: 600px;
    min-height: 400px;
}

@media (max-width: 600px) {
    #map-container {
        height: 350px;
    }
}

#map {
    width: 100%;
    height: 100%;
    background-color: #2b4b3a;
}

.leaflet-container {
    background-color: #2b4b3a !important;
}

.leaflet-tile-pane {
    opacity: 0.8;
}

.leaflet-control-zoom a {
    background-color: #2d4d5c;
    color: #ffd78c;
    border: 2px solid #8b7d5b;
}

.leaflet-control-zoom a:hover {
    background-color: #3a6075;
}

@media (max-width: 480px) {
    .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 24px !important;
    }
}

.custom-div-icon {
    background: transparent;
    border: none;
}

.city-marker {
    background-color: #d4c9a6;
    border: 3px solid #5e3a1c;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    color: #1a3a4a;
    font-size: 14px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.city-marker-small {
    width: 20px;
    height: 20px;
    line-height: 14px;
    font-size: 10px;
}

.city-marker-large {
    width: 40px;
    height: 40px;
    line-height: 34px;
    font-size: 18px;
}

.leaflet-popup-content-wrapper {
    background-color: #1e3340;
    color: #d4c9a6;
    border: 3px solid #8b7d5b;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    box-shadow: 5px 5px 0 rgba(0,0,0,0.5);
}

.leaflet-popup-tip {
    background-color: #1e3340;
    border-top: 3px solid #8b7d5b;
    border-left: 3px solid #8b7d5b;
}

.leaflet-popup-content {
    margin: 15px;
    line-height: 1.6;
    max-width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

#sidebar {
    flex: 1;
    background-color: #2a3f4a;
    border: 3px solid #8b7d5b;
    padding: 15px;
    box-shadow: inset 0 0 0 1px #4a6b7a;
    max-height: 600px;
    overflow-y: auto;
}

#sidebar h2, #sidebar h3 {
    color: #ffd78c;
    border-bottom: 2px solid #8b7d5b;
    padding-bottom: 8px;
    margin-bottom: 15px;
    font-size: clamp(14px, 4vw, 18px);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#sidebar h3 {
    font-size: clamp(12px, 3.5vw, 16px);
    margin-top: 15px;
}

.city-info {
    margin-bottom: 12px;
    padding: 10px;
    background-color: #1e3340;
    border-left: 5px solid #ffd78c;
    border-bottom: 2px solid #4a5b4a;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: rgba(255, 215, 140, 0.3);
    touch-action: manipulation;
}

.city-info:hover {
    background-color: #2a4455;
    transform: translateX(5px);
}

.city-name {
    font-weight: bold;
    color: #ffd78c;
    font-size: clamp(12px, 3.5vw, 16px);
    text-transform: uppercase;
}

.city-count {
    font-size: clamp(10px, 3vw, 14px);
    color: #aac9d4;
    margin-top: 5px;
}

.city-desc {
    font-size: 10px;
    color: #aac9d4;
    margin-top: 5px;
}

#filters, #route-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn, .route-filter-btn {
    background-color: #1e3340;
    border: 2px solid #8b7d5b;
    color: #aac9d4;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: clamp(10px, 3vw, 12px);
    cursor: pointer;
    text-transform: uppercase;
    flex: 1;
    min-width: 60px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: rgba(255, 215, 140, 0.3);
    touch-action: manipulation;
}

.filter-btn.active, .route-filter-btn.active {
    background-color: #ffd78c;
    color: #1a3a4a;
    border-color: #5e3a1c;
    font-weight: bold;
}

.route-filter-btn {
    border-left-width: 6px;
}

#selected-work {
    background-color: #1e3340;
    border: 2px solid #5e7d5e;
    padding: 15px;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.6;
    box-shadow: inset 2px 2px 0 #0a1c2a;
}

.work-item {
    border-bottom: 1px dashed #5e7d5e;
    padding: 5px 0;
    white-space: normal;
    word-break: break-word;
}

.work-link {
    color: #ffd78c;
    text-decoration: none;
    border-bottom: 1px dotted;
}

.work-link:hover {
    color: #ffffff;
}

#timeline {
    background-color: #1e3340;
    border: 3px solid #8b7d5b;
    padding: 20px;
    margin: 0 20px 20px 20px;
    box-shadow: inset 0 0 0 1px #3a5a6a;
}

#century-display {
    text-align: center;
    font-size: clamp(18px, 5vw, 28px);
    font-weight: bold;
    color: #ffd78c;
    margin-bottom: 15px;
    text-shadow: 2px 2px 0 #5e3a1c;
}

#slider {
    width: 100%;
    margin: 15px 0;
    height: 10px;
    background-color: #2a4455;
    border: 2px solid #5e7d5e;
    appearance: none;
}

#slider::-webkit-slider-thumb {
    appearance: none;
    width: 25px;
    height: 25px;
    background-color: #ffd78c;
    border: 3px solid #5e3a1c;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    color: #aac9d4;
    font-size: clamp(8px, 2.5vw, 12px);
    margin-bottom: 15px;
}

.btn {
    background-color: #2d4d5c;
    border: 3px solid #8b7d5b;
    color: #ffd78c;
    padding: 10px 20px;
    font-family: 'Courier New', monospace;
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 3px 3px 0 #1a2a2a;
    transition: all 0.1s;
    min-width: 120px;
    -webkit-tap-highlight-color: rgba(255, 215, 140, 0.3);
    touch-action: manipulation;
}

@media (max-width: 500px) {
    .btn {
        padding: 8px 12px;
        min-width: 100px;
    }
}

.btn:hover {
    background-color: #3a6075;
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 #1a2a2a;
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #1a2a2a;
}

.timeline-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.route-line {
    transition: opacity 0.3s;
}

.arrow-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 20px;
    text-align: center;
    color: #ffd78c;
    text-shadow: 2px 2px 0 #000;
}

#legend {
    margin-top: 20px;
    padding: 10px;
    background-color: #1e3340;
    border: 2px solid #5e7d5e;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color {
    width: 20px;
    height: 4px;
    margin-right: 8px;
}

.legend-color.square {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb {
    background: #8b7d5b;
}

/* Optimisations mobiles */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    #container {
        border-width: 2px;
    }
    
    #header {
        padding: 10px;
    }
    
    #header h1 {
        font-size: 18px;
        letter-spacing: 1px;
        text-shadow: 2px 2px 0 #5e3a1c;
    }
    
    #main {
        padding: 10px;
        gap: 10px;
    }
    
    #map-container {
        height: 300px;
        min-height: 250px;
        border-width: 2px;
    }
    
    .city-marker {
        width: 24px;
        height: 24px;
        line-height: 18px;
        font-size: 12px;
        border-width: 2px;
        box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    }
    
    .city-marker-large {
        width: 32px;
        height: 32px;
        line-height: 26px;
        font-size: 14px;
    }
    
    .city-marker-small {
        width: 18px;
        height: 18px;
        line-height: 12px;
        font-size: 9px;
    }
    
    #sidebar {
        max-height: 300px;
        padding: 10px;
    }
    
    #sidebar h2 {
        font-size: 16px;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
    
    #sidebar h3 {
        font-size: 14px;
        margin-top: 10px;
    }
    
    .city-info {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .city-name {
        font-size: 14px;
    }
    
    .city-count {
        font-size: 12px;
    }
    
    .filter-btn, .route-filter-btn {
        padding: 4px 8px;
        font-size: 10px;
        min-width: 45px;
    }
    
    #timeline {
        padding: 12px;
        margin: 0 10px 10px 10px;
    }
    
    #century-display {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .slider-labels {
        font-size: 8px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 80px;
    }
    
    .timeline-controls {
        gap: 10px;
    }
    
    .leaflet-popup-content {
        max-width: 250px !important;
        max-height: 300px !important;
        font-size: 12px;
    }
    
    .leaflet-popup-content .btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    #legend {
        font-size: 10px;
        padding: 8px;
    }
}

@media (max-width: 800px) and (orientation: landscape) {
    #map-container {
        height: 250px;
    }
    
    #sidebar {
        max-height: 250px;
    }
}