:root {
    --bg: #050508;
    --surface: #0a0a12;
    --card: #12121c;
    --border: #2a2a3a;
    --accent: #f59e0b;
    /* --accent: #17f13b; */
    --accent-glow: rgba(245, 158, 11, 0.4);
    --success: #10b981;
    --duplicate: #f97316;
    --error: #ef4444;
    --text: #f8fafc;
    --text-muted: #64748b;
    --font-ui: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}
* { 
    box-sizing: border-box; margin: 0; padding: 0; 
}
body {
    font-family: var(--font-ui);
    background: radial-gradient(circle at 50% 0%, #1a1a2e 0%, var(--bg) 70%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}
.event-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}
.event-header {
    text-align: center; margin-bottom: 2rem; 
}
h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #f59e0b, #fbbf24, #d97706);
    /* -webkit-background-clip: text; */
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
    margin-bottom: 1.2rem;
}
.progress-wrapper {
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}
.progress-info {
    display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-weight: 600;
}
.progress-bar {
    height: 14px; background: #1e1e2e; border-radius: 10px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent), #fbbf24);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px var(--accent-glow);
}
.main-display {
    background: var(--card);
    border-radius: 24px;
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transition: transform 0.2s, border-color 0.2s;
}
.subtitle {
    display: block; color: var(--text-muted); font-size: 1.2rem; margin-bottom: 0.8rem; letter-spacing: 1px;
}
.barcode-display {
    font-family: var(--font-mono); font-size: 5rem; font-weight: 700; color: var(--text); letter-spacing: 6px; min-height: 1.2em;
}
.main-display.success-glow {
    border-color: var(--success); box-shadow: 0 0 40px rgba(16, 185, 129, 0.35); transform: scale(1.01); 
}
.main-display.duplicate-glow {
    border-color: var(--duplicate); box-shadow: 0 0 40px rgba(249, 115, 22, 0.35); animation: shake 0.4s ease; 
}
.input-area {
    display: flex; gap: 1rem; margin-bottom: 2rem; align-items: center; justify-content: center;
}
#barcode-input {
    width: 450px; padding: 1rem; font-size: 1.3rem; background: var(--surface); border: 2px solid var(--border);
    border-radius: 12px; color: var(--text); font-family: var(--font-mono); text-align: center; outline: none; transition: all 0.2s;
}
#barcode-input:focus { 
    border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); 
}
.status-msg {
    font-size: 1rem; color: var(--text-muted); min-width: 80px; text-align: right; font-weight: 600; 
}
.history-grid {
    background: var(--surface); border-radius: 20px; padding: 1.5rem; border: 1px solid var(--border);
}
.history-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding: 0 0.5rem;
}
.history-header h2 { 
    font-size: 1.4rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.6rem; 
}
.btn-reset {
    background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 0.6rem 1.2rem;
    border-radius: 8px; cursor: pointer; font-family: var(--font-ui); font-weight: 600; transition: all 0.2s;
}
.btn-reset:hover {
    background: rgba(239, 68, 68, 0.1); color: var(--error); border-color: var(--error); 
}
.grid-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem;
    max-height: 45vh; overflow-y: auto; padding-right: 0.5rem;
}
.ticket-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem;
    text-align: center; font-family: var(--font-mono); font-weight: 600; font-size: 1rem; color: var(--text-muted);
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ticket-card.new {
    border-color: var(--success); color: var(--success); background: rgba(16, 185, 129, 0.12); }
.empty-grid {
    grid-column: 1 / -1; text-align: center; padding: 3rem; color: var(--text-muted); font-style: italic; 
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } 
}
@keyframes shake {
    0%, 100% { transform: translateX(0); } 25%, 75% { transform: translateX(-10px); } 50% { transform: translateX(10px); } 
}
#confetti-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 999; 
}
.grid-container::-webkit-scrollbar {
    width: 6px; 
}
.grid-container::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: 4px; 
}
/* Penambahan Layout Sidebar */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}
.nav-item.active {
    background: var(--accent);
    color: var(--bg);
}
.content-area {
    margin-left: 260px;
    flex: 1;
    padding: 2rem 3rem;
}
/* Toggle Menu */
.menu-content {
    display: none; 
}
.menu-content.active {
    display: block;
}
/* CSS Tabel Dashboard */
.dashboard-header h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: var(--text);
    text-align: center;
}
.table-container {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.winner-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
}
.winner-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.2rem;
    text-align: center;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
}
.winner-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.winner-table tr:hover {
    background: rgba(245, 158, 11, 0.05);
}
/* Global Input di pojok bawah agar tidak mengganggu layout */
.global-input-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    background: var(--surface);
    padding: 8px 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
#barcode-input {
    width: 150px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--accent);
    font-family: var(--font-mono);
    outline: none;
    /* transition: border-color 0.2s; */
}
.global-input-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    display: flex;
    align-items: center;
    gap: 12px; /* Jarak antara kotak input dan status-msg */
    background: var(--surface);
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}
.input-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px; 
    white-space: nowrap;
}
/* Rise Quantity Section Styles */
.rise-qty-wrapper {
    max-width: 850px;
    margin: 2rem auto;
    background: var(--card);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.rise-qty-wrapper h2 {
    text-align: center;
    color: var(--accent);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}
.qty-group {
    display: grid;
    grid-template-columns: 1fr; /* Single column */
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.input-box {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.input-box label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}
.input-box input {
    width: 100%;
    padding: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    outline: none;
    transition: all 0.2s;
}
.input-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.qty-btn {
    margin-top: 0.5rem;
    padding: 0.8rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.qty-btn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}
.current-total-box {
    text-align: center;
    padding: 1.2rem;
    background: var(--surface);
    border-radius: 12px;
    border: 1px dashed var(--border);
    font-size: 1.1rem;
    color: var(--text-muted);
}
.current-total-box strong {
    font-size: 2.2rem;
    color: var(--success);
    font-family: var(--font-mono);
    margin-left: 0.5rem;
}
/* Responsif untuk layar kecil */
@media (max-width: 768px) {
    .qty-group { grid-template-columns: 1fr; }
}
/* Pop-up Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none; /* Sembunyi secara default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.popup-content {
    background: var(--card);
    padding: 3rem;
    border-radius: 24px;
    border: 2px solid var(--duplicate);
    text-align: center;
    max-width: 450px;
    box-shadow: 0 0 50px rgba(249, 115, 22, 0.4);
    animation: popScale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.popup-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}
.popup-content h2 {
    color: var(--duplicate);
    font-size: 2rem;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}
.popup-content p {
    color: var(--text);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}
.popup-btn {
    background: var(--duplicate);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}
.popup-btn:hover {
    transform: scale(1.05);
}
@keyframes popScale {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
/* Pop-up & Password Modal */
.popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px); display: none; justify-content: center; align-items: center; z-index: 9999;
}
.popup-content {
    background: var(--card); padding: 3rem; border-radius: 24px; border: 2px solid var(--duplicate);
    text-align: center; max-width: 450px; box-shadow: 0 0 50px rgba(249, 115, 22, 0.4);
    animation: popScale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.popup-icon {
    font-size: 5rem; margin-bottom: 1rem; 
}
.popup-content h2 {
    color: var(--duplicate); font-size: 2rem; margin-bottom: 1rem; letter-spacing: 2px;
}
.popup-content p {
    color: var(--text); margin-bottom: 1.5rem; font-size: 1.1rem;
}
.popup-btn {
    background: var(--duplicate); color: white; border: none; padding: 1rem 2rem; border-radius: 12px;
    font-weight: 800; cursor: pointer; width: 100%; transition: transform 0.2s;
}
.popup-btn:hover {
    transform: scale(1.05); 
}
@keyframes popScale {
    from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; }
}
/* Password Input Specific */
#settings-password {
    width: 100%; padding: 0.9rem; margin: 0 0 1rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-family: var(--font-mono); font-size: 1.1rem;
    text-align: center; letter-spacing: 4px; outline: none; transition: all 0.2s;
}
#settings-password:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); 
}
/* Scanner Sub-Nav Styles */
.scanner-subnav {
    display: flex; gap: 1rem; margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem;
}
.subnav-item {
    padding: 0.8rem 1.5rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-family: var(--font-ui); 
    transition: all 0.2s; border: 1px solid var(--border); background: transparent; color: var(--text-muted);
}
.subnav-item.active {
    background: var(--accent); color: var(--bg); border-color: var(--accent);
}
.subnav-item:not(.active):hover {
    background: rgba(255,255,255,0.05); color: var(--text);
}
/* === Pusatkan Isi Tabel List of Winners === */
.winner-table th,
.winner-table td {
    text-align: center !important;
}
/* === Pagination & Auto-Slide Styles === */
.table-wrapper {
    position: relative;
    margin: 0 auto;
    max-width: 100%;
}
.winner-table tbody {
    transition: opacity 0.3s ease;
}
.winner-table tbody.fade-out {
    opacity: 0;
}
.pagination-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1.5rem;
}
.pagination-dot {
    width: 12px; height: 12px; border-radius: 50%; background: var(--border);
    cursor: pointer; transition: all 0.3s ease; border: 2px solid transparent;
}
.pagination-dot.active {
    background: var(--accent); transform: scale(1.3);
    border-color: var(--accent-glow); box-shadow: 0 0 8px var(--accent-glow);
}
.pagination-dot:hover:not(.active) {
    background: var(--text-muted);
}
/* Pause slide saat hover di tabel */
.table-container:hover {
    cursor: default;
}
/* Carousel & Split Layout */
.carousel-wrapper {
    background: var(--card);
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 1.5rem;
    overflow: hidden;
}
.split-table-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.table-panel {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 520px; /* Menjaga tinggi konsisten */
}
.table-panel .winner-table {
    width: 100%;
    border-collapse: collapse;
}
.table-panel .winner-table th {
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.table-panel .winner-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    transition: background 0.2s;
}
.table-panel .winner-table tr:hover td {
    background: rgba(245, 158, 11, 0.08);
}
.winner-table tbody {
    transition: opacity 0.4s ease;
}
.winner-table tbody.fade-out {
    opacity: 0;
}
/* Pagination Dots */
.pagination-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1.2rem;
}
.pagination-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: all 0.3s;
}
.pagination-dot.active {
    background: var(--accent);
    transform: scale(1.4);
    box-shadow: 0 0 8px var(--accent-glow);
}
/* Responsive: Stack ke 1 kolom di tablet/mobile */
@media (max-width: 960px) {
    .split-table-layout { grid-template-columns: 1fr; }
    .table-panel { min-height: auto; }
}
/* === Search Input Styles === */
.search-wrapper {
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: center;
}
#search-input {
    width: 100%;
    max-width: 450px;
    padding: 0.85rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}
#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
#search-input::placeholder {
    color: var(--text-muted);
}
/* =========================================================
   RESPONSIVE MOBILE & TABLET
========================================================= */
@media (max-width: 768px) {

    body {
        overflow-x: hidden;
    }

    .app-wrapper {
        flex-direction: column;
    }

    /* =========================
       SIDEBAR MOBILE
    ========================= */
    .sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        width: 100%;
        height: 72px;
        padding: 0.6rem 1rem;
        border-right: none;
        border-top: 1px solid var(--border);
        flex-direction: row;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        background: rgba(10, 10, 18, 0.96);
        backdrop-filter: blur(10px);
    }

    /* Logo disembunyikan di mobile agar sidebar tidak besar */
    .sidebar-logo {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        width: 100%;
        justify-content: center;
        gap: 0.8rem;
    }

    .nav-item {
        flex: 1;
        max-width: 170px;
        justify-content: center;
        text-align: center;
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    /* =========================
       CONTENT AREA
    ========================= */
    .content-area {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-bottom: 100px; /* ruang untuk sidebar bawah */
    }

    .event-container {
        padding: 1rem;
    }

    /* =========================
       HEADER & TITLE
    ========================= */
    h1 {
        font-size: 2rem;
        line-height: 1.2;
        letter-spacing: 1px;
    }

    .dashboard-header h2 {
        font-size: 1.4rem;
        line-height: 1.4;
        margin-bottom: 1rem;
    }

    /* =========================
       MAIN DISPLAY
    ========================= */
    .main-display {
        padding: 2rem 1rem;
        border-radius: 18px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .barcode-display {
        font-size: 2.3rem;
        letter-spacing: 2px;
        word-break: break-word;
    }

    /* =========================
       INPUT SCANNER
    ========================= */
    .global-input-container {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: 85px;
        width: calc(100% - 24px);
        max-width: 420px;
        justify-content: center;
        padding: 0.8rem 1rem;
    }

    #barcode-input {
        width: 100%;
        min-width: 0;
        font-size: 1rem;
    }

    .input-label {
        font-size: 0.85rem;
    }

    /* =========================
       TABLE DASHBOARD
    ========================= */
    .carousel-wrapper {
        padding: 1rem;
        border-radius: 16px;
    }

    .split-table-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .table-panel {
        min-height: auto;
        overflow-x: auto;
    }

    .winner-table {
        min-width: 100%;
    }

    .winner-table th,
    .winner-table td {
        padding: 0.7rem 0.5rem;
        font-size: 0.82rem;
    }

    /* =========================
       SEARCH INPUT
    ========================= */
    #search-input {
        max-width: 100%;
        font-size: 0.95rem;
    }

    /* =========================
       HISTORY GRID
    ========================= */
    .history-grid {
        padding: 1rem;
    }

    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .history-header h2 {
        justify-content: center;
        text-align: center;
    }

    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
        max-height: 40vh;
    }

    .ticket-card {
        font-size: 0.85rem;
        padding: 0.8rem;
    }

    /* =========================
       SUB NAVIGATION
    ========================= */
    .scanner-subnav {
        flex-wrap: wrap;
        gap: 0.7rem;
    }

    .subnav-item {
        flex: 1;
        text-align: center;
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    /* =========================
       POPUP
    ========================= */
    .popup-content {
        width: calc(100% - 24px);
        padding: 2rem 1.2rem;
        border-radius: 18px;
    }

    .popup-content h2 {
        font-size: 1.5rem;
    }

    .popup-content p {
        font-size: 0.95rem;
    }

    /* =========================
       RISE QUANTITY
    ========================= */
    .rise-qty-wrapper {
        padding: 1.5rem 1rem;
    }

    .rise-qty-wrapper h2 {
        font-size: 1.4rem;
    }

    .current-total-box strong {
        font-size: 1.8rem;
    }
}

/* =========================================================
   EXTRA SMALL DEVICE
========================================================= */
@media (max-width: 480px) {

    h1 {
        font-size: 1.7rem;
    }

    .barcode-display {
        font-size: 1.9rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .nav-item {
        font-size: 0.82rem;
        padding: 0.75rem;
    }

    .winner-table th,
    .winner-table td {
        font-size: 0.75rem;
    }

    .global-input-container {
        gap: 0.5rem;
    }
}