:root {
    --primary-color: #4c6ef5;
    --secondary-color: #7950f2;
    --tertiary-color: #be4bdb;
    --accent-color: #f06595;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #28a745;
    --warning-color: #fd7e14;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
}

.navbar-brand {
    font-weight: 700;
    color: white !important;
}

.navbar, .app-footer, .card-header, .toast-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--tertiary-color) 100%) !important;
}

.navbar {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sidebar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--tertiary-color) 100%);
    color: white;
    min-height: calc(100vh - 56px);
    padding: 0;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-left: 4px solid transparent;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--accent-color);
}

.sidebar .nav-link.active {
    color: white;
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 4px solid var(--accent-color);
}

.sidebar .nav-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 24px;
    background-color: white;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
    color: white;
    border-radius: 12px 12px 0 0 !important;
    padding: 15px 20px;
    border-bottom: 0;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #364fc7;
    border-color: #364fc7;
}

.receipt-container {
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 20px;
    font-family: 'Courier New', monospace;
    background-color: #fff;
    color: #000;
}
.receipt-header { text-align: center; margin-bottom: 15px; }
.receipt-logo { max-width: 100px; height: auto; margin-bottom: 10px; object-fit: contain; }
.receipt-title { font-weight: bold; font-size: 1.1rem; margin: 0; }
.receipt-subtitle { font-size: 0.8rem; margin: 0; }
.receipt-divider { border-top: 1px dashed #000; margin: 10px 0; }
.receipt-details p { margin: 2px 0; font-size: 0.8rem; }
.receipt-items { width: 100%; border-collapse: collapse; margin: 15px 0; font-size: 0.8rem; }
.receipt-items th, .receipt-items td { padding: 4px 0; }
.receipt-items th { text-align: left; border-bottom: 1px dashed #000; }
.receipt-items .col-item { width: 45%; }
.receipt-items .col-qty { width: 15%; text-align: center; }
.receipt-items .col-price { width: 40%; text-align: right; }
.receipt-totals { width: 100%; font-size: 0.8rem; }
.receipt-totals td { padding: 2px 0; }
.receipt-totals .label { text-align: left; }
.receipt-totals .value { text-align: right; }
.receipt-totals .total-row td { font-weight: bold; padding-top: 8px; border-top: 1px dashed #000; }
.receipt-footer { text-align: center; margin-top: 15px; font-size: 0.75rem; }

/* --- START: Revisi Desain Tiket Cetak --- */
.printable-ticket-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 5mm;
}
.ticket-small-print {
    width: 95mm;
    height: 54mm;
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    position: relative;
    background-color: #fff;
    color: #212529;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    page-break-inside: avoid;
}
.ticket-small-print .ticket-main {
    flex-grow: 1;
    padding: 4mm;
    display: flex;
    flex-direction: column;
    background-image: linear-gradient(45deg, #f9f9f9 25%, transparent 25%), linear-gradient(-45deg, #f9f9f9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f9f9f9 75%), linear-gradient(-45deg, transparent 75%, #f9f9f9 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.ticket-small-print .ticket-stub {
    width: 28mm;
    background-color: #f8f9fa;
    border-left: 2px dashed #cccccc;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Kunci untuk mendorong konten ke atas & bawah */
    align-items: center;
    padding: 4mm 2mm;
    text-align: center;
}
.ticket-small-print .header {
    display: flex;
    align-items: center;
    margin-bottom: 2mm;
}
.ticket-small-print .logo {
    width: 12mm;
    height: 12mm;
    margin-right: 3mm;
    object-fit: contain;
    flex-shrink: 0; /* Mencegah logo menyusut */
}
/* REVISI: Mengatur agar nama acara tidak terpotong */
.ticket-small-print .venue-info {
    line-height: 1.2;
    flex-grow: 1; /* Memungkinkan elemen ini untuk memanjang mengisi ruang */
    min-width: 0;  /* Memungkinkan elemen untuk menyusut dan membungkus teks */
}
.ticket-small-print .venue-name {
    font-size: 9pt;
    font-weight: 700;
    word-break: break-word; /* Memastikan teks panjang akan di-wrap */
}
.ticket-small-print .venue-location {
    font-size: 6.5pt;
    color: #555;
}
.ticket-small-print .ticket-body {
    flex-grow: 1;
    display: flex;
    margin-top: 2mm;
    border-top: 1px solid #eee;
    padding-top: 2mm;
}
.ticket-small-print .ticket-details {
    flex-grow: 1;
    line-height: 1.4;
}
.ticket-small-print .ticket-type {
    font-size: 11pt;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}
.ticket-small-print .ticket-code {
    font-family: 'Courier New', monospace;
    font-size: 14pt;
    font-weight: bold;
    letter-spacing: 1px;
    margin: 0;
}
.ticket-small-print .ticket-expiry {
    font-size: 7.5pt;
    color: red;
    margin: 0;
}
.ticket-small-print .ticket-qr {
    width: 18mm;
    height: 18mm;
    margin-left: 3mm;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Mencegah QR code menyusut */
}
.ticket-small-print .ticket-qr img,
.ticket-small-print .ticket-qr canvas {
    max-width: 100%;
    height: auto;
}
.ticket-small-print .ticket-footer {
    margin-top: auto;
    font-size: 6.5pt;
    color: #777;
}
/* PENAMBAHAN: Kelas baru untuk info developer di footer tiket */
.ticket-small-print .ticket-developer-info {
    font-size: 6pt;
    color: #888;
    line-height: 1.2;
    text-align: left; /* Mengatur teks ke kiri agar rapi di bawah info cetak */
    margin-top: 2mm;
}
.ticket-stub .stub-venue {
    font-weight: 700;
    font-size: 8pt;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    opacity: 0.5;
}
/* REVISI: Posisi detail pada stub dipastikan di bawah */
.ticket-stub .stub-details {
    font-size: 8pt;
}
.ticket-stub .stub-type { font-weight: 600; }
.ticket-stub .stub-code { 
    font-family: 'Courier New', monospace;
    font-weight: bold; 
    font-size: 9pt;
    margin: 4px 0;
}
.ticket-stub .stub-price { 
    font-weight: bold; 
    font-size: 9pt;
    color: red;
}
/* --- END: Revisi Desain Tiket Cetak --- */

#printable-content { 
    display: none; 
}

@media print {
    body, .container-fluid {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }
    body > *:not(#printable-content) {
        display: none !important;
    }
    #printable-content {
        display: block !important;
        visibility: visible !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 10mm;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    @page {
        size: A4;
        margin: 0;
    }
}

@media (max-width: 768px) {
    .sidebar { min-height: auto; }
}

.restricted {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}
.restricted::after {
    content: "⛔";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--danger-color);
    z-index: 100;
}

.search-container { position: relative; margin-bottom: 15px; }
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    z-index: 1000;
    display: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.search-result-item { padding: 8px 15px; border-bottom: 1px solid #eee; cursor: pointer; transition: background-color 0.2s; }
.search-result-item:hover { background-color: #f5f5f5; }
.search-result-item .badge { margin-left: 5px; }

.batch-actions { margin-bottom: 15px; }
.select-all-checkbox { margin-right: 10px; }
.ticket-checkbox { margin-right: 5px; }

.app-footer { color: white; padding: 15px 0; text-align: center; font-size: 0.9rem; margin-top: 20px; }
.app-footer a { color: var(--light-color); text-decoration: none; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; color: #fff; }

.badge.bg-primary { background-color: var(--primary-color) !important; }
.border-bottom { border-bottom: 1px solid rgba(0,0,0,0.1) !important; }
.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(0,0,0,0.03); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--secondary-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

.spinner-container { display: flex; justify-content: center; align-items: center; height: 100px; }
.spinner {
    width: 3rem;
    height: 3rem;
    border: 0.25em solid var(--primary-color);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner 0.75s linear infinite;
}
@keyframes spinner { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.7); display: flex;
    justify-content: center; align-items: center; z-index: 9999;
    opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.loading-overlay.show { opacity: 1; visibility: visible; }
.loading-content {
    background-color: white; padding: 30px; border-radius: 10px;
    text-align: center; box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.report-summary-card { border-left: 5px solid var(--primary-color); background-color: #f1f3f5; }
.permissions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
