/**
 * Yoosee Cloud NVR - CSS Styles
 * Tema escuro profissional para vigilância
 */

/* ========== Variáveis ========== */
:root {
    --nvr-dark: #0a0a0f;
    --nvr-darker: #050508;
    --nvr-card: #12121a;
    --nvr-blue: #3b82f6;
    --nvr-cyan: #06b6d4;
    --nvr-green: #10b981;
    --nvr-red: #ef4444;
    --nvr-orange: #f97316;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 100%);
    color: white;
    min-height: 100vh;
}

/* ========== Login Page ========== */
.gradient-bg {
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass {
    background: rgba(255, 255, 255, 0.03);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 28rem;
}

.glow {
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.15);
}

/* ========== Forms ========== */
input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--nvr-blue);
    box-shadow: 0 0 0 1px var(--nvr-blue);
}

input::placeholder,
select option:first-child {
    color: #6b7280;
}

/* Fix dropdown styling - Tailwind approach */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 2.5rem;
}

select:focus {
    outline: none;
    border-color: var(--nvr-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Dark background for dropdown options */
select option {
    background-color: #1a1a2e;
    color: white;
}

/* Force dark mode on inputs */
input[type="date"],
input[type="number"],
input[type="text"],
input[type="password"] {
    color-scheme: dark;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--nvr-blue), var(--nvr-cyan));
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--nvr-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========== Cards ========== */
.card {
    background: rgba(255, 255, 255, 0.02);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card-glow:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

/* ========== Dashboard Layout ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 16rem;
    background: var(--nvr-darker);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: 16rem;
    padding: 2rem;
    min-height: 100vh;
}

/* ========== Navigation ========== */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #9ca3af;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(6, 182, 212, 0.08));
    color: white;
    border-left: 2px solid var(--nvr-blue);
}

/* ========== Custom Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ========== Section Header ========== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    width: auto;
    min-width: 10rem;
}

/* ========== Card Header ========== */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-title-icon svg {
    width: 1rem;
    height: 1rem;
}

.card-title-icon-red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--nvr-red);
}

.card-title-icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--nvr-blue);
}

/* ========== Stats Cards ========== */
.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 1rem 1rem 0 0;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.stat-card-blue::before { background: linear-gradient(90deg, var(--nvr-blue), var(--nvr-cyan)); }
.stat-card-red::before { background: linear-gradient(90deg, var(--nvr-red), #f97316); }
.stat-card-green::before { background: linear-gradient(90deg, var(--nvr-green), #34d399); }
.stat-card-orange::before { background: linear-gradient(90deg, var(--nvr-orange), #fbbf24); }

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.stat-card-blue .stat-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--nvr-blue);
}

.stat-card-red .stat-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--nvr-red);
}

.stat-card-green .stat-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--nvr-green);
}

.stat-card-orange .stat-icon {
    background: rgba(249, 115, 22, 0.15);
    color: var(--nvr-orange);
}

.stat-content {
    min-width: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: white;
}

.stat-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

.stat-blue { color: var(--nvr-blue); }
.stat-green { color: var(--nvr-green); }
.stat-orange { color: var(--nvr-orange); }
.stat-red { color: var(--nvr-red); }

/* ========== Recordings Grid ========== */
.recordings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

/* ========== Recording Cards ========== */
.recording-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
}

.recording-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.recording-thumbnail {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #0d0d15, #151520);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.recording-thumbnail .no-thumb-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.recording-card:hover .no-thumb-icon {
    color: rgba(59, 130, 246, 0.5);
    transform: scale(1.15);
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.play-overlay svg {
    width: 2.5rem;
    height: 2.5rem;
    color: white;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.recording-card:hover .play-overlay {
    opacity: 1;
}

.thumb-badges {
    position: absolute;
    bottom: 0.4rem;
    right: 0.4rem;
    display: flex;
    gap: 0.3rem;
}

.thumb-badge-size {
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.thumb-badges-top {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    display: flex;
    gap: 0.3rem;
}

.thumb-badge-live {
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.thumb-badge-bitrate {
    background: rgba(59, 130, 246, 0.85);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.thumb-badge-duration {
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.recording-info {
    padding: 0.6rem 0.75rem 0.5rem;
}

.rec-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.rec-info-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.rec-detail {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    color: #9ca3af;
}

.rec-detail svg {
    color: #6b7280;
    flex-shrink: 0;
}

.rec-info-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-size: 0.65rem;
    color: #6b7280;
}

.rec-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #4b5563;
}

.rec-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.rec-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--nvr-red);
}

/* ========== Stream Cards (Active Recordings) ========== */
.stream-card {
    background: rgba(239, 68, 68, 0.04);
    border: 1px solid rgba(239, 68, 68, 0.12);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    transition: all 0.2s ease;
}

.stream-card:hover {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

.stream-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stream-camera-name {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.rec-dot-live {
    width: 8px;
    height: 8px;
    background: var(--nvr-red);
    border-radius: 50%;
    animation: pulse-rec 1.5s infinite;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.stream-stats {
    display: flex;
    gap: 1.25rem;
}

.stream-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

.stream-stat svg {
    color: #6b7280;
}

/* ========== Recording Badge ========== */
.rec-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--nvr-red);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    letter-spacing: 0.05em;
}

.rec-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--nvr-red);
    border-radius: 50%;
    animation: pulse-rec 1.5s infinite;
}

@keyframes pulse-rec {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ========== Status Pills ========== */
.status-pill {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    letter-spacing: 0.03em;
}

.camera-status-rec {
    background: rgba(239, 68, 68, 0.1);
    color: var(--nvr-red);
}

.camera-status-online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--nvr-green);
}

.camera-status-offline {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* ========== Empty State ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
}

.empty-icon-pulse {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

/* ========== Video Player (YouTube Premium Style) ========== */
.vp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vp-wrapper {
    width: 100%;
    max-width: 72rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
}

.vp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.vp-topbar.visible {
    opacity: 1;
}

.vp-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.vp-date {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.1rem;
}

.vp-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.vp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.vp-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.vp-video-area {
    position: relative;
    flex: 1;
    background: black;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.vp-video-area video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Loading spinner */
.vp-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.vp-loading.hidden {
    display: none;
}

.vp-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ff0000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Big play button */
.vp-big-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    cursor: pointer;
}

.vp-big-play.hidden {
    display: none;
}

.vp-big-play svg {
    filter: drop-shadow(0 2px 12px rgba(0,0,0,0.5));
    transition: transform 0.15s ease;
}

.vp-big-play:hover svg {
    transform: scale(1.1);
}

/* Seek indicator */
.vp-seek-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    z-index: 6;
    pointer-events: none;
}

.vp-seek-indicator.hidden {
    display: none;
}

/* Controls */
.vp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 2.5rem 0.75rem 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.vp-controls.visible {
    opacity: 1;
}

/* Progress bar */
.vp-progress-wrap {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0.25rem;
}

.vp-progress-bar {
    position: relative;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    transition: height 0.15s ease;
}

.vp-progress-wrap:hover .vp-progress-bar {
    height: 5px;
}

.vp-buffer-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.vp-played-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #ff0000;
    border-radius: 2px;
    z-index: 1;
}

.vp-scrubber {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 12px;
    height: 12px;
    background: #ff0000;
    border-radius: 50%;
    transition: transform 0.15s ease;
    box-shadow: 0 0 4px rgba(255,0,0,0.5);
}

.vp-progress-wrap:hover .vp-scrubber {
    transform: translateY(-50%) scale(1);
}

/* Progress hover tooltip */
.vp-progress-hover {
    position: absolute;
    bottom: 22px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.vp-progress-hover.visible {
    opacity: 1;
}

/* Controls row */
.vp-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.vp-controls-left,
.vp-controls-right {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

/* Volume group */
.vp-volume-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.vp-volume-slider {
    width: 0;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.vp-volume-group:hover .vp-volume-slider {
    width: 60px;
    opacity: 1;
    margin-left: 0.25rem;
}

.vp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.vp-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Time display */
.vp-time {
    font-size: 0.8rem;
    color: white;
    font-weight: 400;
    margin-left: 0.5rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Speed select */
.vp-speed-select {
    background: transparent;
    color: white;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem;
    min-width: auto;
    width: auto;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
}

.vp-speed-select option {
    background: #1a1a2e;
    color: white;
}

/* Fullscreen adjustments */
.vp-video-area:fullscreen {
    border-radius: 0;
}

.vp-video-area:fullscreen video {
    width: 100vw;
    height: 100vh;
}

/* ========== Modal (generic, kept for other modals if needed) ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: var(--nvr-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    max-width: 56rem;
    width: 100%;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
}

.modal-close {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 0.5rem;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ========== Timeline ========== */
.tl-stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
}

.tl-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 0.15rem;
}

.tl-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.tl-stat-active {
    color: var(--nvr-red);
}

.tl-stat-label {
    font-size: 0.6rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tl-stat-divider {
    width: 1px;
    height: 2rem;
    background: rgba(255, 255, 255, 0.06);
    margin: 0 0.5rem;
}

.tl-hours-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: #6b7280;
    margin-bottom: 0.35rem;
    padding: 0 0.1rem;
}

.tl-hours-grid {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 3px;
}

.tl-hour {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    cursor: default;
    transition: all 0.2s ease;
    min-height: 2.5rem;
}

.tl-hour.has-data {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(59, 130, 246, 0.25);
    cursor: pointer;
}

.tl-hour.has-data:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(6, 182, 212, 0.25));
    transform: translateY(-1px);
}

.tl-hour-label {
    font-size: 0.6rem;
    color: #4b5563;
    font-weight: 500;
}

.tl-hour.has-data .tl-hour-label {
    color: var(--nvr-blue);
    font-weight: 600;
}

.tl-hour-count {
    font-size: 0.55rem;
    color: var(--nvr-cyan);
    font-weight: 600;
    margin-top: 0.1rem;
}

.tl-empty-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: #4b5563;
}

.tl-empty-day p {
    font-size: 0.8rem;
}

.tl-segment {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.4rem;
}

.tl-segment:hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateX(3px);
}

.tl-segment-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4.5rem;
    flex-shrink: 0;
}

.tl-segment-start {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
}

.tl-segment-separator {
    font-size: 0.55rem;
    color: #4b5563;
    line-height: 1;
}

.tl-segment-end {
    font-size: 0.7rem;
    color: #9ca3af;
}

.tl-segment-body {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.tl-segment-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    background: rgba(59, 130, 246, 0.12);
    color: var(--nvr-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tl-segment-icon.active {
    background: rgba(239, 68, 68, 0.15);
    color: var(--nvr-red);
    animation: pulse-rec 1.5s infinite;
}

.tl-segment-info {
    flex: 1;
    min-width: 0;
}

.tl-segment-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tl-segment-duration,
.tl-segment-size {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.tl-segment-duration svg,
.tl-segment-size svg {
    color: #6b7280;
    flex-shrink: 0;
}

.tl-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    letter-spacing: 0.04em;
}

.tl-badge-active {
    background: rgba(239, 68, 68, 0.12);
    color: var(--nvr-red);
    animation: pulse 2s infinite;
}

/* ========== Camera Cards ========== */
.camera-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.camera-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.camera-icon {
    width: 2.75rem;
    height: 2.75rem;
    background: linear-gradient(135deg, var(--nvr-blue), var(--nvr-cyan));
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-icon svg {
    width: 1.35rem;
    height: 1.35rem;
    color: white;
}

.camera-stats {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.625rem;
    overflow: hidden;
}

.camera-stat {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
}

.camera-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.camera-stat-label {
    font-size: 0.65rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.1rem;
}

.camera-stat-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0.5rem 0;
}

/* ========== Utilities ========== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* ========== Mobile Menu Button ========== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 60;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    background: var(--nvr-darker);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.mobile-menu-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ========== Responsive: Desktop Large ========== */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .recordings-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* ========== Responsive: Tablet (iPad Mini, Air, Surface Pro) ========== */
@media (max-width: 1024px) {
    .sidebar {
        width: 14rem;
    }
    .main-content {
        margin-left: 14rem;
        padding: 1.5rem;
    }
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== Responsive: Mobile/Small Tablet ========== */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 16rem;
        z-index: 50;
    }

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

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 3.5rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .recordings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-bar {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .filter-bar select,
    .filter-bar input {
        flex: 1;
        min-width: 0;
    }

    /* Health bar responsive */
    #health-bar {
        flex-wrap: wrap;
        gap: 0.35rem !important;
        padding: 0.4rem 0.75rem !important;
        font-size: 0.65rem !important;
    }

    /* Stats cards smaller */
    .stat-card {
        padding: 0.75rem;
        gap: 0.6rem;
    }
    .stat-icon {
        width: 2.25rem;
        height: 2.25rem;
    }
    .stat-icon svg {
        width: 1rem;
        height: 1rem;
    }
    .stat-value {
        font-size: 1.15rem;
    }
    .stat-label {
        font-size: 0.6rem;
    }

    /* Stream cards */
    .stream-card {
        padding: 0.75rem;
    }
    .stream-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .stream-stat {
        font-size: 0.7rem;
    }

    /* Player responsive */
    .vp-wrapper {
        max-width: 100%;
    }
    .vp-topbar {
        padding: 0.5rem 0.75rem;
    }
    .vp-title {
        font-size: 0.85rem;
    }
    .vp-controls {
        padding: 1.5rem 0.5rem 0.35rem;
    }
    .vp-btn {
        width: 2rem;
        height: 2rem;
    }
    .vp-btn svg {
        width: 16px;
        height: 16px;
    }
    .vp-time {
        font-size: 0.7rem;
        margin-left: 0.25rem;
    }
    .vp-video-area {
        border-radius: 0;
    }
    #vp-skip-back,
    #vp-skip-fwd {
        display: none;
    }
    .vp-volume-group {
        display: none;
    }

    /* Timeline responsive */
    .tl-hours-grid {
        grid-template-columns: repeat(12, 1fr);
    }
    .tl-hour-label {
        font-size: 0.5rem;
    }
    .tl-stats-bar {
        padding: 0.5rem 0.75rem;
    }
    .tl-stat-value {
        font-size: 0.9rem;
    }
    .tl-segment {
        gap: 0.5rem;
        padding: 0.5rem 0.6rem;
    }
    .tl-segment-time {
        min-width: 3.5rem;
    }
    .tl-segment-start {
        font-size: 0.75rem;
    }
    .tl-segment-end {
        font-size: 0.6rem;
    }

    /* Card padding */
    .card {
        padding: 1rem;
    }

    /* Camera cards */
    .camera-card {
        padding: 1rem;
    }

    /* Modal mobile */
    .modal-overlay {
        padding: 0.5rem;
        align-items: flex-end;
    }
    .modal-content {
        max-width: 100%;
        border-radius: 1rem 1rem 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-header {
        padding: 1rem;
    }
    .modal-body {
        padding: 0.75rem;
    }

    /* Timeline responsive */
    .timeline-hours {
        grid-template-columns: repeat(12, 1fr);
        height: auto;
    }

    /* Section title smaller */
    h2.text-2xl {
        font-size: 1.25rem !important;
    }
}

/* ========== Responsive: Small Phones (iPhone SE, Galaxy S8+, Z Fold) ========== */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
        padding-top: 3.5rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .recordings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    /* Health bar stacked */
    #health-bar {
        width: 100%;
        justify-content: center;
    }
    /* Hide separator on very small screens */
    #health-bar > span.text-gray-600 {
        display: none;
    }

    .stat-card {
        padding: 0.625rem;
        gap: 0.5rem;
    }
    .stat-icon {
        width: 2rem;
        height: 2rem;
    }
    .stat-value {
        font-size: 1rem;
    }

    .stream-header {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .stream-camera-name h4 {
        font-size: 0.8rem;
    }

    /* Recording card text smaller */
    .recording-info {
        padding: 0.5rem;
    }
    .recording-info h4 {
        font-size: 0.75rem !important;
    }
    .rec-info-meta {
        font-size: 0.6rem;
    }
    .thumb-badge-size {
        font-size: 0.55rem;
    }

    /* Camera card compact */
    .camera-card {
        padding: 0.75rem;
    }
    .camera-stat-value {
        font-size: 1rem;
    }
    .camera-stat-label {
        font-size: 0.55rem;
    }

    /* Filter bar stack */
    .filter-bar {
        flex-direction: column;
    }
    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }

    /* Timeline 8 columns on tiny screens */
    .timeline-hours {
        grid-template-columns: repeat(8, 1fr);
    }

    /* Section titles */
    h2.text-2xl {
        font-size: 1.1rem !important;
    }
    .text-lg {
        font-size: 0.95rem !important;
    }
}

/* ========== Responsive: Very small (Galaxy Z Fold closed ~344px) ========== */
@media (max-width: 360px) {
    .recordings-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 0.9rem;
    }

    .stream-stats {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* ========== Storage Bar ========== */
.storage-bar-card {
    padding: 1rem 1.25rem;
}
.storage-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.storage-bar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.storage-bar-value {
    font-size: 0.75rem;
    color: #6b7280;
}
.storage-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}
.storage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
}
.storage-bar-fill.warning {
    background: linear-gradient(90deg, #f97316, #ef4444);
}

/* ========== Search Bar ========== */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 20rem;
}
.search-bar input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.625rem;
    color: white;
    font-size: 0.8rem;
}
.search-bar input:focus {
    border-color: var(--nvr-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.search-bar svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: #4b5563;
    pointer-events: none;
}

/* ========== Download Button ========== */
.rec-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.rec-download-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--nvr-blue);
}

/* ========== Active Badge Pulse ========== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== Alertas ========== */
.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--nvr-red);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--nvr-green);
}

/* ========== Loading ========== */
.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--nvr-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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