/* ============================================================
   Platform Lomba — Stylesheet Utama
   Tema: Biru Tua + Hijau + Aksen Kuning (Jendela Dunia)
   ============================================================ */

:root {
    --primary: #1e3a8a;
    --primary-dark: #172e6e;
    --primary-light: #3b5bbf;
    --accent: #059669;
    --accent-light: #10b981;
    --yellow: #f59e0b;
    --yellow-light: #fbbf24;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 4px 16px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
    --radius: 14px;
    --radius-sm: 10px;

    /* Warna per-lomba */
    --cerdas: #1e3a8a;
    --cerdas-2: #3b82f6;
    --pidato: #b91c1c;
    --pidato-2: #ef4444;
    --desain: #7c3aed;
    --desain-2: #a855f7;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============ NAVBAR ============ */
.main-navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 130%);
    box-shadow: var(--shadow);
    padding: .55rem 0;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.brand-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light));
    color: var(--primary-dark);
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, .4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-weight: 800; font-size: 1.05rem; }
.brand-sub { font-size: .68rem; opacity: .85; font-weight: 500; }
.main-navbar .nav-link {
    color: rgba(255,255,255,.88) !important;
    font-weight: 500;
    font-size: .92rem;
    padding: .5rem .9rem !important;
    border-radius: 8px;
    transition: background .15s;
}
.main-navbar .nav-link:hover,
.main-navbar .nav-item.show > .nav-link {
    background: rgba(255,255,255,.14);
    color: #fff !important;
}
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: .4rem;
}
.dropdown-item { border-radius: 6px; padding: .55rem .8rem; font-weight: 500; }
.dropdown-item:hover { background: var(--bg); }

.admin-main { flex: 1 0 auto; }
.app-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,.8);
    font-size: .82rem;
    margin-top: auto;
}
.footer-org { font-weight: 600; }
.footer-copy { opacity: .7; }

/* ============ PAGE HEADERS ============ */
.page-header {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1.4rem;
}
.page-header-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: var(--shadow);
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -.01em;
}
.page-header .subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin: 0;
}

/* ============ CARDS ============ */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    padding: 1rem 1.25rem;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 1.25rem; }

/* ============ STAT CARDS ============ */
.stat-card {
    border-radius: var(--radius);
    color: #fff;
    padding: 1.3rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
    position: absolute;
    right: -8px; top: -8px;
    font-size: 5rem;
    opacity: .14;
}
.stat-card .stat-label { font-size: .82rem; opacity: .9; font-weight: 500; }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 800; line-height: 1.1; margin-top: .2rem; }
.stat-card .stat-foot { font-size: .76rem; opacity: .8; margin-top: .35rem; }
.stat-cerdas { background: linear-gradient(135deg, var(--cerdas), var(--cerdas-2)); }
.stat-pidato { background: linear-gradient(135deg, var(--pidato), var(--pidato-2)); }
.stat-desain { background: linear-gradient(135deg, var(--desain), var(--desain-2)); }
.stat-total { background: linear-gradient(135deg, var(--accent), var(--accent-light)); }

/* ============ BUTTONS ============ */
.btn { font-weight: 600; border-radius: 9px; padding: .55rem 1.1rem; transition: all .15s; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--accent); border-color: var(--accent); }
.btn-success:hover { background: #047857; border-color: #047857; }

/* Tombol SPIN besar */
.btn-spin {
    background: linear-gradient(135deg, var(--yellow), #d97706);
    border: none;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 1rem 2.2rem;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(245, 158, 11, .4);
    text-transform: uppercase;
    letter-spacing: .03em;
    transition: transform .15s, box-shadow .15s;
}
.btn-spin:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(245, 158, 11, .55);
    color: #fff;
}
.btn-spin:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-spin i { margin-right: .5rem; }

/* ============ TABLES ============ */
.table { margin-bottom: 0; }
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    font-weight: 700;
    padding: .8rem 1rem;
    white-space: nowrap;
}
.table tbody td { padding: .75rem 1rem; vertical-align: middle; border-color: var(--border); }
.table tbody tr:hover { background: #f8fafc; }

/* Badge jenis lomba */
.badge-lomba {
    font-size: .72rem;
    padding: .4em .7em;
    border-radius: 6px;
    font-weight: 600;
}
.badge-cerdas { background: rgba(30, 58, 138, .12); color: var(--cerdas); }
.badge-pidato { background: rgba(185, 28, 28, .12); color: var(--pidato); }
.badge-desain { background: rgba(124, 58, 237, .12); color: var(--desain); }

/* ============ LOGIN ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 120%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(245, 158, 11, .25), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(16, 185, 129, .25), transparent 40%);
}
.login-card {
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
}
.login-logo {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--yellow), #d97706);
    color: #fff;
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 10px 25px rgba(245, 158, 11, .45);
}
.login-card h1 { font-size: 1.4rem; font-weight: 800; text-align: center; margin: 0; }
.login-card .org-name { text-align: center; color: var(--text-muted); font-size: .8rem; margin: .3rem 0 1.5rem; line-height: 1.4; }
.form-control, .form-select {
    border-radius: 9px;
    padding: .6rem .85rem;
    border-color: var(--border);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(59, 91, 191, .18);
}
.input-group-text { background: #f8fafc; border-color: var(--border); color: var(--text-muted); }

/* ============ SPIN PAGE ============ */
.spin-control-panel {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.6rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.spin-status-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .85rem;
}
.spin-status-belum { background: #fef3c7; color: #92400e; }
.spin-status-aktif { background: #d1fae5; color: #065f46; }

/* ============ ANIMASI SPIN ============ */
.spin-shuffle {
    display: inline-block;
    animation: shuffle .12s infinite alternate;
}
@keyframes shuffle {
    from { transform: translateY(-3px) rotate(-2deg); opacity: .7; }
    to { transform: translateY(3px) rotate(2deg); opacity: 1; }
}
.spin-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .85);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
    color: #fff;
}
.spin-overlay.show { display: flex; }
.spin-wheel {
    font-size: 4.5rem;
    color: var(--yellow-light);
    animation: spinrotate 1s linear infinite;
}
@keyframes spinrotate { to { transform: rotate(360deg); } }
.spin-overlay .spin-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.spin-names-flow {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--yellow-light);
    min-height: 3rem;
    text-align: center;
}

/* ============ KARTU KELOMPOK (Cerdas Cermat) ============ */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}
.team-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border-top: 5px solid var(--cerdas-2);
    transition: transform .2s;
}
.team-card:hover { transform: translateY(-4px); }
.team-card.cerdas { border-top-color: var(--cerdas-2); }
.team-header {
    padding: 1rem 1.2rem;
    background: linear-gradient(135deg, var(--cerdas), var(--cerdas-2));
    color: #fff;
    display: flex; align-items: center; justify-content: space-between;
}
.team-header .team-name { font-weight: 800; font-size: 1.15rem; }
.team-header .team-count { font-size: .78rem; opacity: .9; background: rgba(255,255,255,.2); padding: .15rem .55rem; border-radius: 999px; }
.team-members { padding: .8rem 1.2rem; }
.team-member {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem 0;
    border-bottom: 1px dashed var(--border);
    font-weight: 500;
}
.team-member:last-child { border-bottom: none; }
.team-member-num {
    width: 28px; height: 28px;
    background: rgba(30, 58, 138, .1);
    color: var(--cerdas);
    border-radius: 8px;
    font-size: .8rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ============ URUTAN (Pidato / Desain) ============ */
.order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .8rem;
}
.order-card {
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform .15s, box-shadow .15s;
}
.order-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.order-num {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.order-card.pidato .order-num { background: linear-gradient(135deg, var(--pidato), var(--pidato-2)); }
.order-card.desain .order-num { background: linear-gradient(135deg, var(--desain), var(--desain-2)); }
.order-card .order-name { font-weight: 700; font-size: 1.02rem; line-height: 1.2; }
.order-card .order-meta { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }

/* Status performer pidato */
.performer-status {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .25rem;
}
.status-menunggu { background: #f1f5f9; color: var(--text-muted); }
.status-tampil   { background: #fef3c7; color: #92400e; animation: pulse 1.5s infinite; }
.status-selesai  { background: #d1fae5; color: #065f46; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .5); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
.order-card.is-active { border: 2px solid var(--yellow); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.order-card.is-done { opacity: .55; }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3.5rem; opacity: .35; margin-bottom: 1rem; }
.empty-state h4 { font-weight: 700; color: var(--text); margin-bottom: .3rem; }

/* ============ ALERTS ============ */
.alert { border-radius: var(--radius-sm); border: none; }

/* ============================================================
   LIVE DASHBOARD (halaman publik — proyektor friendly)
   ============================================================ */
body.live-body {
    background: radial-gradient(ellipse at top, #0f1e4d 0%, #0a1124 70%);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}
body.live-body::before {
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(16, 185, 129, .15), transparent 35%),
        radial-gradient(circle at 85% 80%, rgba(245, 158, 11, .15), transparent 35%);
    pointer-events: none;
}
.live-wrapper { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.live-header {
    padding: 1.3rem 1.8rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-wrap: wrap;
}
.live-brand { display: flex; align-items: center; gap: .9rem; }
.live-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--yellow), #d97706);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 10px 25px rgba(245, 158, 11, .4);
}
.live-title { font-size: 1.3rem; font-weight: 800; margin: 0; line-height: 1.1; }
.live-sub { font-size: .82rem; opacity: .7; margin: 0; }

.live-badge {
    display: inline-flex; align-items: center; gap: .5rem;
    background: var(--danger);
    color: #fff;
    padding: .45rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: .9rem;
    box-shadow: 0 0 20px rgba(220, 38, 38, .6);
}
.live-dot {
    width: 10px; height: 10px;
    background: #fff;
    border-radius: 50%;
    animation: livepulse 1s infinite;
}
@keyframes livepulse { 50% { opacity: .25; } }

.live-clock {
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--yellow-light);
}

/* Tab switcher */
.live-tabs {
    display: flex; gap: .5rem; justify-content: center;
    padding: 1rem;
    flex-wrap: wrap;
}
.live-tab {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff;
    padding: .7rem 1.4rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .95rem;
}
.live-tab:hover { background: rgba(255,255,255,.14); }
.live-tab.active.cerdas { background: linear-gradient(135deg, var(--cerdas), var(--cerdas-2)); border-color: transparent; }
.live-tab.active.pidato { background: linear-gradient(135deg, var(--pidato), var(--pidato-2)); border-color: transparent; }
.live-tab.active.desain { background: linear-gradient(135deg, var(--desain), var(--desain-2)); border-color: transparent; }

.live-content { flex: 1; padding: 1rem 1.8rem 2rem; max-width: 1400px; margin: 0 auto; width: 100%; }

/* Status belum spin */
.live-not-spun {
    text-align: center;
    padding: 4rem 1rem;
}
.live-not-spun .big-icon {
    font-size: 5rem;
    opacity: .25;
    margin-bottom: 1.2rem;
    animation: bobble 2s ease-in-out infinite;
}
@keyframes bobble { 50% { transform: translateY(-12px); } }
.live-not-spun h2 { font-size: 2rem; font-weight: 800; margin-bottom: .5rem; }
.live-not-spun p { font-size: 1.1rem; opacity: .7; }

/* Live — Pidato: kartu NOW / NEXT besar */
.pidato-now-next {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 768px) {
    .pidato-now-next { grid-template-columns: 1.4fr 1fr; }
}
.now-card, .next-card {
    border-radius: 22px;
    padding: 1.8rem;
    position: relative;
    overflow: hidden;
}
.now-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, .9), rgba(217, 119, 6, .9));
    box-shadow: 0 20px 50px rgba(245, 158, 11, .3);
    min-height: 220px;
    display: flex; flex-direction: column; justify-content: center;
}
.next-card {
    background: rgba(255,255,255,.08);
    border: 2px solid rgba(255,255,255,.15);
    min-height: 220px;
    display: flex; flex-direction: column; justify-content: center;
}
.label-tag {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    opacity: .9;
    margin-bottom: .6rem;
}
.now-name { font-size: 3rem; font-weight: 800; line-height: 1.05; margin: 0; }
.now-num { font-size: 1rem; opacity: .85; margin-top: .5rem; }
.next-name { font-size: 2rem; font-weight: 700; line-height: 1.1; margin: 0; }
@media (max-width: 600px) {
    .now-name { font-size: 2.2rem; }
    .next-name { font-size: 1.5rem; }
}

/* Live — list */
.live-section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 1rem;
    display: flex; align-items: center; gap: .6rem;
}
.live-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .8rem;
}
.live-item {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 14px;
    padding: 1rem;
    display: flex; align-items: center; gap: 1rem;
    transition: all .2s;
}
.live-item-num {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 800;
    flex-shrink: 0;
    background: rgba(255,255,255,.1);
}
.live-item-name { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.live-item.is-active {
    background: linear-gradient(135deg, rgba(245, 158, 11, .25), rgba(245, 158, 11, .1));
    border-color: var(--yellow);
    transform: scale(1.02);
}
.live-item.is-done { opacity: .45; }
.live-item.cerdas .live-item-num { background: linear-gradient(135deg, var(--cerdas), var(--cerdas-2)); }
.live-item.pidato .live-item-num { background: linear-gradient(135deg, var(--pidato), var(--pidato-2)); }
.live-item.desain .live-item-num { background: linear-gradient(135deg, var(--desain), var(--desain-2)); }

/* Live — tim cerdas cermat */
.live-team-card {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    overflow: hidden;
}
.live-team-header {
    padding: 1rem 1.3rem;
    background: linear-gradient(135deg, var(--cerdas), var(--cerdas-2));
    font-weight: 800;
    font-size: 1.15rem;
}
.live-team-members { padding: .6rem 1.3rem; }
.live-team-member {
    padding: .5rem 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-weight: 500;
}
.live-team-member:last-child { border-bottom: none; }

/* Empty result di live */
.live-empty-mini {
    text-align: center;
    padding: 2.5rem 1rem;
    opacity: .6;
}
.live-empty-mini i { font-size: 2.8rem; margin-bottom: .8rem; }

/* ============ UTIL ============ */
.text-pre-line { white-space: pre-line; }
.cursor-pointer { cursor: pointer; }
.table-actions { display: flex; gap: .35rem; }
.btn-icon {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    padding: 0;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    transition: all .15s;
}
.btn-icon:hover { background: var(--bg); }
.btn-icon.text-danger:hover { background: rgba(220, 38, 38, .1); color: var(--danger); border-color: rgba(220, 38, 38, .25); }
.btn-icon.text-primary:hover { background: rgba(30, 58, 138, .1); color: var(--primary); border-color: rgba(30, 58, 138, .25); }

.toolbar {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}
.toolbar .search-box { position: relative; flex: 1; min-width: 200px; }
.toolbar .search-box i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.toolbar .search-box input { padding-left: 2.3rem; }

.fade-in { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
    .brand-sub { display: none; }
    .page-header h1 { font-size: 1.2rem; }
    .live-title { font-size: 1rem; }
    .live-logo { width: 44px; height: 44px; font-size: 1.2rem; }
}
