:root {
    --primary: #4f46e5;
    --sidebar-width: 260px;
}

@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400;
    src: url('/assets/fonts/Cairo-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 700;
    src: url('/assets/fonts/Cairo-Bold.ttf') format('truetype');
}
@font-face {
    font-family: 'Amiri';
    font-style: normal;
    font-weight: normal;
    src: url('/assets/fonts/Amiri-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Amiri';
    font-style: normal;
    font-weight: bold;
    src: url('/assets/fonts/Amiri-Bold.ttf') format('truetype');
}

.en, bdi[dir="ltr"] {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

body { font-family: 'Segoe UI', Tahoma, sans-serif; }

.admin-body { background: #f1f5f9; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: #1e293b;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    padding: 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid #334155;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: .15s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: #334155;
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid #334155;
}

.main-content { min-width: 0; }

.topbar {
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    height: 100%;
}

.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { color: #64748b; font-size: .9rem; }

.auth-body { background: linear-gradient(135deg, #4f46e5, #7c3aed); min-height: 100vh; }
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { background: #fff; border-radius: 16px; padding: 2rem; width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.15); }

.event-tabs .nav-link { color: #64748b; white-space: nowrap; }
.event-tabs .nav-link.active { color: var(--primary); font-weight: 600; }
.event-tabs { scrollbar-width: thin; }

.offcanvas-body .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.25rem;
    color: #334155;
    text-decoration: none;
}
.offcanvas-body .sidebar-nav a:hover,
.offcanvas-body .sidebar-nav a.active {
    background: #f1f5f9;
    color: var(--primary);
}

.ticket-compact {
    width: 280px;
    margin: 0 auto;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    border: 1px solid #e2e8f0;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}
.t-head {
    padding: 0;
    margin: 0;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
    background: linear-gradient(135deg, var(--ticket-primary-dark, #1d4ed8), var(--ticket-primary, #2563eb));
    color: #fff;
}
.t-head-banner {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 102px;
}
.t-head-visual {
    order: 2;
    width: 42%;
    min-width: 96px;
    flex-shrink: 0;
    background-color: var(--ticket-primary-dark, #1d4ed8);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}
.t-head-visual::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: -80%;
    pointer-events: none;
    background: linear-gradient(
        to left,
        transparent 0%,
        transparent 8%,
        color-mix(in srgb, var(--ticket-primary-dark) 12%, transparent) 18%,
        color-mix(in srgb, var(--ticket-primary) 25%, transparent) 28%,
        color-mix(in srgb, var(--ticket-primary) 42%, transparent) 38%,
        color-mix(in srgb, var(--ticket-primary-dark) 58%, transparent) 48%,
        color-mix(in srgb, var(--ticket-primary-dark) 74%, transparent) 58%,
        color-mix(in srgb, var(--ticket-primary-dark) 86%, transparent) 68%,
        color-mix(in srgb, var(--ticket-primary) 93%, transparent) 78%,
        var(--ticket-primary-dark) 88%,
        var(--ticket-primary-dark) 100%
    );
}
.t-head-text {
    order: 1;
    flex: 1;
    padding: 14px 12px 14px 16px;
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}
.ticket-compact:not(.has-logo) .t-head-text {
    text-align: center;
    align-items: center;
    padding: 16px 14px;
}
.t-title { font-size: 11px; opacity: 0.92; }
.t-event { font-size: 15px; font-weight: 700; line-height: 1.35; }
.t-code { font-size: 11px; opacity: 0.9; letter-spacing: 0.3px; }
.t-qr { text-align: center; padding: 12px 10px 6px; background: #f8fafc; }
.t-qr img { border-radius: 8px; background: #fff; padding: 6px; }
.t-name {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    padding: 8px 12px 4px;
}
.t-meta { padding: 4px 12px 10px; }
.t-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    font-size: 11px;
    border-bottom: 1px dashed #e2e8f0;
}
.t-row:last-child { border-bottom: 0; }
.t-label { color: #64748b; flex-shrink: 0; }
.t-value { color: #1e293b; font-weight: 600; text-align: left; word-break: break-word; }
.t-ltr { direction: ltr; unicode-bidi: isolate; }
.t-foot {
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    text-align: center;
    padding: 7px;
    border-radius: 0 0 22px 22px;
}

.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.scan-body { background: #0f172a; color: #fff; min-height: 100vh; }
.scan-container { max-width: 480px; margin: 0 auto; padding: 1rem; }
.scan-result { border-radius: 16px; padding: 1.5rem; text-align: center; margin-top: 1rem; }
.scan-result.success { background: #065f46; }
.scan-result.warning { background: #92400e; }
.scan-result.error { background: #991b1b; }
#qr-reader { border-radius: 12px; overflow: hidden; }

@media print {
    body * { visibility: hidden; }
    .tickets-grid, .tickets-grid * { visibility: visible; }
    .tickets-grid { position: absolute; left: 0; top: 0; }
    .ticket-compact { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
}

.config-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.provider-badge {
    display: inline-block;
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
}

.provider-badge.active { background: #dcfce7; color: #166534; }
.provider-badge.inactive { background: #f1f5f9; color: #64748b; }
