/* OSCE Timer - Universal Stylesheet (100% Offline Ready) */
:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --color-blue: #2563eb;
    --color-green: #16a34a;
    --color-amber: #d97706;
    --color-red: #dc2626;
    --color-purple: #7c3aed;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: clip;
}

/* ================= DISPLAY STYLES (TV & Kiosk) ================= */
.display-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 1.5rem 2.5rem;
    position: relative;
    transition: background-color 0.5s ease;
}

/* Header Display */
.display-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    gap: 1.5rem;
    min-height: 80px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
}

.header-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.header-institution {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.25;
    white-space: nowrap;
}

.inst-faculty {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #f8fafc;
}

.inst-univ {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.header-center {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-width: 0; /* Mencegah kolom grid meluap keluar */
    padding: 0 0.5rem;
}

.exam-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 100%;
    width: 100%;
}

.exam-title-line {
    text-transform: uppercase;
    text-align: center;
    word-break: break-word;
    letter-spacing: 0.04em;
}

/* Mode 1 Baris: Ukuran tegas, gagah, proporsional, dan sangat jelas terbaca di TV/Layar Besar */
.exam-title-wrapper.single-line .exam-title-line1 {
    font-size: clamp(1.6rem, 2.5vw, 2.6rem);
    font-weight: 900;
    line-height: 1.2;
    color: #ffffff;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.7);
}

/* Mode 2 Baris: Ukuran otomatis proporsional, hierarki seimbang, dan mudah dibaca */
.exam-title-wrapper.double-line .exam-title-line1 {
    font-size: clamp(1.3rem, 2.0vw, 1.9rem);
    font-weight: 900;
    line-height: 1.2;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.exam-title-wrapper.double-line .exam-title-line2 {
    font-size: clamp(1.05rem, 1.55vw, 1.45rem);
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0.25rem;
    color: #f1f5f9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.exam-title {
    font-size: clamp(1.05rem, 1.7vw, 1.55rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    text-align: center;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    justify-content: flex-end;
}

/* Icon-Only Fullscreen Button */
.btn-icon-square {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.btn-icon-square:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.btn-icon-square:active {
    transform: scale(0.96);
}

.btn-icon-square svg {
    display: block;
}

@media (max-width: 992px) {
    .display-header {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        min-height: auto;
    }
    .header-center {
        order: -1;
    }
    .header-right {
        justify-content: space-between;
    }
}

.station-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 2.5px solid #fde047;
    color: #ffffff;
    padding: 0.65rem 1.8rem;
    border-radius: 9999px;
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 15px rgba(0, 0, 0, 0.45);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    transition: all 0.3s ease;
}

/* Variasi Warna Badge Sesuai Fase Agar Selalu Mencolok & Berbeda */
.station-badge.badge-persiapan {
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    border: 2.5px solid #fef08a;
    color: #ffffff;
    box-shadow: 0 0 28px rgba(245, 158, 11, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 15px rgba(0, 0, 0, 0.5);
}

.station-badge.badge-station {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    border: 2.5px solid #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 15px rgba(0, 0, 0, 0.45);
}

.station-badge.badge-prayer {
    background: linear-gradient(135deg, #7c3aed 0%, #581c87 100%);
    border: 2.5px solid #c084fc;
    color: #ffffff;
    box-shadow: 0 0 28px rgba(168, 85, 247, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 15px rgba(0, 0, 0, 0.45);
}

.station-badge.badge-freeze {
    background: linear-gradient(135deg, #0d9488 0%, #115e59 100%);
    border: 2.5px solid #2dd4bf;
    color: #ffffff;
    box-shadow: 0 0 28px rgba(20, 184, 166, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 15px rgba(0, 0, 0, 0.45);
}

/* Main Display Center */
.display-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
    flex-grow: 1;
}

.phase-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
    line-height: 1.1;
    transition: all 0.3s ease;
}

.phase-subtitle {
    font-size: 1.6rem;
    color: #cbd5e1;
    max-width: 900px;
    margin-bottom: 2rem;
    line-height: 1.4;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Big Digital Timer */
.timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 1.5rem 0;
}

.timer-digits {
    font-size: clamp(6rem, 16vw, 15rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    user-select: none;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    max-width: 1000px;
    background-color: rgba(255, 255, 255, 0.15);
    height: 16px;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 1.5rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

.progress-bar {
    height: 100%;
    background-color: #ffffff;
    width: 100%;
    transition: width 0.8s linear;
    border-radius: 9999px;
}

/* Display Footer */
.display-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    color: #cbd5e1;
    font-size: 1.05rem;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    justify-self: start;
}

.footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
}

.footer-right {
    display: flex;
    align-items: center;
    justify-self: end;
}

/* Jam, Hari & Tanggal Server Badge */
.server-clock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.45rem 1.4rem;
    border-radius: 9999px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.clock-day-date {
    font-size: 1.05rem;
    font-weight: 600;
    color: #e2e8f0;
}

.clock-divider {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 300;
}

.clock-time {
    font-size: 1.25rem;
    font-weight: 800;
    color: #38bdf8;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

@media (max-width: 992px) {
    .display-footer {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        text-align: center;
    }
    .footer-left, .footer-center, .footer-right {
        justify-self: center;
    }
}

.footer-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #10b981;
}

.status-dot.pulsing {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Theme Themes for Display */
.theme-blue {
    background: radial-gradient(circle at center, #1e3a8a 0%, #0f172a 100%);
}

.theme-green {
    background: radial-gradient(circle at center, #065f46 0%, #0f172a 100%);
}

.theme-amber {
    background: radial-gradient(circle at center, #92400e 0%, #0f172a 100%);
}

.theme-red {
    background: radial-gradient(circle at center, #991b1b 0%, #0f172a 100%);
}

.theme-purple {
    background: radial-gradient(circle at center, #581c87 0%, #0f172a 100%);
}

.theme-teal {
    background: radial-gradient(circle at center, #115e59 0%, #042f2e 100%);
}

.theme-stopped {
    background: #0f172a;
}

.theme-opening {
    background: radial-gradient(circle at center, #075985 0%, #0c4a6e 40%, #030712 100%);
}

/* Flashing Alert for Warning & Time Up */
.flash-warning {
    animation: borderWarningFlash 1s infinite alternate;
}

@keyframes borderWarningFlash {
    from { box-shadow: inset 0 0 40px rgba(245, 158, 11, 0.4); }
    to { box-shadow: inset 0 0 100px rgba(245, 158, 11, 0.85); }
}

.flash-danger {
    animation: borderDangerFlash 0.8s infinite alternate;
}

@keyframes borderDangerFlash {
    from { box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.5); }
    to { box-shadow: inset 0 0 140px rgba(239, 68, 68, 0.95); }
}

/* Quick Action Buttons on Display */
.display-actions {
    display: flex;
    gap: 0.8rem;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Audio Banner Notice */
.audio-notice-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #eab308;
    color: #1e293b;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    cursor: pointer;
}

/* ================= ADMIN DASHBOARD STYLES (COMPACT & MODERN) ================= */
.admin-container {
    max-width: 1560px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-dark);
    z-index: 100;
}

.admin-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #f1f5f9;
}

.admin-subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.1rem;
    align-items: start;
}

/* Sidebar Kiri: Live Monitor, Kontrol Operasional & Navigasi (Sticky saat scroll pengaturan) */
.admin-sidebar {
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .admin-grid {
        grid-template-columns: 370px 1fr;
    }

    .admin-sidebar {
        position: sticky;
        top: 85px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 4px;
        scrollbar-width: thin;
        scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
    }

    .admin-sidebar::-webkit-scrollbar {
        width: 5px;
    }

    .admin-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .admin-sidebar::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.25);
        border-radius: 4px;
    }

    .admin-sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(148, 163, 184, 0.45);
    }
}

.admin-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 4px 18px rgba(0,0,0,0.22);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Control Buttons */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.86rem;
    font-weight: 700;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-blue);
    color: white;
}
.btn-primary:hover { background-color: #1d4ed8; }

.btn-success {
    background-color: var(--color-green);
    color: white;
}
.btn-success:hover { background-color: #15803d; }

.btn-warning {
    background-color: var(--color-amber);
    color: white;
}
.btn-warning:hover { background-color: #b45309; }

.btn-danger {
    background-color: var(--color-red);
    color: white;
}
.btn-danger:hover { background-color: #b91c1c; }

.btn-secondary {
    background-color: #334155;
    color: #e2e8f0;
}
.btn-secondary:hover { background-color: #475569; }

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: #cbd5e1;
}
.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 1.02rem;
}

.btn-save-sm {
    padding: 0.26rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 6px;
    background: #0284c7;
    color: white;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.btn-save-sm:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}

.btn-save-sm:active {
    transform: translateY(0);
}

/* Form Inputs */
.form-group {
    margin-bottom: 0.75rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.45rem 0.7rem;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: white;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* Live Mini Preview */
.mini-preview {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    text-align: center;
    transition: background-color 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.85rem;
}

.mini-digits {
    font-size: 2.8rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    margin: 0.25rem 0;
    line-height: 1;
}

/* Phase Tab Panels & Grid */
.phases-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

@media (min-width: 640px) {
    .phases-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.phase-card {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0;
}

.phase-card-full {
    grid-column: 1 / -1;
}

.phase-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-blue { background: rgba(37, 99, 235, 0.2); color: #60a5fa; border: 1px solid #2563eb; }
.badge-green { background: rgba(22, 163, 74, 0.2); color: #4ade80; border: 1px solid #16a34a; }
.badge-amber { background: rgba(217, 119, 6, 0.2); color: #fcd34d; border: 1px solid #d97706; }
.badge-red { background: rgba(220, 38, 38, 0.2); color: #f87171; border: 1px solid #dc2626; }
