/* ============================================================
   TheBookFlight — B2B Agent Portal Design System
   Premium Dark Theme · Glassmorphism · Inter + Space Grotesk
   ============================================================ */

/* ── Reset & Variables ── */
:root {
  --bg-body: #060a14;
  --bg-primary: #0a0e1a;
  --bg-card: #111827;
  --bg-card-hover: #151d2e;
  --bg-sidebar: #0d1321;
  --bg-input: #0f172a;
  --bg-elevated: #1e293b;
  --accent: var(--accent-primary);
  --accent-hover: #ff1a3a;
  --accent-glow: rgba(208, 2, 27, 0.25);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.08);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.08);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(148, 163, 184, 0.08);
  --border-light: rgba(148, 163, 184, 0.12);
  --glass: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 260px;
  --header-height: 64px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Layout ── */
.b2b-layout {
  display: flex;
  min-height: 100vh;
}
.b2b-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-width: 0;
}
.b2b-content {
  padding: 28px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ═══ SIDEBAR ═══ */
.b2b-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--transition);
}
.b2b-sidebar__brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.b2b-sidebar__logo-img { height: 32px; filter: brightness(0) invert(1); }
.b2b-sidebar__brand-name { font-size: 15px; font-weight: 800; color: #fff; display: block; }
.b2b-sidebar__brand-tag {
  font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase;
  letter-spacing: 1.5px; display: block; margin-top: 2px;
}
.b2b-sidebar__close {
  display: none; margin-left: auto; background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px;
}

.b2b-sidebar__nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.b2b-sidebar__section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); padding: 16px 16px 8px; margin-top: 4px;
}
.b2b-sidebar__section-label:first-child { margin-top: 0; }

.b2b-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--radius-md);
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; font-weight: 500; transition: all var(--transition);
  position: relative;
}
.b2b-nav-item i { font-size: 18px; width: 20px; text-align: center; }
.b2b-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.b2b-nav-item.active {
  background: linear-gradient(135deg, rgba(208,2,27,0.15), rgba(255,56,92,0.08));
  color: #fff; font-weight: 600;
  border: 1px solid rgba(208,2,27,0.2);
}
.b2b-nav-item.active i { color: var(--accent); }
.b2b-nav-badge {
  margin-left: auto; background: rgba(16,185,129,0.12); color: var(--success);
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.b2b-sidebar__footer {
  padding: 16px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.b2b-sidebar__agent { display: flex; align-items: center; gap: 10px; }
.b2b-sidebar__avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff385c);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
}
.b2b-sidebar__agent-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.b2b-sidebar__agent-role { font-size: 11px; color: var(--text-muted); }
.b2b-sidebar__logout {
  color: var(--text-muted); font-size: 18px; padding: 8px; border-radius: 8px;
  transition: all var(--transition); text-decoration: none;
}
.b2b-sidebar__logout:hover { color: var(--danger); background: var(--danger-bg); }

/* ═══ HEADER ═══ */
.b2b-header {
  position: fixed; top: 0; left: var(--sidebar-width); right: 0; height: var(--header-height);
  background: rgba(10, 14, 26, 0.85); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border); z-index: 150;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.b2b-header__left { display: flex; align-items: center; gap: 16px; }
.b2b-header__hamburger {
  display: none; background: none; border: none; color: var(--text-secondary);
  font-size: 22px; cursor: pointer; padding: 6px;
}
.b2b-header__page-title {
  font-size: 18px; font-weight: 800; color: #fff;
  font-family: 'Space Grotesk', sans-serif;
}
.b2b-header__right { display: flex; align-items: center; gap: 12px; }
.b2b-header__action {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 18px; text-decoration: none;
  transition: all var(--transition); background: var(--glass);
  border: 1px solid var(--glass-border);
}
.b2b-header__action:hover { background: rgba(255,255,255,0.06); color: #fff; }
.b2b-header__wallet {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: var(--success-bg); border: 1px solid rgba(16,185,129,0.15);
  border-radius: 10px; color: var(--success); font-size: 13px; font-weight: 700;
  text-decoration: none; transition: all var(--transition);
  font-family: 'JetBrains Mono', monospace;
}
.b2b-header__wallet:hover { background: rgba(16,185,129,0.15); }
.b2b-header__wallet i { font-size: 16px; }
.b2b-header__avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff385c);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; cursor: pointer;
}

/* ═══ CARDS ═══ */
.b2b-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}
.b2b-card:hover { border-color: var(--border-light); }
.b2b-card__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.b2b-card__title {
  font-size: 16px; font-weight: 800; color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  display: flex; align-items: center; gap: 8px;
}
.b2b-card__title i { font-size: 20px; color: var(--accent); }

/* ── Stats Cards ── */
.b2b-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.b2b-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px 24px; position: relative; overflow: hidden;
  transition: all var(--transition);
}
.b2b-stat:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.b2b-stat__icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 16px;
}
.b2b-stat__icon--blue { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59,130,246,0.15); }
.b2b-stat__icon--green { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.15); }
.b2b-stat__icon--amber { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.15); }
.b2b-stat__icon--red { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.b2b-stat__label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.b2b-stat__value {
  font-size: 28px; font-weight: 900; color: #fff; margin: 6px 0 4px;
  font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.5px;
}
.b2b-stat__change { font-size: 12px; font-weight: 600; }
.b2b-stat__change--up { color: var(--success); }
.b2b-stat__change--down { color: var(--danger); }
.b2b-stat__glow {
  position: absolute; top: -40px; right: -40px; width: 100px; height: 100px;
  border-radius: 50%; filter: blur(40px); opacity: 0.15;
}

/* ── Tables ── */
.b2b-table-wrap { overflow-x: auto; }
.b2b-table { width: 100%; border-collapse: collapse; }
.b2b-table th {
  text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.b2b-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary); white-space: nowrap;
}
.b2b-table tr:hover td { background: rgba(255,255,255,0.02); color: var(--text-primary); }
.b2b-table tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.b2b-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.b2b-badge--success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.15); }
.b2b-badge--warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.15); }
.b2b-badge--danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.b2b-badge--info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59,130,246,0.15); }
.b2b-badge--neutral { background: rgba(148,163,184,0.08); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Buttons ── */
.b2b-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-md); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all var(--transition); border: none;
  font-family: 'Inter', sans-serif; text-decoration: none; white-space: nowrap;
}
.b2b-btn--primary {
  background: linear-gradient(135deg, var(--accent), #ff385c); color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.b2b-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--accent-glow); }
.b2b-btn--secondary {
  background: rgba(255,255,255,0.04); color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.b2b-btn--secondary:hover { background: rgba(255,255,255,0.08); color: #fff; }
.b2b-btn--success { background: var(--success); color: #fff; }
.b2b-btn--sm { padding: 8px 16px; font-size: 12px; border-radius: var(--radius-sm); }
.b2b-btn--block { width: 100%; }
.b2b-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ── */
.b2b-form-group { margin-bottom: 20px; }
.b2b-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.b2b-label {
  display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.b2b-input {
  width: 100%; padding: 12px 16px; background: var(--bg-input);
  border: 1px solid var(--border-light); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 14px; font-family: 'Inter', sans-serif;
  transition: all var(--transition); outline: none;
}
.b2b-input::placeholder { color: var(--text-muted); }
.b2b-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.b2b-input--icon {
  position: relative;
}
.b2b-input--icon i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 16px;
}
.b2b-input--icon input { padding-left: 42px; }

.b2b-error { color: var(--danger); font-size: 12px; font-weight: 600; margin-top: 6px; display: none; }

/* ── Quick Actions Grid ── */
.b2b-quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.b2b-quick-action {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  text-decoration: none; transition: all var(--transition); cursor: pointer;
}
.b2b-quick-action:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.b2b-quick-action__icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0;
}
.b2b-quick-action__text { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.b2b-quick-action__sub { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ── Empty State ── */
.b2b-empty {
  text-align: center; padding: 48px 24px;
}
.b2b-empty__icon { font-size: 48px; color: var(--text-muted); margin-bottom: 16px; opacity: 0.4; }
.b2b-empty__title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.b2b-empty__text { font-size: 13px; color: var(--text-muted); max-width: 400px; margin: 0 auto 20px; }

/* ── Toast / Alert ── */
.b2b-toast {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  padding: 14px 20px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-elevated);
  animation: toastSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.b2b-toast--success { background: #065f46; color: #a7f3d0; border: 1px solid rgba(16,185,129,0.3); }
.b2b-toast--error { background: #7f1d1d; color: #fecaca; border: 1px solid rgba(239,68,68,0.3); }
@keyframes toastSlideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ═══ MOBILE RESPONSIVE ═══ */
@media (max-width: 1024px) {
  .b2b-stats { grid-template-columns: repeat(2, 1fr); }
  .b2b-quick-actions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .b2b-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-elevated);
  }
  .b2b-sidebar.open { transform: translateX(0); }
  .b2b-sidebar__close { display: block; }
  .b2b-main { margin-left: 0; }
  .b2b-header { left: 0; }
  .b2b-header__hamburger { display: flex; }
  .b2b-content { padding: 20px 16px; }
  .b2b-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .b2b-stat__value { font-size: 22px; }
  .b2b-quick-actions { grid-template-columns: 1fr; }
  .b2b-form-row { grid-template-columns: 1fr; }
  .b2b-card { padding: 18px; }
}
@media (max-width: 480px) {
  .b2b-stats { grid-template-columns: 1fr; }
  .b2b-header__wallet span { display: none; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.25); }

/* ── Utilities ── */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.fw-900 { font-weight: 900 !important; }
.font-mono { font-family: 'JetBrains Mono', 'SF Mono', monospace !important; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.gap-12 { gap: 12px; }
