* { box-sizing: border-box; }
body {
    font-family: 'Hind Siliguri', 'Segoe UI', Arial, sans-serif;
    background: radial-gradient(circle at top left, #1e2435, #0b0d13 70%);
    color: #eee;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}
a { color: #60a5fa; }

/* ---------- Gate pages (visitor + admin login + install) ---------- */
.gate-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.gate-box {
    background: linear-gradient(160deg, #1b1f2a, #14171f);
    padding: 36px 32px;
    border-radius: 18px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.06);
}
.lock-icon { font-size: 36px; margin-bottom: 4px; }
.gate-box h1 { font-size: 22px; margin: 6px 0 10px; }
.gate-box .subtitle { font-size: 14px; color: #9aa3b2; line-height: 1.5; margin-bottom: 8px; }
.gate-box label { display: block; text-align: left; font-size: 13px; color: #9aa3b2; margin: 14px 0 6px; }
.gate-box input {
    width: 100%;
    padding: 13px 14px;
    margin: 0;
    border-radius: 10px;
    border: 1px solid #2a2f3b;
    background: #0e1117;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s;
}
.gate-box input:focus { border-color: #3b82f6; }
.gate-box button {
    width: 100%;
    padding: 13px;
    margin-top: 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
}
.gate-box button:hover { box-shadow: 0 6px 18px rgba(59,130,246,0.4); transform: translateY(-1px); }
.error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: #f87171; padding: 10px; border-radius: 8px; margin-top: 14px; font-size: 14px; }
.btn-link { display: inline-block; margin-top: 16px; color: #60a5fa; text-decoration: none; font-weight: 600; }

/* ---------- Recorder page ---------- */
.recorder-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}
.recorder-page h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.notice {
    font-size: 14px;
    color: #9aa3b2;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 16px;
}
#preview {
    width: 80%;
    border-radius: 16px;
    background: #000;
    margin-bottom: 14px;
    margin-left: 9%;
    border: 1px green solid;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
h2{
    text-align: center;
}
.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.controls button {
    flex: 1;
    min-width: 110px;
    padding: 13px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}
.controls button:hover:not(:disabled) { transform: translateY(-1px); }
#switchCameraBtn { background: #2a2f3b; color: #fff; }
#startBtn { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
#stopBtn { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.controls button:disabled { opacity: 0.4; cursor: not-allowed; }

.status {
    text-align: center;
    margin-bottom: 14px;
    color: #cbd5e1;
    font-size: 14px;
}
.progress-wrap {
    background: #151823;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.06);
}
.progress-bar {
    width: 100%;
    height: 10px;
    background: #2a2f3b;
    border-radius: 6px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.2s;
}
.progress-fill.indeterminate {
    background: repeating-linear-gradient(45deg, #3b82f6, #3b82f6 10px, #1d4ed8 10px, #1d4ed8 20px);
    animation: slide 1s linear infinite;
}
@keyframes slide { from { background-position: 0 0; } to { background-position: 40px 0; } }
.progress-text { text-align: center; margin-top: 10px; font-size: 13px; color: #cbd5e1; }

/* ---------- Admin area ---------- */
.admin-page { padding: 24px; }
.admin-wrap { max-width: 1100px; margin: 0 auto; }
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
.admin-topbar h1 { margin: 0; font-size: 22px; }
.admin-topbar nav a {
    margin-left: 14px;
    text-decoration: none;
    color: #cbd5e1;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 8px;
    background: #1b1f2a;
    transition: background 0.15s;
}
.admin-topbar nav a:hover { background: #2a2f3b; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.stat-card {
    background: linear-gradient(160deg, #1b1f2a, #14171f);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 16px;
}
.stat-card .num { font-size: 24px; font-weight: 700; color: #60a5fa; }
.stat-card .label { font-size: 13px; color: #9aa3b2; margin-top: 4px; }

.table-wrap {
    background: #12151e;
    border-radius: 14px;
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.06);
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #1f232e; text-align: left; font-size: 13px; white-space: nowrap; }
th { color: #9aa3b2; font-weight: 600; background: #161a24; }
tr:hover td { background: #161a24; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: #000; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.completed { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge.recording { background: rgba(234,179,8,0.15); color: #facc15; }
.badge.finalizing { background: rgba(59,130,246,0.15); color: #60a5fa; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.flash.error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: #f87171; }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.card {
    background: linear-gradient(160deg, #1b1f2a, #14171f);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 20px;
}
.card h2 { font-size: 16px; margin: 0 0 14px; }
.card label { display: block; font-size: 13px; color: #9aa3b2; margin: 10px 0 6px; }
.card input {
    width: 100%;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid #2a2f3b;
    background: #0e1117;
    color: #fff;
    font-size: 14px;
}
.card button {
    margin-top: 14px;
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.view-page { max-width: 700px; margin: 0 auto; padding: 24px 16px; }
.view-page video { width: 100%; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.view-page .photo-box img { width: 100%; max-width: 280px; border-radius: 12px; margin-bottom: 16px; border: 1px solid rgba(255,255,255,0.08); }
.view-page .meta { font-size: 14px; color: #9aa3b2; line-height: 1.6; margin: 14px 0; }
.view-page .back-link { display: inline-block; margin-bottom: 16px; text-decoration: none; color: #60a5fa; font-size: 14px; }
