/* ===== CSS VARIABLES ===== */
:root {
    --bar-h: 60px;        /* filter bar height */
    --yearbar-h: 60px;    /* top bar height (perspective filter + help/about) */
}

/* ===== GLOBAL STYLES ===== */
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: system-ui, sans-serif;
    background: #1e1e1e;
}

#wrapper {
    height: calc(100dvh * 2);
    transition: transform 0.6s ease;
}

.slice {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ===== SHARED CONTROL STYLES ===== */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.controls select,
.controls input[type="text"] {
    background: #2c2c2c;
    color: #f0f0f0;
    border: none;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 16px;
    width: 160px;
    min-height: 40px;
    box-sizing: border-box;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #444;
    color: #fff;
    cursor: pointer;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
}

.btn.inactive {
    background: #444;
}

.btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ===== SHARED FILTER BAR ===== */
#filterbar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1300;
    height: var(--bar-h);
    background: #1e1e1e;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    justify-content: center;
    transition: all 0.6s ease;
}

#filterbar.in-posts {
    top: 10px;
}

#filterbar.in-map {
    bottom: 0;
}

#filterbar input {
    background: #2c2c2c;
    color: #f0f0f0;
    border: none;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 16px;
    width: 220px;
    flex: 1;
    min-height: 40px;
    box-sizing: border-box;
}

/* ===== TOP BAR (YEAR BAR) ===== */
#yearbar {
    height: var(--yearbar-h);
    flex-direction: column;
    background: #181818;
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    padding: 15px 12px 0;
}

.bar-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.hidden {
    display: none;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.modal-content {
    background: #1e1e1e;
    padding: 24px 28px;
    border-radius: 12px;
    max-width: 600px;
    width: 85%;
    color: #eee;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 768px) {
    .modal-content {
        width: 85%;
        max-width: none;
        padding: 16px 12px;
        margin: 20px auto;
        max-height: 70vh;
        border-radius: 8px;
    }

    .modal-close {
        position: absolute;
        top: 6px;
        right: 8px;
        background: rgba(0, 0, 0, 0.3);
        border: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        padding: 6px;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 88%;
        margin: 16px auto;
        max-height: 65vh;
        padding: 12px 10px;
    }
}

/* ===== MAP ===== */
#map {
    flex: 1 1 auto;
    height: calc(100dvh - var(--yearbar-h) - var(--bar-h));
}

/* ===== POSTS SLICE ===== */
#posts-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 18px;
    padding-top: calc(var(--bar-h) - 20px);
    margin-top: var(--bar-h);
}

details.entry {
    border-radius: 8px;
    background: #2a2a2a;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}

details.entry summary {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 16px 20px 16px 28px;
    cursor: pointer;
    position: relative;
}

details.entry summary::-webkit-details-marker,
details.entry summary::marker {
    display: none;
}

.color-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
}

.entry-start {
    font-weight: 700;
    color: #aaa;
    margin-right: 10px;
    white-space: nowrap;
    font-size: 15px;
}

.entry-title {
    flex: 1;
    color: #eee;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-body {
    padding: 14px 22px 18px 28px;
    color: #ddd;
    background: #2d2d2d;
    border-top: 1px solid #444;
    max-height: 50vh;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.5;
}

/* ===== LEAFLET STYLES ===== */
.country-tip {
    background: rgba(42, 42, 42, 0.9);
    border: none;
    color: #fff;
    font-size: 14px;
    padding: 6px 10px;
}

.leaflet-bottom.leaflet-left .legend {
    margin-bottom: 100px;
}

/* ===== LINK STYLES ===== */
a {
    color: #64b5f6;  /* Light blue for better contrast */
    text-decoration: none;
}

a:hover {
    color: #90caf9;  /* Lighter blue on hover */
    text-decoration: underline;
}

a:focus {
    outline: 2px solid #64b5f6;
    outline-offset: 2px;
}