/* === Screen Reader Only === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === Reset & Base === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1F2937;
    background: #FFFFFF;
}

/* === Layout === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: #F9FAFB;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid #E5E7EB;
}

.map-container {
    position: fixed;
    top: 0;
    left: 320px;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* === Sidebar Header === */
.sidebar-header {
    background: #1E3A5F;
    color: white;
    padding: 16px 20px;
    text-align: center;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.sidebar-header .year {
    font-size: 14px;
    opacity: 0.8;
}

/* === Progress Bar === */
.progress-section {
    padding: 12px 16px;
    border-bottom: 1px solid #E5E7EB;
}

.progress-text {
    font-size: 13px;
    color: #4B5563;
    margin-bottom: 6px;
}

.progress-bar {
    height: 10px;
    background: #E5E7EB;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #22C55E;
    border-radius: 5px;
    width: 0%;
    transition: width 0.3s ease;
}

/* === Search === */
.search-section {
    padding: 8px 16px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* === Filter Toggles === */
.filter-section {
    display: flex;
    gap: 4px;
    padding: 4px 16px 8px;
}

.filter-btn {
    flex: 1;
    padding: 6px;
    text-align: center;
    border: 1px solid #E5E7EB;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background: #F3F4F6;
}

.filter-btn:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.filter-btn.active {
    background: #1E3A5F;
    color: white;
    border-color: #1E3A5F;
}

/* === Library List === */
.library-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.library-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background 0.15s ease;
}

.library-item:hover {
    background: #F3F4F6;
}

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

.library-info {
    min-width: 0;
}

.library-name {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-town {
    font-size: 12px;
    color: #4B5563;
}

/* === Action Buttons === */
.actions-section {
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
}

.action-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.action-btn.primary {
    background: #3B82F6;
    color: white;
    margin-bottom: 8px;
}

.action-btn.primary:hover {
    background: #2563EB;
}

.action-row {
    display: flex;
    gap: 8px;
}

.action-btn.secondary {
    background: white;
    color: #1F2937;
    border: 1px solid #E5E7EB;
}

.action-btn.secondary:hover {
    background: #F3F4F6;
}

.action-btn.danger {
    background: white;
    color: #DC2626;
    border: 1px solid #E5E7EB;
}

.action-btn.danger:hover {
    background: #FEF2F2;
}

/* === Mobile Drawer Toggle === */
.drawer-toggle {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 22px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.drawer-toggle:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 8px;
}

.modal-message {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 8px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: white;
    color: #1F2937;
    transition: all 0.15s ease;
}

.modal-btn:hover {
    background: #F3F4F6;
}

.modal-btn:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.modal-btn.confirm {
    background: #3B82F6;
    color: white;
    border-color: #3B82F6;
}

.modal-btn.confirm:hover {
    background: #2563EB;
}

.modal-btn.danger {
    background: #DC2626;
    color: white;
    border-color: #DC2626;
}

.modal-btn.danger:hover {
    background: #B91C1C;
}

/* === Leaflet Popup Overrides === */
.custom-marker {
    background: transparent;
    border: none;
}

/* === Mobile Layout === */
@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 60vh;
        border-right: none;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateY(0);
    }

    .sidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #D1D5DB;
        border-radius: 2px;
        margin: 10px auto 6px;
    }

    .map-container {
        left: 0;
        height: 100vh;
    }

    .drawer-toggle {
        display: flex;
    }
}
