/* ============================================================
   app.css — SDO Nueva Ecija Queue System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
    --primary:      #1a56db;
    --primary-dark: #1245b4;
    --accent:       #0ea5e9;
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;
    --bg-dark:      #0a1628;
    --bg-card:      #ffffff;
    --sidebar-w:    240px;
    --radius:       14px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: #f0f4f9;
    min-height: 100vh;
    color: #1e293b;
}

/* ---- Navbar ---- */
.app-navbar {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0f2346 100%);
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    padding: 0.65rem 1.5rem;
}
.app-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1rem;
    color: #fff !important;
    letter-spacing: -0.3px;
}
.app-navbar .navbar-brand span { color: var(--accent); }
.app-navbar .nav-link {
    color: rgba(255,255,255,0.72) !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    padding: 0.4rem 0.75rem !important;
    transition: background 0.15s, color 0.15s;
}
.app-navbar .nav-link:hover { color: #fff !important; background: rgba(255,255,255,0.1); }

/* Account menu trigger */
.user-menu-trigger {
    color: rgba(255,255,255,0.85) !important;
    text-decoration: none;
    padding: 0.35rem 0.75rem !important;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.18);
    transition: background 0.15s, border-color 0.15s;
}
.user-menu-trigger:hover {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.35) !important;
}
.user-menu-trigger::after { border-color: rgba(255,255,255,0.6); }
.user-avatar-bubble {
    font-size: 1.2rem;
    color: var(--accent);
    line-height: 1;
}

/* Dropdown menu polish */
.dropdown-menu {
    border-radius: 12px !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15) !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    padding: 0.25rem 0;
    font-size: 0.875rem;
}
.dropdown-item {
    border-radius: 6px;
    margin: 0 0.25rem;
    padding: 0.5rem 0.75rem !important;
    width: calc(100% - 0.5rem);
    transition: background 0.1s;
}
.dropdown-item:hover { background: #f0f4f9; }
.dropdown-item.text-danger:hover { background: #fef2f2; }

/* ---- Auth pages ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0f2346 60%, #1a3a6b 100%);
    padding: 2rem 1rem;
}
.auth-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}
.auth-logo {
    width: 100px; height: 100px;
    background: transparent;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
}
.auth-card h4 { font-weight: 800; color: var(--bg-dark); }
.auth-card .text-muted { font-size: 0.875rem; }
.form-control, .form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 10px;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* ---- Main layout ---- */
.main-content { padding: 2rem 1.5rem; max-width: 1200px; margin: 0 auto; }

/* ---- Domain cards ---- */
.domain-card {
    border-radius: var(--radius) !important;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}
.domain-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.12) !important; }
.domain-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, rgba(26,86,219,0.1), rgba(14,165,233,0.1));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}

/* ---- Queue status page ---- */
.queue-number-big {
    font-family: 'DM Mono', monospace;
    font-size: 5rem;
    font-weight: 500;
    color: var(--primary);
    line-height: 1;
}
.queue-stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.queue-stat-value { font-size: 2.5rem; font-weight: 800; color: var(--bg-dark); }
.queue-stat-label { font-size: 0.8rem; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Video room ---- */
.room-wrapper {
    background: #0a0f1e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

/* Default: two equal cam panels */
.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1;
    transition: grid-template-columns 0.35s ease;
}

/* Screen-share: 80% screen + 20% cam column */
.video-grid.screen-sharing {
    grid-template-columns: 4fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.video-grid.screen-sharing .video-screen   { grid-column:1; grid-row:1 / span 2; }
.video-grid.screen-sharing #local-container  { grid-column:2; grid-row:1; aspect-ratio:4/3; }
.video-grid.screen-sharing #remote-container { grid-column:2; grid-row:2; aspect-ratio:4/3; }
.video-grid.screen-sharing .video-container  { aspect-ratio:unset; min-height:100px; }

.video-container {
    position: relative;
    background: #111827;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    transition: all 0.35s ease;
}
.video-container video { width:100%; height:100%; object-fit:cover; }
.video-screen video    { object-fit:contain; background:#000; }

.video-label {
    position: absolute; bottom:10px; left:12px;
    background: rgba(0,0,0,0.6);
    color:#fff; font-size:0.75rem; font-weight:600;
    padding:3px 10px; border-radius:20px;
    backdrop-filter: blur(4px); z-index:2;
}
.screen-share-badge {
    position:absolute; top:10px; right:12px;
    background:rgba(22,163,74,0.85);
    color:#fff; font-size:0.7rem; font-weight:700;
    padding:3px 10px; border-radius:20px;
    z-index:2; text-transform:uppercase; letter-spacing:0.5px;
}

.room-controls {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.85rem 1.5rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
}

.btn-circle {
    border-radius: 50%; border: none;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, background 0.18s;
    cursor: pointer; flex-shrink: 0;
}
.btn-circle:hover  { transform: scale(1.1); }
.btn-circle:active { transform: scale(0.96); }

/* Camera — smallest 42px */
.btn-cam-ctrl {
    width:42px; height:42px; font-size:0.95rem;
    background:rgba(255,255,255,0.12);
    color:rgba(255,255,255,0.75);
    border:1.5px solid rgba(255,255,255,0.18);
}
.btn-cam-ctrl:hover { background:rgba(255,255,255,0.2); color:#fff; }

/* Mic — medium 50px */
.btn-mic-ctrl {
    width:50px; height:50px; font-size:1.05rem;
    background:rgba(255,255,255,0.16); color:#fff;
    border:1.5px solid rgba(255,255,255,0.25);
}
.btn-mic-ctrl:hover { background:rgba(255,255,255,0.25); }

.btn-ctrl-muted { background:rgba(220,38,38,0.75) !important; color:#fff !important; border-color:rgba(220,38,38,0.5) !important; }

/* Screen share — largest 66px, accent glow */
.btn-screen-ctrl {
    width:66px; height:66px; font-size:1.4rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color:#fff; border:none;
    box-shadow:0 4px 20px rgba(14,165,233,0.45);
}
.btn-screen-ctrl:hover { box-shadow:0 6px 28px rgba(14,165,233,0.65); color:#fff; }

.btn-screen-active {
    background:linear-gradient(135deg,#16a34a,#22c55e) !important;
    box-shadow:0 4px 20px rgba(22,163,74,0.5) !important;
    animation: pulse-screen 2s infinite;
}
@keyframes pulse-screen {
    0%,100% { box-shadow:0 4px 20px rgba(22,163,74,0.5); }
    50%      { box-shadow:0 4px 32px rgba(22,163,74,0.85); }
}

/* Hangup — 58px red */
.btn-hangup {
    width:58px; height:58px; font-size:1.2rem;
    background:#dc2626; color:#fff; border:none;
    box-shadow:0 3px 15px rgba(220,38,38,0.4);
}
.btn-hangup:hover { background:#b91c1c; color:#fff; }

.room-ctrl-label {
    font-size:0.7rem; font-weight:700; color:var(--accent);
    text-transform:uppercase; letter-spacing:0.5px;
    text-align:center; white-space:nowrap;
}
.room-ctrl-label-sm {
    font-size:0.65rem; font-weight:500;
    color:rgba(255,255,255,0.5);
    text-align:center; white-space:nowrap;
}

@media (max-width:576px) {
    .video-grid { grid-template-columns:1fr; }
    .video-grid.screen-sharing {
        grid-template-columns:1fr 1fr; grid-template-rows:auto auto;
    }
    .video-grid.screen-sharing .video-screen   { grid-column:1 / span 2; grid-row:1; }
    .video-grid.screen-sharing #local-container  { grid-column:1; grid-row:2; }
    .video-grid.screen-sharing #remote-container { grid-column:2; grid-row:2; }
    .video-grid.screen-sharing .video-container  { min-height:80px; }
}

/* ---- Validator panel ---- */
.validator-header {
    background: linear-gradient(135deg, var(--bg-dark), #1a3a6b);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.table { border-radius: var(--radius); overflow: hidden; }
.table thead th { background: var(--bg-dark); color: #fff; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; border: none; }
.table tbody tr:hover { background: rgba(26,86,219,0.04); }

/* ---- Admin panel ---- */
.admin-tabs .nav-link { font-weight: 600; border-radius: 10px 10px 0 0; }
.admin-tabs .nav-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-tabs .dropdown-menu { border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.12); border: 1px solid rgba(0,0,0,.06); padding: 6px; }
.admin-tabs .dropdown-item { border-radius: 8px; font-weight: 500; padding: 8px 12px; }
.admin-tabs .dropdown-item.active, .admin-tabs .dropdown-item:active { background: var(--primary); color: #fff; }
.admin-tabs .nav-item.dropdown:has(.dropdown-item.active) > .nav-link { background: var(--primary); color: #fff; }

/* ---- Toast container ---- */
#toast-container {
    position: fixed; top: 1.5rem; right: 1.5rem;
    z-index: 9999; min-width: 280px;
}

/* ---- Recovery banner (stuck in_progress session) ---- */
.recovery-banner {
    background: linear-gradient(135deg, #0f2346, #1a3a6b);
    border: 1.5px solid rgba(14,165,233,0.35);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    color: #fff;
}
.recovery-icon {
    width: 44px; height: 44px;
    background: rgba(14,165,233,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}

/* ---- Validator in-progress row highlight ---- */
.row-in-progress { background: rgba(22,163,74,0.06) !important; }
.row-in-progress:hover { background: rgba(22,163,74,0.1) !important; }

/* ---- Page heading ---- */
.page-heading { font-weight: 800; font-size: 1.5rem; color: var(--bg-dark); }
.page-subheading { color: #64748b; font-size: 0.9rem; }

/* ---- Navbar user menu ---- */
.btn-user-menu {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 0.35rem 1rem 0.35rem 0.6rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-user-menu:hover, .btn-user-menu:focus { background: rgba(255,255,255,0.22); color: #fff; }
.btn-user-menu::after { margin-left: 6px; opacity: 0.6; }
.user-avatar { font-size: 1.15rem; line-height: 1; }
.dropdown-menu { border-radius: 12px; min-width: 200px; }
.dropdown-item { font-size: 0.875rem; font-weight: 500; border-radius: 8px; margin: 2px 6px; width: auto; }
.dropdown-item:hover { background: #f0f4f9; }
.dropdown-item.text-danger:hover { background: #fff0f0; }

/* ---- Room control button sizing ---- */
/* Camera — smallest (40px) */
.btn-cam-ctrl {
    width: 40px !important;
    height: 40px !important;
    font-size: 0.9rem !important;
    opacity: 0.75;
}
.btn-cam-ctrl:hover { opacity: 1; }

/* Screen share — PRIORITY (66px, accent color) */
.btn-screen-ctrl {
    width: 66px !important;
    height: 66px !important;
    font-size: 1.4rem !important;
    background: linear-gradient(135deg, #0284c7, #0ea5e9) !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(14,165,233,0.4);
}
.btn-screen-ctrl:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 6px 20px rgba(14,165,233,0.5);
}
.btn-screen-active {
    background: linear-gradient(135deg, #16a34a, #22c55e) !important;
    box-shadow: 0 4px 16px rgba(22,163,74,0.4) !important;
    animation: pulse-screen 2s infinite;
}
@keyframes pulse-screen {
    0%, 100% { box-shadow: 0 4px 16px rgba(22,163,74,0.4); }
    50%       { box-shadow: 0 4px 24px rgba(22,163,74,0.7); }
}

/* Muted state */
.btn-muted { background: #dc2626 !important; color: #fff !important; }

/* In-progress row highlight */
.row-in-progress { background: rgba(22,163,74,0.06) !important; }
.row-in-progress td { border-left: 3px solid #16a34a; }
.row-in-progress td:not(:first-child) { border-left: none; }

/* Remark item */
.remark-item { border-left: 3px solid #d97706; }
.card { border-radius: var(--radius) !important; }
.badge { border-radius: 6px; font-weight: 600; }
.btn { font-weight: 600; }
.btn-sm { border-radius: 8px; }
.remark-panel textarea { border-radius: 10px; resize: none; }

/* ---- Call control button variants ---- */

/* Screen Share — PRIORITY: largest, accent blue, glow */
.btn-screen-ctrl {
    width: 62px !important;
    height: 62px !important;
    font-size: 1.25rem !important;
    background: linear-gradient(135deg, #1a56db, #0ea5e9) !important;
    color: #fff !important;
    box-shadow: 0 4px 18px rgba(26,86,219,0.45);
}
.btn-screen-ctrl:hover {
    box-shadow: 0 6px 24px rgba(26,86,219,0.6);
    transform: scale(1.08) !important;
}
.btn-screen-active {
    background: linear-gradient(135deg, #16a34a, #22c55e) !important;
    box-shadow: 0 4px 18px rgba(22,163,74,0.5) !important;
}

/* Camera — smallest, tertiary */
.btn-cam-ctrl {
    width: 42px !important;
    height: 42px !important;
    font-size: 0.9rem !important;
    opacity: 0.8;
}
.btn-cam-ctrl:hover { opacity: 1; }

/* Muted state */
.btn-muted {
    background: #dc2626 !important;
    color: #fff !important;
}

/* Screen share button label */
.room-ctrl-label {
    color: rgba(255,255,255,0.6);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* ---- Stuck session recovery banner ---- */
.stuck-banner {
    background: linear-gradient(135deg, #0f4c2a, #166534);
    color: #fff;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 20px rgba(22,163,74,0.25);
}
.stuck-banner-icon {
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
}
.btn-reenter {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 8px;
}
.btn-reenter:hover { background: #16a34a; color: #fff; }
.btn-requeue {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
}
.btn-requeue:hover { background: rgba(255,255,255,0.25); color: #fff; }
.btn-abandon {
    background: rgba(220,38,38,0.35);
    color: #fff;
    border: 1px solid rgba(220,38,38,0.5);
    border-radius: 8px;
}
.btn-abandon:hover { background: rgba(220,38,38,0.55); color: #fff; }

/* ---- Validator queue row highlight ---- */
.row-in-progress {
    background: rgba(22,163,74,0.06) !important;
    border-left: 3px solid #16a34a;
}

/* ---- User menu button ---- */
.btn-user-menu {
    background: rgba(255,255,255,0.12);
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}
.btn-user-menu:hover { background: rgba(255,255,255,0.2); }
.user-avatar { font-size: 1.1rem; line-height: 1; }
@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    50%       { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0); }
}
.pulse-success { animation: pulse-border 1.5s infinite; }

/* ---- Mobile ---- */
@media (max-width: 576px) {
    /* Default: stack videos vertically */
    .video-grid { grid-template-columns: 1fr; }

    /* Screen share on mobile: screen on top full width, cams side by side below */
    .video-grid.screen-sharing {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    .video-grid.screen-sharing .video-screen {
        grid-column: 1 / span 2;
        grid-row: 1;
    }
    .video-grid.screen-sharing #local-container  { grid-column: 1; grid-row: 2; }
    .video-grid.screen-sharing #remote-container { grid-column: 2; grid-row: 2; }
    .video-grid.screen-sharing .video-container  { min-height: 90px; }

    .queue-number-big { font-size: 3.5rem; }
    .auth-card { padding: 1.75rem; }
    .main-content { padding: 1rem; }
}

/* ============================================================
   OPCRF STYLES
   ============================================================ */

/* KRA Item rows */
.kra-item {
    transition: background 0.15s;
}
.kra-item:hover {
    background: rgba(13, 110, 253, 0.03);
}
.kra-item:last-child {
    border-bottom: 0 !important;
}

/* Strand code badge — allow text to wrap so it never overflows its column */
.kra-item .badge.bg-info,
.border-bottom .badge.bg-info {
    white-space: normal;
    text-align: left;
    line-height: 1.4;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
}

/* Section headers */
.opcrf-section-header {
    padding: 0.5rem 0;
    border-left: 4px solid var(--bs-primary);
    padding-left: 0.75rem;
}

/* Compact score selects */
.kra-score {
    min-width: 70px;
}

/* MOV badge chips */
.mov-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: #334155;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Rubric collapse area */
#opcrf-kra-container .collapse .border {
    background: #fffbeb;
}

/* Summary table highlight */
#opcrf-tab-part3 .table-primary td {
    font-weight: 600;
}

/* Admin OPCRF filter buttons */
.opcrf-filter-btn.active {
    font-weight: 600;
}

/* Status badge sizes */
#opcrf-status-badge {
    font-size: 0.85rem;
    padding: 0.35em 0.65em;
    vertical-align: middle;
}

/* Info card subtle */
#opcrf-info-card {
    border-left: 4px solid var(--bs-primary) !important;
    background: linear-gradient(90deg, rgba(13,110,253,0.05) 0%, transparent 100%) !important;
}

/* OPCRF tabs scrollable on mobile */
#opcrf-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
}
#opcrf-tabs .nav-link {
    white-space: nowrap;
}

/* Locked state overlay hint */
.opcrf-locked-hint {
    background: rgba(255,193,7,0.12);
    border: 1px solid rgba(255,193,7,0.4);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
    color: #856404;
}

/* Register position hint */
#reg-template-hint {
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ── Always-visible Rating Scale ──────────────────────────── */
.rating-scale-box {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.72rem;
    line-height: 1.35;
}
.rating-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 7px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.rating-row:last-child {
    border-bottom: none;
}
.rating-row:nth-child(odd) {
    background: #fafafa;
}
.rating-row:hover {
    background: #f0f7ff;
}
.rating-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Template Manager ──────────────────────────────────────── */
.btn-xs {
    padding: 2px 7px;
    font-size: 0.72rem;
    line-height: 1.4;
    border-radius: 3px;
}
#tpl-items-container .table td {
    vertical-align: middle;
}
