:root {
    --map-bg: #eaf0f6;
    --map-border: #dde4ed;
    --sidebar-bg: #ffffff;
    --text-main: #1a202c;
    --text-muted: #6b7280;
    --brand-color: #3b82f6;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --normal-color: #10b981;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
    --bg: #f7f9fb;
}

.map-page {
    background-color: transparent;
    color: var(--text-main);
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100%;
}

.map-surface {
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(24px, 6vw, 40px) clamp(16px, 4vw, 32px) 48px;
}

.map-header {
    margin-bottom: 2rem;
}

.breadcrumbs {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

.title {
    margin: 0.25rem 0 0;
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.subtitle {
    margin-top: 0.5rem;
    color: #4b5563;
    font-weight: 600;
}

.map-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1.5rem;
    align-items: flex-start;
}

.map-container {
    position: relative;
    border: 1px solid var(--map-border);
    border-radius: var(--radius-lg);
    background-color: var(--map-bg);
    box-shadow: var(--shadow-sm);
    height: 75vh;
    min-height: 480px;
}

.map-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.map-canvas {
    width: 100%;
    height: 100%;
}

.map-locate-button {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
    z-index: 5;
}

.map-locate-button:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
    transform: translateY(-1px);
}

.map-locate-button:active {
    transform: translateY(0);
}

.map-locate-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.map-locate-button.is-busy {
    cursor: wait;
}

.map-locate-button.is-busy span[aria-hidden="true"] {
    animation: locate-spin 0.9s linear infinite;
}

.map-locate-button span[aria-hidden="true"] {
    width: 20px;
    height: 20px;
    background-color: #1f4bd8;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%231f4bd8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19 12a7 7 0 0 1-7 7 7 7 0 0 1-7-7 7 7 0 0 1 7-7 7 7 0 0 1 7 7z"/><line x1="12" y1="5" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="19"/><line x1="19" y1="12" x2="21" y2="12"/><line x1="3" y1="12" x2="5" y2="12"/></svg>') no-repeat center;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%231f4bd8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19 12a7 7 0 0 1-7 7 7 7 0 0 1-7-7 7 7 0 0 1 7-7 7 7 0 0 1 7 7z"/><line x1="12" y1="5" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="19"/><line x1="19" y1="12" x2="21" y2="12"/><line x1="3" y1="12" x2="5" y2="12"/></svg>') no-repeat center;
}

.map-locate-button .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.map-hint {
    position: absolute;
    inset-inline: 16px;
    bottom: 16px;
    margin: 0;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background-color: rgba(17, 24, 39, 0.72);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.map-hint--error {
    background-color: rgba(220, 38, 38, 0.85);
}

.map-sidebar {
    position: sticky;
    top: 24px;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-group,
.camera-list-panel,
.info-panel {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--map-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.sidebar-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    flex: 1;
    border: 1px solid var(--map-border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--text-main);
    font-weight: 600;
    padding: 0.65rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.filter-btn.is-active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
    color: #1d4ed8;
}

.camera-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 360px;
    overflow: auto;
}

.camera-list-empty {
    margin: 0;
    padding: 1rem;
    border-radius: var(--radius-md);
    background-color: #f1f5f9;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.camera-list-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.camera-list-item:hover {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.camera-list-item.is-active {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 10px 24px rgba(30, 64, 175, 0.18);
    background: rgba(59, 130, 246, 0.08);
}

.camera-list-item--no-coords {
    background: #fff7ed;
}

.camera-list-item--no-coords.is-active {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.5);
}

.camera-list-item__status-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.camera-list-item__status-dot--free {
    background-color: var(--normal-color);
}

.camera-list-item__status-dot--caution {
    background-color: var(--warning-color);
}

.camera-list-item__status-dot--danger {
    background-color: var(--danger-color);
}

.camera-list-item__status-dot--no-data {
    background-color: #94a3b8;
}

.camera-list-item__info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.camera-list-item__name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.camera-list-item__location {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.camera-list-item__location--muted {
    color: #94a3b8;
}

.camera-list-item__location--warning {
    color: #b45309;
}

.list-summary {
    margin-bottom: 0.75rem;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

.info-panel {
    position: relative;
}

.info-panel__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.info-panel__close:hover {
    background: rgba(100, 116, 139, 0.28);
}

.info-panel__details {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.75rem 0.25rem 0.25rem;
}

.info-panel__details h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.info-panel__location,
.info-panel__address {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}

.info-panel__status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.info-panel__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    font-size: 13px;
    color: var(--text-muted);
}

.info-panel__metrics strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 16px;
    color: var(--text-main);
}

.info-panel__coordinates {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 13px;
    color: #475569;
}

.info-panel__link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    padding: 0.7rem;
    border-radius: var(--radius-md);
    background-color: var(--brand-color);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.info-panel__link:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chip--free {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.chip--caution {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.45);
}

.chip--danger {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.chip--no-data {
    background: rgba(148, 163, 184, 0.18);
    color: #475569;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.map-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: rgba(255, 255, 255, 0.95);
    border: 3px solid currentColor;
    color: var(--normal-color);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.map-marker--free {
    color: var(--normal-color);
}

.map-marker--caution {
    color: var(--warning-color);
}

.map-marker--danger {
    color: var(--danger-color);
}

.map-marker--no-data {
    color: #94a3b8;
}

.map-marker__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: currentColor;
}

.map-marker__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0.15;
    transform: scale(0.85);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.map-marker:hover,
.map-marker.is-active {
    transform: scale(1.12);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.24);
}

.map-marker.is-active .map-marker__pulse {
    opacity: 0.3;
    transform: scale(1.2);
}

.map-user-marker {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.18);
    border: 3px solid #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.map-user-marker__pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.16);
    animation: user-marker-pulse 1.8s infinite;
}

.map-user-marker__dot {
.map-user-marker__dot {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

@keyframes user-marker-pulse {
    0% {
        transform: scale(0.6);
        opacity: 0.7;
    }
    70% {
        transform: scale(1.15);
        opacity: 0;
    }
    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

@keyframes locate-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 1024px) {
    .map-grid {
        grid-template-columns: 1fr;
    }

    .map-container {
        height: 55vh;
    }

    .map-sidebar {
        position: static;
    }
}

@media (max-width: 640px) {
    .filter-buttons {
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1 1 calc(50% - 0.5rem);
    }
}
