/* ============================================================
   TICKETSCAN PRO — MAIN STYLESHEET
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card2: #162032;
  --border: rgba(148,163,184,0.12);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── AUTH ── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: hidden; }
.auth-bg { position: fixed; inset: 0; background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,.18) 0%, transparent 60%), radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.15) 0%, transparent 50%), var(--bg); z-index: 0; }
.auth-container { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 20px; }
.auth-card { padding: 40px; }
.glass-card {
  background: rgba(30,41,59,0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px rgba(99,102,241,.1);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { display: inline-flex; margin-bottom: 12px; filter: drop-shadow(0 4px 16px rgba(99,102,241,.4)); }
.logo-title { font-size: 24px; font-weight: 800; background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 12px; }
.auth-footer strong { color: var(--primary-light); }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-sub); pointer-events: none; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: rgba(15,23,42,.6); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: inherit; font-size: 14px;
  padding: 12px 14px 12px 44px; transition: var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.form-select, .form-textarea { padding-left: 14px; }
.form-textarea { resize: vertical; min-height: 90px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border: none; border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.4); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.5); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,.3); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(99,102,241,.1); color: var(--primary-light); border-color: var(--primary); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { padding: 8px; min-width: 36px; justify-content: center; }

/* ── ALERTS ── */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; }
.alert-info { background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; }

/* ── APP LAYOUT ── */
.app-body { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: 260px; min-width: 260px; background: var(--bg-card2);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  transition: var(--transition); overflow: hidden; z-index: 100;
}
.sidebar.collapsed { width: 72px; min-width: 72px; }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed span:not(.nav-badge),
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }

.sidebar-header { padding: 20px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-title { font-size: 15px; font-weight: 800; background: linear-gradient(135deg, #fff, var(--primary-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; white-space: nowrap; }
.sidebar-toggle { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; transition: var(--transition); }
.sidebar-toggle:hover { background: rgba(99,102,241,.15); color: var(--primary-light); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav-section { margin-bottom: 8px; }
.nav-label { display: block; font-size: 10px; font-weight: 700; color: var(--text-sub); letter-spacing: .08em; padding: 10px 8px 6px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 500; transition: var(--transition); margin-bottom: 2px; white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: rgba(99,102,241,.1); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(99,102,241,.25), rgba(139,92,246,.15)); color: var(--primary-light); border: 1px solid rgba(99,102,241,.2); }
.nav-item svg { min-width: 20px; }
.nav-badge { margin-left: auto; }
.live-badge-sm { background: var(--success); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 20px; letter-spacing: .05em; }

.sidebar-footer { padding: 14px 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar, .user-avatar-sm {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.user-details { overflow: hidden; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: var(--text-muted); }
.logout-btn { background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 8px; border-radius: 8px; cursor: pointer; transition: var(--transition); display: flex; text-decoration: none; flex-shrink: 0; }
.logout-btn:hover { background: rgba(239,68,68,.1); border-color: var(--danger); color: #fca5a5; }

/* ── MAIN CONTENT ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── TOPBAR ── */
.topbar {
  height: 64px; background: var(--bg-card2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; flex-shrink: 0;
}
.topbar-toggle { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; display: none; }
.topbar-breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.breadcrumb-current { color: var(--text); font-weight: 600; text-transform: capitalize; }
.breadcrumb-sep { color: var(--text-sub); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── PAGE CONTENT ── */
.page-content { flex: 1; overflow-y: auto; padding: 24px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.live-badge { display: flex; align-items: center; gap: 6px; background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{ opacity:1; transform:scale(1); } 50%{ opacity:.5; transform:scale(1.3); } }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; right: 0; width: 80px; height: 80px; border-radius: 50%; opacity: 0.08; transform: translate(20px, -20px); }
.stat-total::before { background: var(--primary); }
.stat-created::before { background: var(--warning); }
.stat-checkin::before { background: var(--success); }
.stat-keluar::before { background: var(--accent); }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(99,102,241,.3); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-total .stat-icon { background: rgba(99,102,241,.15); color: var(--primary-light); }
.stat-created .stat-icon { background: rgba(245,158,11,.15); color: #fcd34d; }
.stat-checkin .stat-icon { background: rgba(16,185,129,.15); color: #6ee7b7; }
.stat-keluar .stat-icon { background: rgba(6,182,212,.15); color: #67e8f9; }
.stat-info { flex: 1; }
.stat-value { display: block; font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: 11px; color: var(--text-sub); margin-top: 4px; }

/* ── CARDS ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body { padding: 20px; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid rgba(148,163,184,.06); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(99,102,241,.04); }
.empty-state { text-align: center; color: var(--text-sub); padding: 40px !important; }
.text-muted { color: var(--text-muted) !important; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-primary { background: rgba(99,102,241,.15); color: var(--primary-light); }
.code-badge { font-family: monospace; font-size: 12px; font-weight: 700; background: rgba(99,102,241,.12); color: var(--primary-light); padding: 3px 8px; border-radius: 6px; letter-spacing: .05em; }
.status-badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.status-created { background: rgba(245,158,11,.12); color: #fcd34d; border: 1px solid rgba(245,158,11,.2); }
.status-checkin { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.2); }
.status-keluar { background: rgba(6,182,212,.12); color: #67e8f9; border: 1px solid rgba(6,182,212,.2); }
.status-cancelled { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.status-expired { background: rgba(100,116,139,.12); color: var(--text-sub); border: 1px solid rgba(100,116,139,.2); }
.status-verify { background: rgba(99,102,241,.12); color: var(--primary-light); border: 1px solid rgba(99,102,241,.2); }

/* ── ACTIVITY / EVENTS ── */
.activity-stats { display: flex; gap: 20px; margin-bottom: 20px; }
.act-item { display: flex; align-items: center; gap: 14px; flex: 1; background: rgba(15,23,42,.4); border-radius: 12px; padding: 14px; border: 1px solid var(--border); }
.act-circle { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.act-scan { background: rgba(99,102,241,.15); color: var(--primary-light); }
.act-checkin { background: rgba(16,185,129,.15); color: #6ee7b7; }
.act-value { display: block; font-size: 22px; font-weight: 800; }
.act-label { display: block; font-size: 11px; color: var(--text-muted); }

.event-item { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.event-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.event-name { font-size: 13px; font-weight: 600; color: var(--text); }
.event-pct { font-size: 13px; font-weight: 700; color: var(--primary-light); }
.event-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.progress-bar { height: 6px; background: rgba(99,102,241,.1); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 3px; transition: width 0.6s ease; }

.chart-area { height: 150px; }

/* ── FILTERS ── */
.filters-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box input { padding-left: 40px; background: var(--bg-card); border-color: var(--border); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-sub); }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: var(--transition); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; transform: translateY(20px); transition: var(--transition); box-shadow: var(--shadow); }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; transition: var(--transition); }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.05); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── QR CODE ── */
.qr-container { text-align: center; padding: 20px; }
.qr-wrapper { display: inline-block; background: #fff; padding: 16px; border-radius: 12px; margin-bottom: 12px; }
.qr-code-text { font-family: monospace; font-size: 18px; font-weight: 800; color: var(--primary-light); letter-spacing: .1em; }

/* ── LIVE MONITOR ── */
.live-feed { display: flex; flex-direction: column; gap: 8px; max-height: 500px; overflow-y: auto; }
.feed-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: rgba(15,23,42,.5); border-radius: 10px; border: 1px solid var(--border); animation: slideIn .3s ease; }
@keyframes slideIn { from { opacity:0; transform:translateX(-10px); } to { opacity:1; transform:translateX(0); } }
.feed-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feed-checkin { background: rgba(16,185,129,.15); color: #6ee7b7; }
.feed-keluar { background: rgba(6,182,212,.15); color: #67e8f9; }
.feed-verify { background: rgba(99,102,241,.15); color: var(--primary-light); }
.feed-cancelled { background: rgba(239,68,68,.15); color: #fca5a5; }
.feed-info { flex: 1; }
.feed-code { font-family: monospace; font-size: 13px; font-weight: 700; color: var(--text); }
.feed-name { font-size: 12px; color: var(--text-muted); }
.feed-time { font-size: 11px; color: var(--text-sub); white-space: nowrap; }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; justify-content: between; gap: 6px; margin-top: 16px; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; transition: var(--transition); }
.pagination a { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); }
.pagination a:hover { background: rgba(99,102,241,.1); border-color: var(--primary); color: var(--primary-light); }
.pagination .active { background: var(--primary); border: 1px solid var(--primary); color: #fff; }
.page-info { color: var(--text-muted); font-size: 12px; margin-left: auto; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: -260px; height: 100vh; transition: left .3s ease; }
  .sidebar.mobile-open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,.5); }
  .topbar-toggle { display: flex; }
  .grid-2col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .activity-stats { flex-direction: column; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .search-box { width: 100%; }
}
