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

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #dbeafe;
  --accent: #059669;
  --accent-light: #d1fae5;
  --danger: #dc2626;
  --warning: #d97706;
  --muted: #64748b;
  --text: #0f172a;
  --text-secondary: #475569;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(37, 99, 235, 0.2);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
.page-title { font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.page-subtitle { color: var(--muted); font-size: 0.875rem; }

/* ── Cards ── */
.card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.card-header-custom {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.card-body { padding: 1.5rem; }

/* ── Stat cards ── */
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.stat-card .stat-label { font-size: 0.8125rem; color: var(--muted); font-weight: 500; }

/* ── Buttons ── */
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn { border-radius: 8px; font-size: 0.875rem; }
.btn-lg { padding: 0.625rem 1.25rem; }

/* ── Badges ── */
.badge-soft { background: var(--brand-light); color: var(--brand); border: 1px solid rgba(37, 99, 235, 0.2); font-weight: 500; }
.badge-status-confirmed { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-status-cancelled { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-coach-ac { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-coach-sl { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ── Tables ── */
.table { margin-bottom: 0; }
.table thead th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.875rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafc; }

/* ── Forms ── */
.form-label { font-weight: 500; font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.375rem; }
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── Hero (landing) ── */
.hero {
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(37, 99, 235, 0.25), transparent 60%),
    radial-gradient(900px 500px at 90% 30%, rgba(5, 150, 105, 0.18), transparent 55%),
    var(--sidebar-bg);
  color: #fff;
  border-radius: var(--radius-lg);
}
.hero .lead { color: rgba(255, 255, 255, 0.78); }

/* ── Public navbar ── */
.navbar-brand { font-weight: 700; letter-spacing: -0.02em; }
.navbar-dark { background: var(--sidebar-bg) !important; }

/* ── User panel layout ── */
.panel-wrapper { min-height: 100vh; }

.panel-sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}
.panel-sidebar .sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-sidebar .sidebar-brand .brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}
.panel-sidebar .sidebar-brand .brand-tag {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.panel-sidebar .sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-sidebar .sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.875rem;
  flex-shrink: 0;
}
.panel-sidebar .sidebar-user .user-name { color: #fff; font-weight: 600; font-size: 0.875rem; }
.panel-sidebar .sidebar-user .user-role { color: rgba(255, 255, 255, 0.45); font-size: 0.75rem; }

.panel-sidebar nav { padding: 0.75rem; flex: 1; overflow-y: auto; }
.panel-sidebar nav .nav-section {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 0.75rem 0.75rem 0.375rem;
}
.panel-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.5625rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.panel-sidebar nav a i { font-size: 1.125rem; opacity: 0.7; }
.panel-sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
.panel-sidebar nav a.active { background: var(--sidebar-active); color: #fff; }
.panel-sidebar nav a.active i { opacity: 1; color: #60a5fa; }

.panel-sidebar .sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-sidebar .sidebar-footer a + a { margin-top: 0.125rem; }
.panel-sidebar .sidebar-footer a {
  display: flex; align-items: center; gap: 0.625rem;
  color: rgba(255, 255, 255, 0.55);
  padding: 0.5625rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}
.panel-sidebar .sidebar-footer a:hover { background: rgba(220, 38, 38, 0.15); color: #fca5a5; }

.panel-main {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.panel-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.panel-content { padding: 1.5rem; flex: 1; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1035;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}
.empty-state i { font-size: 2.5rem; color: #cbd5e1; margin-bottom: 1rem; display: block; }
.empty-state h5 { font-weight: 600; color: var(--text); }
.empty-state p { color: var(--muted); font-size: 0.875rem; max-width: 360px; margin: 0.5rem auto 1.25rem; }

/* ── Ticket card ── */
.ticket-card {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ticket-card .ticket-header {
  background: linear-gradient(135deg, var(--sidebar-bg), #1e293b);
  color: #fff;
  padding: 1.5rem;
}
.ticket-card .ticket-body { padding: 1.5rem; }
.ticket-card .ticket-divider {
  border-top: 2px dashed var(--border);
  margin: 0;
  position: relative;
}
.ticket-detail-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.ticket-detail-value { font-weight: 600; font-size: 0.9375rem; }

/* ── Passenger row in booking form ── */
.passenger-row {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.passenger-row .passenger-num {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}

/* ── Availability bar ── */
.availability-bar {
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}
.availability-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.availability-bar .fill.high { background: #22c55e; }
.availability-bar .fill.medium { background: #f59e0b; }
.availability-bar .fill.low { background: #ef4444; }

/* ── Auth pages ── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
}
.auth-brand-panel {
  flex: 1;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1e3a5f 100%);
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-brand-panel h2 { font-weight: 700; letter-spacing: -0.02em; }
.auth-brand-panel .feature-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  margin-bottom: 1rem;
}
.auth-brand-panel .feature-item i {
  font-size: 1.25rem;
  color: #60a5fa;
  margin-top: 2px;
}
.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  max-width: 520px;
}
@media (max-width: 991px) {
  .auth-brand-panel { display: none; }
  .auth-form-panel { max-width: 100%; }
}

/* ── Train card (grid view) ── */
.train-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: var(--surface);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.train-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; }
.train-card .train-no { font-weight: 700; font-size: 1rem; }
.train-card .train-name { color: var(--muted); font-size: 0.8125rem; }

/* ── Profile ── */
.profile-avatar-lg {
  width: 72px; height: 72px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; font-weight: 700;
}

/* ── Print ── */
@media print {
  .panel-sidebar, .panel-topbar, .no-print, .sidebar-overlay { display: none !important; }
  .panel-main { margin-left: 0 !important; }
  .panel-content { padding: 0 !important; }
  body { background: #fff; }
  .ticket-card { border: 2px solid #000; }
}

/* ── Mobile sidebar ── */
@media (max-width: 991.98px) {
  .panel-sidebar { transform: translateX(-100%); }
  .panel-sidebar.show { transform: translateX(0); }
  .panel-main { margin-left: 0; }
  .sidebar-overlay.show { display: block; }
}

/* ── Admin panel accent ── */
.panel-sidebar.admin-sidebar { background: #1a1f2e; }
.panel-sidebar.admin-sidebar nav a.active { background: rgba(245, 158, 11, 0.18); }
.panel-sidebar.admin-sidebar nav a.active i { color: #fbbf24; }
.panel-sidebar.admin-sidebar .sidebar-user .avatar.admin-avatar { background: #d97706; }
.stat-card .stat-icon.admin-icon { background: #fffbeb; color: #d97706; }
.badge-admin { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; font-weight: 500; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
