/* ─────────────────────────────────────────────────────────────────────
 *  viewer.css — Dark kiosk theme for the viewer dashboard
 * ───────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:           #0a0a14;
    --surface:      #14142a;
    --surface-2:    #1c1c38;
    --border:       #2a2a4a;
    --text:         #e0e0f0;
    --text-dim:     #8888aa;
    --accent:       #ffb900;
    --accent-dim:   #b88400;
    --red:          #ff3333;
    --green:        #00cc66;
    --blue:         #3388ff;
    --radius:       8px;
    --header-h:     56px;
    --status-h:     32px;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Screens ──────────────────────────────────────────────────────── */
.screen {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    transition: opacity 0.3s;
}
.screen.hidden { display: none; }

/* centre login screen */
#login-screen {
    align-items: center; justify-content: center;
}

/* ── Login ────────────────────────────────────────────────────────── */
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
}
.lock-icon { font-size: 48px; margin-bottom: 12px; }
.login-box h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; color: var(--accent); }
.subtitle { color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }

input[type="password"] {
    display: block; width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px;
    text-align: center;
    letter-spacing: 3px;
    margin-bottom: 16px;
    outline: none;
}
input:focus { border-color: var(--accent); }

.btn-primary {
    display: block; width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #000;
    border: none; border-radius: 6px;
    font-size: 16px; font-weight: 700;
    cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dim); }

.error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ── Header ───────────────────────────────────────────────────────── */
#header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
}
.header-left {
    display: flex; align-items: center; gap: 12px;
}
.header-title {
    font-size: 18px; font-weight: 700; color: var(--accent);
    white-space: nowrap;
}
.header-badge {
    background: var(--accent);
    color: #000;
    font-size: 12px; font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 28px;
    text-align: center;
}
.header-filters {
    display: flex; align-items: center; gap: 8px;
}
.header-filters select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    max-width: 160px;
}
.header-filters select:focus { border-color: var(--accent); }

.icon-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Grid container ───────────────────────────────────────────────── */
#grid-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    position: relative;
}

#grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

/* ── Capture tile ─────────────────────────────────────────────────── */
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    animation: fadeIn 0.3s ease;
}
.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    border-color: var(--accent);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.tile-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #000;
}

.tile-info {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.tile-cam {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 700;
    font-size: 11px;
    color: var(--accent);
    white-space: nowrap;
}
.tile-person {
    background: rgba(0, 200, 80, 0.15);
    border: 1px solid rgba(0, 200, 80, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 700;
    font-size: 11px;
    color: var(--green);
    white-space: nowrap;
}
.tile-time {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    white-space: nowrap;
}

/* ── Empty state ──────────────────────────────────────────────────── */
#empty-state {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    padding: 40px;
}
#empty-state.hidden { display: none; }
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 22px; font-weight: 600; margin-bottom: 8px; color: var(--text-dim); }
.empty-sub   { font-size: 14px; color: var(--text-dim); }
.empty-sub strong { color: var(--accent); }

/* ── Status bar ───────────────────────────────────────────────────── */
#statusbar {
    height: var(--status-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 700px) {
    #grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 8px;
    }
    #header { padding: 0 8px; }
    .header-title { font-size: 14px; }
    .header-filters select { font-size: 11px; padding: 4px 6px; max-width: 110px; }
    .tile-info { padding: 6px 8px; gap: 4px; font-size: 11px; }
}

@media (max-width: 480px) {
    #grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .header-filters select:nth-child(n+3) { display: none; }
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
#grid-container::-webkit-scrollbar { width: 6px; }
#grid-container::-webkit-scrollbar-track { background: transparent; }
#grid-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
#grid-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}
