/* Webcams Page Styles */
.webcams-app-container {
    max-width: 1650px;
}

/* Controls Header */
.webcams-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
}

.controls-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input-group {
    position: relative;
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1rem;
    color: var(--text-dim);
    pointer-events: none;
}

.search-input-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.75rem 2.5rem 0.75rem 2.6rem;
    color: #ffffff;
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    background: rgba(15, 23, 42, 0.9);
}

.btn-clear-search {
    position: absolute;
    right: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-clear-search:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.controls-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.filter-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Main Layout (Sidebar + Map) */
.webcams-main-layout {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    min-height: 720px;
}

/* Left Sidebar */
.webcams-sidebar {
    width: 380px;
    flex-shrink: 0;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.webcam-cards-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 680px;
}

/* Custom Scrollbar */
.webcam-cards-list::-webkit-scrollbar {
    width: 6px;
}

.webcam-cards-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.webcam-cards-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.webcam-cards-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Webcam List Card */
.webcam-card-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.webcam-card-item:hover, .webcam-card-item.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateX(3px);
}

.card-thumb-wrapper {
    width: 84px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
    position: relative;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.webcam-card-item:hover .card-thumb-wrapper img {
    transform: scale(1.08);
}

.card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

.card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.cam-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
}

.badge-alt {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-coords {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    font-family: monospace;
}

/* Map Wrapper */
.webcams-map-wrapper {
    flex: 1;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    min-height: 720px;
    background: #0b0f19;
}

.webcam-map {
    width: 100%;
    height: 100%;
    min-height: 720px;
}

.map-floating-hint {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.825rem;
    color: #e2e8f0;
    pointer-events: none;
    z-index: 999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

/* Custom Leaflet Marker Styling */
.custom-webcam-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7 0%, #1e40af 100%);
    border: 2.5px solid #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marker-cam-svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.marker-pin:hover {
    transform: scale(1.18);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.8);
    z-index: 1000;
}

.marker-live-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: marker-pulse 1.8s infinite;
}

@keyframes marker-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Leaflet Custom Tooltip */
.leaflet-tooltip.custom-cam-tooltip {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #ffffff;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.leaflet-tooltip-left:before, .leaflet-tooltip-right:before,
.leaflet-tooltip-top:before, .leaflet-tooltip-bottom:before {
    border-color: transparent !important;
}

/* Modal Styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: modal-fade-in 0.25s ease forwards;
}

.modal-backdrop.open {
    display: flex;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    max-width: 980px;
    width: 100%;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    animation: modal-slide-up 0.25s ease forwards;
}

@keyframes modal-slide-up {
    from { transform: translateY(20px) scale(0.97); }
    to { transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(30, 41, 59, 0.5);
}

.modal-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #34d399;
}

.modal-title-group h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.modal-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.btn-close-modal {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-close-modal:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ffffff;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.big-image-container {
    width: 100%;
    min-height: 360px;
    max-height: 56vh;
    background: #020617;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.big-image-container img {
    max-width: 100%;
    max-height: 56vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.image-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(2, 6, 23, 0.85);
    color: var(--text-muted);
    font-size: 0.9rem;
    z-index: 5;
    transition: opacity 0.2s ease;
}

.image-timestamp-badge {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    font-size: 0.75rem;
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    pointer-events: none;
}

.modal-cam-desc {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Modal Footer */
.modal-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.modal-nav-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-external-large {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    border: 1px solid rgba(96, 165, 250, 0.4);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
    text-decoration: none;
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-external-large:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
    transform: translateY(-1px);
}

.ext-tag {
    font-size: 0.75rem;
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.18);
    padding: 0.2rem 0.45rem;
    border-radius: 5px;
    font-weight: 700;
}

/* Loading & Empty States */
.loading-placeholder, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    gap: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 900px) {
    .webcams-main-layout {
        flex-direction: column;
    }
    .webcams-sidebar {
        width: 100%;
        max-height: 360px;
    }
    .webcam-cards-list {
        max-height: 280px;
    }
    .webcams-map-wrapper, .webcam-map {
        min-height: 520px;
    }
}

@media (max-width: 640px) {
    .controls-top-row {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-card {
        max-height: 98vh;
        border-radius: 14px;
    }
    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-nav-btns {
        justify-content: space-between;
    }
    .btn-external-large {
        justify-content: center;
    }
}
