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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #06b6d4;
  --info-light: #cffafe;
  --dark: #0f172a;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;
  --body-bg: #f1f5f9;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --card-shadow-hover: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: #1e293b;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ========== LAYOUT ========== */
.page { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-row {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.content {
  padding: 24px 32px;
  flex: 1;
}

/* ========== SIDEBAR ========== */
.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand .brand {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .brand-logo {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav .nav-item { padding: 2px 12px; }

.sidebar-nav .nav-link {
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: rgba(37,99,235,.15);
  color: var(--primary);
}

.sidebar-nav .nav-link .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: .7;
}

.sidebar-nav .nav-link.active .nav-icon { opacity: 1; }

.sidebar-nav .nav-section {
  padding: 16px 24px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(148,163,184,.4);
}

/* ========== HEADER TOPBAR ========== */
.top-row .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-row .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.top-row .user-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
}

/* ========== CARDS ========== */
.card {
  background: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: box-shadow .2s;
}

.card:hover { box-shadow: var(--card-shadow-hover); }

.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 14px;
  color: #475569;
}

.card-body { padding: 20px; }

/* ========== STAT CARDS ========== */
.stat-card {
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 48px;
  opacity: .15;
}

.stat-card .stat-label {
  font-size: 13px;
  font-weight: 500;
  opacity: .85;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-card .stat-sub {
  font-size: 12px;
  opacity: .7;
  margin-top: 2px;
}

.stat-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-success { background: linear-gradient(135deg, #10b981, #059669); }
.stat-info { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ========== TABLES ========== */
.table {
  margin-bottom: 0;
  font-size: 13px;
}

.table thead th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--secondary);
  border-bottom: 2px solid #e2e8f0;
  padding: 12px 16px;
  background: #f8fafc;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover { background: #f8fafc; }

.table-striped tbody tr:nth-of-type(odd) { background: #fafbfc; }

/* ========== FORMS ========== */
.form-control, .form-select {
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  transition: all .2s;
  background: #fff;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-label {
  font-weight: 500;
  font-size: 13px;
  color: #475569;
  margin-bottom: 6px;
}

/* ========== BUTTONS ========== */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 20px;
  transition: all .2s;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-outline-primary { border: 1.5px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-secondary { border: 1.5px solid #e2e8f0; color: var(--secondary); }
.btn-outline-secondary:hover { background: #f1f5f9; color: #1e293b; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ========== BADGES ========== */
.badge {
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.badge.bg-success { background: var(--success-light) !important; color: #065f46; }
.badge.bg-danger { background: var(--danger-light) !important; color: #991b1b; }
.badge.bg-warning { background: var(--warning-light) !important; color: #92400e; }
.badge.bg-info { background: var(--info-light) !important; color: #155e75; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #475569; }

/* ========== LOGIN ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  padding: 40px;
}

.login-card .login-logo {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 16px;
}

.login-card h3 {
  text-align: center;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.login-card .login-sub {
  text-align: center;
  color: var(--secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ========== MISC ========== */
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 20px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

.alert {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.alert-success { background: var(--success-light); color: #065f46; }
.alert-danger { background: var(--danger-light); color: #991b1b; }
.alert-info { background: #eff6ff; color: #1e40af; }
.alert-warning { background: var(--warning-light); color: #92400e; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: fixed;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .3s;
  }
  .sidebar.open { transform: translateX(0); }

  main { margin-left: 0; }

  .top-row { padding: 0 16px; }

  .content { padding: 16px; }

  .stat-card .stat-value { font-size: 22px; }

  .login-card { padding: 24px; }

  .mobile-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--dark);
    font-size: 24px;
    cursor: pointer;
    margin-right: auto;
  }
}

.mobile-toggle { display: none; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1030;
}
.overlay.show { display: block; }

@media (min-width: 769px) {
  .overlay { display: none !important; }
}

/* ========== TICKET PRINT ========== */
@media print {
  body { background: #fff; margin: 0; padding: 0; }
  .no-print { display: none !important; }
}

/* ========== BLZOR ERROR ========== */
#blazor-error-ui {
  background: var(--danger);
  color: #fff;
  bottom: 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,.2);
  display: none;
  left: 0;
  padding: 12px 16px;
  position: fixed;
  right: 0;
  z-index: 9999;
  font-size: 14px;
}
#blazor-error-ui .reload {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  margin-left: auto;
  white-space: nowrap;
}
#blazor-error-ui .dismiss {
  cursor: pointer;
  font-size: 18px;
  opacity: .8;
}
#blazor-error-ui .dismiss:hover { opacity: 1; }
#components-reconnect-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  background: rgba(15,23,42,.8);
  display: flex;
  align-items: center;
  justify-content: center;
}
#components-reconnect-modal .reconnect-content {
  background: #fff;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.3);
}
#components-reconnect-modal .reconnect-content h4 { font-weight: 700; margin-bottom: 8px; }
#components-reconnect-modal .reconnect-content p { color: var(--secondary); font-size: 14px; margin-bottom: 0; }
