/* style.css â€” BATCAVE SURVEILLANCE ARCHIVE */

/* =========================================================
   FONTS & CSS VARS
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Share+Tech+Mono&family=Exo+2:wght@300;400;600&display=swap');

:root {
    --bg-deep:       #080c0f;
    --bg-panel:      #0d1117;
    --bg-card:       #0f1419;
    --bg-hover:      #161d26;
    --border:        #1e2d3d;
    --border-bright: #2a3f54;
    --accent:        #00c2ff;
    --accent-dim:    rgba(0, 194, 255, 0.15);
    --accent-glow:   rgba(0, 194, 255, 0.4);
    --yellow:        #ffd700;
    --yellow-dim:    rgba(255, 215, 0, 0.12);
    --green:         #00ff88;
    --green-dim:     rgba(0, 255, 136, 0.15);
    --red:           #ff3b3b;
    --text-primary:  #d4e4f0;
    --text-dim:      #5a7a8a;
    --text-label:    #3a6070;
    --font-head:     'Rajdhani', sans-serif;
    --font-mono:     'Share Tech Mono', monospace;
    --font-body:     'Exo 2', sans-serif;
    --header-h:      90px;
    --radius:        4px;
}

/* =========================================================
   RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scanline overlay removed â€” caused paint thrashing with multiple videos */
.scanline-overlay { display: none; }

/* =========================================================
   HEADER
   ========================================================= */
.header {
    position: sticky;
    top: 0;
    z-index: 500;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 10px 20px 10px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-bright);
    box-shadow: 0 0 40px rgba(0, 194, 255, 0.06), 0 4px 20px rgba(0,0,0,0.6);
    min-height: var(--header-h);
    flex-wrap: wrap;
}

/* Top accent line */
.header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--yellow), var(--accent), transparent);
    opacity: 0.7;
}

/* ---- Header Left ---- */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(255,215,0,0.5));
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.brand-sub {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-top: 2px;
}

/* Date selector */
.date-selector-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selector-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-label);
    letter-spacing: 2px;
}

select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-bright);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%235a7a8a'%3E%3Cpath d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

select:hover, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

select option {
    background: var(--bg-card);
}

/* Status pills */
.status-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    padding: 4px 8px;
    border-radius: 2px;
    border: 1px solid;
}

.pill-green {
    color: var(--green);
    border-color: rgba(0,255,136,0.3);
    background: var(--green-dim);
}

.pill-blue {
    color: var(--accent);
    border-color: rgba(0,194,255,0.3);
    background: var(--accent-dim);
}

.pill-dim {
    color: var(--text-dim);
    border-color: var(--border);
    background: transparent;
}

.pill-shame {
    color: #ff3b3b;
    border-color: rgba(255, 59, 59, 0.45);
    background: rgba(255, 59, 59, 0.08);
    text-decoration: none;
    cursor: pointer;
    animation: shamePulse 2.5s ease-in-out infinite;
    font-weight: 600;
    letter-spacing: 1.5px;
}

.pill-shame:hover {
    background: rgba(255, 59, 59, 0.2);
    border-color: #ff3b3b;
    box-shadow: 0 0 12px rgba(255, 59, 59, 0.35);
}

@keyframes shamePulse {
    0%, 100% { box-shadow: none; opacity: 1; }
    50%       { box-shadow: 0 0 10px rgba(255, 59, 59, 0.5); opacity: 0.85; }
}

/* ---- Header Right ---- */
.header-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.master-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.controls-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-label);
    letter-spacing: 2px;
    text-align: right;
}

.controls-row {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ctrl-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    color: var(--text-dim);
    width: 52px;
    height: 46px;
    cursor: pointer;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.5px;
    transition: all 0.15s;
    padding: 4px;
}

.ctrl-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.ctrl-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px var(--accent-dim);
    transform: translateY(-1px);
}

.ctrl-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 4px var(--accent-glow);
}

.ctrl-play {
    background: rgba(0, 194, 255, 0.08);
    border-color: var(--accent);
    color: var(--accent);
    width: 60px;
}

.ctrl-play:hover {
    background: rgba(0, 194, 255, 0.2);
    box-shadow: 0 0 15px var(--accent-glow);
}

.ctrl-sync {
    background: rgba(255, 215, 0, 0.05);
    border-color: rgba(255,215,0,0.4);
    color: var(--yellow);
}

.ctrl-sync:hover {
    background: rgba(255,215,0,0.15);
    border-color: var(--yellow);
    color: var(--yellow);
    box-shadow: 0 0 10px rgba(255,215,0,0.3);
}

.ctrl-layout {
    border-color: rgba(120,120,180,0.4);
    color: #a0a8d0;
}

.ctrl-layout:hover {
    border-color: #a0a8d0;
    color: #c0c8f0;
    box-shadow: 0 0 10px rgba(160,168,208,0.2);
}

/* Global scrubber */
.global-scrub-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.scrub-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.time-display {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    min-width: 35px;
    text-align: center;
}

.global-scrubber {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-bright);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}

.global-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
}

.global-scrubber::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    border: none;
}

/* =========================================================
   VIDEO GRID
   ========================================================= */
.grid-container {
    display: grid;
    /* Each column is at least 480px wide; naturally drops to 1 col on narrow windows */
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 8px;
    padding: 12px;
    max-width: 2000px;
    margin: 0 auto;
}

/* Manual layout overrides still work */
.grid-container.layout-1col { grid-template-columns: 1fr; }
.grid-container.layout-3col { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-container.layout-4col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* =========================================================
   VIDEO BOX
   ========================================================= */
.video-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: boxFadeIn 0.4s ease both;
}

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

.video-box:hover {
    border-color: var(--border-bright);
    box-shadow: 0 0 20px rgba(0, 194, 255, 0.05);
}

/* Corner brackets on hover */
.video-box::before,
.video-box::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    pointer-events: none;
}

.video-box::before {
    top: -1px; left: -1px;
    border-top: 2px solid var(--accent);
    border-left: 2px solid var(--accent);
}

.video-box::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
}

.video-box:hover::before,
.video-box:hover::after {
    opacity: 1;
}

/* Meta bar */
.video-meta {
    background: rgba(0,0,0,0.6);
    padding: 7px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cam-info {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cam-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.cam-label {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: 1.5px;
}

.cam-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.action-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.download-btn:hover {
    background: rgba(0,255,136,0.1);
    border-color: var(--green);
    color: var(--green);
}

/* Video wrapper */
.video-wrap {
    position: relative;
    width: 100%;
    background: #000;
}

video {
    width: 100%;
    height: auto;
    display: block;
}

/* Overlay info (cam number + timestamp) */
.video-overlay-info {
    position: absolute;
    bottom: 40px; /* above native controls */
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-box:hover .video-overlay-info {
    opacity: 1;
}

.overlay-cam {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 2px;
    letter-spacing: 1px;
}

.overlay-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 2px;
}

/* =========================================================
   NO FOOTAGE
   ========================================================= */
.no-footage {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    letter-spacing: 2px;
}

.no-footage-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no-footage p {
    font-size: 13px;
    margin-bottom: 10px;
}

.no-footage-sub {
    font-size: 11px;
    color: var(--text-label);
}

.no-footage code {
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 6px;
    border-radius: 2px;
}

/* =========================================================
   FULLSCREEN MODAL
   ========================================================= */
.fs-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.95);
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fs-modal-inner {
    width: 100%;
    max-width: 1400px;
    border: 1px solid var(--border-bright);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 0 60px rgba(0,194,255,0.1);
    animation: modalSlideIn 0.25s ease;
}

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

.fs-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.fs-modal-title {
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--accent);
}

.fs-close-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 12px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 14px;
    border-radius: var(--radius);
    transition: all 0.15s;
}

.fs-close-btn:hover {
    background: rgba(255,59,59,0.15);
    border-color: var(--red);
    color: var(--red);
}

.fs-video {
    width: 100%;
    max-height: calc(100vh - 120px);
    display: block;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
    .grid-container.layout-3col { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
    .grid-container.layout-4col { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
}

@media (max-width: 768px) {
    :root { --header-h: auto; }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 10px 14px;
    }

    .header-left, .header-right {
        width: 100%;
        align-items: flex-start;
    }

    .master-controls { align-items: flex-start; }
    .controls-row { justify-content: flex-start; }

    /* Force 1 col on mobile regardless of layout setting */
    .grid-container,
    .grid-container.layout-1col,
    .grid-container.layout-3col,
    .grid-container.layout-4col {
        grid-template-columns: 1fr !important;
        gap: 6px;
        padding: 6px;
    }

    .ctrl-btn { width: 48px; height: 44px; }
    .brand { font-size: 18px; }
    .status-pills { gap: 5px; }
}

@media (max-width: 420px) {
    .status-pills .pill-dim { display: none; }
    .cam-actions .action-btn:nth-child(2) { display: none; }
}
