/* Flight Ticket System - Premium UI */

:root {
  --primary: #0f172a;
  --primary-600: #1e293b;
  --primary-500: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #dbeafe;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --gold: #f59e0b;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.1), 0 4px 16px rgba(0,0,0,.06);
  --transition: all .2s cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Login ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #2563eb 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,.2) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  border-radius: 50%;
}

.login-wrapper { width: 100%; max-width: 400px; padding: 24px; }

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
}

.login-header {
  background: linear-gradient(135deg, var(--primary) 0%, #1e3a5f 100%);
  color: var(--white);
  padding: 32px 28px;
  text-align: center;
}
.login-brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 16px rgba(59,130,246,.3);
}
.login-header h1 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.login-header p { margin: 0; font-size: .85rem; opacity: .6; font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }
.login-form { padding: 32px 28px; }
.login-footer-text {
  text-align: center;
  font-size: .78rem;
  color: rgba(255,255,255,.35);
  margin-top: 24px;
}

/* ─── Selection & Placeholder ─── */
::selection { background: var(--accent-light); color: var(--accent-hover); }
::placeholder { color: var(--gray-400); font-weight: 400; }
input::placeholder { color: var(--gray-400); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Form Elements ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

input[readonly] {
  background: var(--gray-50);
  color: var(--gray-700);
  cursor: default;
  border-style: dashed;
}
.auto-fill-row .form-group label { color: var(--gray-400); }

.form-hint { display: block; margin-top: 4px; font-size: .78rem; color: var(--gray-400); }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; font-weight: 500; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  letter-spacing: -.01em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(59, 130, 246, .3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, .4);
}
.btn-block { width: 100%; margin-top: 8px; }
.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,.4);
}
.btn-outline:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.7); }
.btn-secondary {
  background: var(--gray-600);
  color: var(--white);
}
.btn-secondary:hover { background: var(--gray-700); }
.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
  padding: 7px 14px;
  font-size: .85rem;
  font-weight: 500;
  font-family: var(--font);
  margin-top: 6px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-outline-sm:hover { background: var(--gray-50); border-color: var(--accent); color: var(--accent); }

.form-group-btn label { visibility: hidden; }
.form-group-btn .btn { width: 100%; }

.total-input { font-weight: 800; font-size: 1.15rem; color: var(--accent); }

/* ─── Passengers ─── */
.passenger-row {
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.passenger-row select {
  width: 90px;
  flex-shrink: 0;
  padding: 10px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  background: var(--white);
}
.passenger-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: var(--font);
}
.passenger-row input.passenger-dob { flex: 0 1 160px; font-size: .9rem; }
.passenger-row input:focus,
.passenger-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ═══════════════════════════════════════════
   Dashboard Layout
   ═══════════════════════════════════════════ */
.dashboard-page { min-height: 100vh; background: var(--gray-100); }

/* ─── Header ─── */
.dashboard-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #1e40af 100%);
  color: var(--white);
  padding: 0 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(59,130,246,.3);
}
.brand-text h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.brand-tagline {
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: var(--transition);
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-icon { font-size: .9rem; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: rgba(255,255,255,.08);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.1);
}
.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--white);
}
.user-name { font-size: .85rem; color: rgba(255,255,255,.85); font-weight: 500; }
.btn-logout {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.12);
  padding: 7px 16px;
  font-size: .82rem;
  border-radius: 8px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.3); }

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: var(--white);
  text-decoration: none;
  font-size: 1rem;
  transition: var(--transition);
}
.back-btn:hover { background: rgba(255,255,255,.2); }

/* ─── Main ─── */
.dashboard-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}
.edit-main { max-width: 720px; }
.edit-main .panel { margin-bottom: 24px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 28px;
}

/* ─── Panels ─── */
.panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  transition: box-shadow .3s ease;
}
.panel:hover { box-shadow: var(--shadow-lg); }
.panel h2 {
  margin: 0;
  padding: 18px 22px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-200);
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-panel {
  align-self: start;
  position: sticky;
  top: 92px;
}

/* ─── Form ─── */
.ticket-form { padding: 22px; }
.form-row { margin-bottom: 14px; }
.form-row.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.form-actions {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.section-label {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 10px;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.checkbox-group { display: flex; flex-wrap: wrap; gap: 14px 24px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
}
.checkbox-label:hover { color: var(--gray-800); }
.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  border-radius: 4px;
}

.download-link-wrap {
  padding: 14px 16px;
  background: var(--accent-light);
  border-radius: var(--radius);
  font-size: .9rem;
  border: 1px solid rgba(59,130,246,.15);
}
.download-link-wrap a { color: var(--accent); font-weight: 600; }

/* ─── Live Preview ─── */
.live-preview {
  padding: 20px;
  background: var(--gray-50);
}
.boarding-pass {
  max-width: 420px;
  margin: 0 auto 20px;
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.bp-banner {
  color: var(--white);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 48px;
}
.bp-banner-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; }
.bp-banner-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.bp-logo-img { height: 36px; width: auto; max-width: 120px; object-fit: contain; }
.bp-logo-fallback { font-size: 1.6rem; opacity: .95; }
.bp-logo-fallback.hidden { display: none; }
.bp-airline { font-size: 1rem; flex: 1; }
.bp-slogan { font-size: .85rem; font-style: italic; opacity: .9; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.5); }
.bp-flight { font-size: 1.1rem; font-weight: 700; letter-spacing: .05em; }
.bp-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; }
.bp-col {
  padding: 10px 12px;
  border-right: 1px dashed var(--gray-200);
  border-bottom: 1px dashed var(--gray-200);
  min-height: 52px;
}
.bp-col:nth-child(3n) { border-right: none; }
.bp-label { display: block; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); margin-bottom: 2px; }
.bp-value, .bp-code { font-size: .9rem; font-weight: 600; color: var(--gray-800); }
.bp-city { font-size: .75rem; color: var(--gray-500); }
.bp-qr-wrap { grid-column: span 3; padding: 12px; text-align: center; border-right: none; border-bottom: none; }
.qrcode-preview { display: inline-block; margin-top: 6px; padding: 6px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; }
.qrcode-preview canvas, .qrcode-preview img { display: block; max-width: 100px; height: auto; }
.bp-footer { background: var(--gray-50); padding: 8px 16px; font-size: .8rem; font-weight: 600; color: var(--gray-500); letter-spacing: .03em; }

/* ─── Agency & Invoice Preview ─── */
.agency-preview, .invoice-preview {
  max-width: 420px;
  margin: 12px auto 0;
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--gray-50);
  font-size: .9rem;
  font-weight: 700;
  border-bottom: 1px solid var(--gray-200);
}
.inv-table { padding: 12px 16px; }
.inv-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--gray-100);
}
.inv-row:last-child { border-bottom: none; }
.inv-row.total {
  font-weight: 700;
  font-size: 1rem;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 2px solid var(--accent);
  color: var(--accent);
}

/* ─── Sales History Table ─── */
.recent-panel { }
.recent-panel .recent-table-wrap { overflow-x: auto; }
.recent-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.recent-table th,
.recent-table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}
.recent-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-500);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.recent-table code {
  font-size: .82em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.recent-table .empty {
  color: var(--gray-400);
  font-style: italic;
  text-align: center;
  padding: 32px;
}
.recent-table tbody tr { transition: var(--transition); }
.recent-table tbody tr:hover { background: var(--gray-50); }

.ticket-actions { white-space: nowrap; }
.ticket-actions .btn-link {
  display: inline-flex;
  align-items: center;
  font-size: .78rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-right: 4px;
  padding: 5px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  transition: var(--transition);
}
.ticket-actions .btn-link:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}
.ticket-actions .btn-link-wa {
  color: #25d366;
  border-color: #c8f7d8;
}
.ticket-actions .btn-link-wa:hover {
  background: #e8fdf0;
  border-color: #25d366;
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 1000px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}

@media (max-width: 600px) {
  .form-row.two-cols,
  .form-row.three-cols { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dashboard-header { padding: 0 14px; }
  .header-inner { height: 56px; gap: 8px; }
  .header-nav { display: none; }
  .brand-tagline { display: none; }
  .brand-text h1 { font-size: .95rem; }
  .brand-icon { width: 32px; height: 32px; font-size: 1rem; }
  .user-badge { display: none; }
  .btn-logout { font-size: .78rem; padding: 6px 12px; }
  .dashboard-main { padding: 14px; }
  .dashboard-grid { gap: 16px; margin-bottom: 16px; }
  .panel h2 { padding: 14px 16px; font-size: .95rem; }
  .ticket-form { padding: 14px; }
  .form-group label { font-size: .75rem; }
  .form-group input, .form-group select { padding: 9px 12px; font-size: .9rem; }
  .passenger-row { flex-wrap: wrap; }
  .passenger-row select { width: 80px; }
  .passenger-row input { flex: 1 1 100%; }
  .passenger-row input.passenger-dob { flex: 1 1 100%; }
  .form-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .form-actions .btn-primary { width: 100%; }
  .boarding-pass, .invoice-preview, .agency-preview { max-width: 100%; }
  .live-preview { padding: 14px; }
  .recent-table th, .recent-table td { padding: 10px 12px; font-size: .82rem; }
}

@media (max-width: 480px) {
  .dashboard-main { padding: 8px; }
  .ticket-form { padding: 12px; }
  .form-row.two-cols, .form-row.three-cols { grid-template-columns: 1fr; gap: 10px; }
  .form-group-btn label { display: none; }
  .form-group-btn { margin-bottom: 0; }
  .passenger-row select { width: 70px; font-size: .85rem; }
  .bp-banner { padding: 10px 12px; }
  .bp-airline { font-size: .85rem; }
  .bp-slogan { display: none; }
  .bp-body { grid-template-columns: 1fr 1fr; }
  .bp-col { padding: 8px 10px; min-height: 44px; }
  .bp-col:nth-child(3n) { border-right: 1px dashed var(--gray-200); }
  .bp-col:nth-child(2n) { border-right: none; }
  .bp-qr-wrap { grid-column: span 2; }
  .panel h2 { padding: 12px 14px; font-size: .9rem; }
  .checkbox-group { flex-direction: column; gap: 10px; }
  .btn { padding: 10px 16px; font-size: .9rem; }
}
