/* =========================================================================
   FreightPro - Glassmorphism admin theme (Light + Dark)
   ========================================================================= */
:root {
  --bg: #eef1f7;
  --bg2: #dfe6f0;
  --surface: rgba(255,255,255,0.55);
  --surface-solid: #ffffff;
  --surface-strong: rgba(255,255,255,0.85);
  --border: rgba(255,255,255,0.6);
  --border-strong: rgba(30,58,138,0.12);
  --text: #1f2937;
  --text-muted: #64748b;
  --primary: #1e3a8a;
  --primary-2: #3b82f6;
  --accent: #7c3aed;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --shadow: 0 8px 30px rgba(31,45,83,0.12);
  --shadow-sm: 0 2px 10px rgba(31,45,83,0.08);
  --radius: 16px;
  --sidebar-w: 264px;
  --sidebar-bg: rgba(17,24,39,0.06);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg2: #1e293b;
  --surface: rgba(30,41,59,0.55);
  --surface-solid: #1e293b;
  --surface-strong: rgba(30,41,59,0.9);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.1);
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --primary: #60a5fa;
  --primary-2: #38bdf8;
  --accent: #a78bfa;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #22d3ee;
  --shadow: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.35);
  --sidebar-bg: rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }

/* Auth background */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-bg-gradient { background: linear-gradient(135deg,#1e3a8a 0%,#4f46e5 50%,#7c3aed 100%); }
.auth-bg-light { background: linear-gradient(135deg,#e0e7ff,#f5f3ff,#ede9fe); }
.auth-bg-blobs { background: var(--bg); }
[data-theme="dark"] .auth-bg-light { background: linear-gradient(135deg,#0f172a,#1e1b4b); }
.auth-bg { position: absolute; inset: 0; z-index: 0; }
.auth-blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
}
.auth-card {
  position: relative; z-index: 2; width: 100%; max-width: 420px;
  background: var(--surface-strong); backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 34px 32px;
}
.auth-logo { height: 56px; width: 56px; object-fit: contain; border-radius: 14px; }

/* Glass cards */
.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-strong);
  background: transparent; font-weight: 600;
}
.stat-card { transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display:flex; align-items:center; justify-content:center; font-size: 1.3rem; }

/* Sidebar */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg); backdrop-filter: blur(14px);
  border-right: 1px solid var(--border-strong); position: fixed; inset: 0 auto 0 0;
  overflow-y: auto; transition: transform .25s ease; z-index: 1040;
}
.sidebar .nav-link {
  color: var(--text); border-radius: 10px; margin: 1px 10px; padding: .5rem .8rem; font-size: 14px;
  display: flex; align-items: center; gap: .65rem;
}
.sidebar .nav-link:hover { background: rgba(120,120,200,0.12); color: var(--primary-2); }
.sidebar .nav-link.active { background: linear-gradient(90deg, rgba(59,130,246,.25), rgba(124,58,237,.18)); color: var(--primary-2); font-weight:600; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 1.1rem .9rem .35rem; font-weight: 700; }
.sidebar-sub { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.sidebar-sub.open { max-height: 600px; }
.main { flex: 1; margin-left: var(--sidebar-w); padding: 1.25rem; min-width: 0; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1.25rem; margin-bottom: 1.25rem;
  background: var(--surface); backdrop-filter: blur(14px); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.global-search { flex: 1; max-width: 520px; position: relative; }
.global-search input { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { --bs-table-bg: transparent; color: var(--text); margin-bottom: 0; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.table tbody td { vertical-align: middle; border-color: var(--border-strong); }
.table-hover tbody tr:hover { background: rgba(120,120,200,0.06); }

/* Forms */
.form-control, .form-select {
  background: var(--surface-solid); color: var(--text); border-color: var(--border-strong);
  border-radius: 10px;
}
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 .2rem rgba(59,130,246,.15); border-color: var(--primary-2); background: var(--surface-solid); color: var(--text); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--text-muted); }
.input-group-text { background: rgba(120,120,200,.08); border-color: var(--border-strong); color: var(--text); }

/* Buttons */
.btn { border-radius: 10px; }
.btn-primary { background: linear-gradient(135deg,#2563eb,#4f46e5); border: none; }
.btn-primary:hover { background: linear-gradient(135deg,#1d4ed8,#4338ca); }
.btn-glass { background: var(--surface-strong); border: 1px solid var(--border-strong); color: var(--text); backdrop-filter: blur(8px); }
.btn-glass:hover { background: var(--surface-solid); color: var(--primary-2); }
.icon-btn { width: 32px; height: 32px; display:inline-flex; align-items:center; justify-content:center; border-radius:8px; }

/* Badges */
.badge { font-weight: 600; border-radius: 8px; }

/* Pagination */
.pagination .page-link { background: var(--surface-solid); border-color: var(--border-strong); color: var(--text); border-radius: 8px; margin: 0 2px; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color:#fff; }

/* Notifications dropdown */
.notif-list { max-height: 420px; overflow-y:auto; width: 360px; }
.notif-item { display:block; padding: .6rem .9rem; border-bottom:1px solid var(--border-strong); color: var(--text); }
.notif-item:hover { background: rgba(120,120,200,.08); color: var(--text); }
.notif-item.unread { background: rgba(59,130,246,.08); }

/* Result cards (calculators) */
.result-card { background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(124,58,237,.10)); border:1px solid var(--border); border-radius: 14px; padding: 1rem; }
.result-value { font-size: 1.6rem; font-weight: 700; }
.result-label { font-size:.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing:.05em; }

/* Formula box */
.formula-box { background: rgba(120,120,200,.1); border: 1px dashed var(--border-strong); border-radius: 12px; padding: .8rem 1rem; font-family: 'Consolas','Menlo',monospace; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content:''; position:absolute; left:8px; top:4px; bottom:4px; width:2px; background: var(--border-strong); }
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-item::before { content:''; position:absolute; left:-23px; top:5px; width:12px; height:12px; border-radius:50%; background: var(--primary-2); border:2px solid var(--surface-solid); }

/* KPI animation */
.counter { font-variant-numeric: tabular-nums; }

/* Bulk bar */
.bulk-bar { position: sticky; bottom: 12px; background: var(--surface-strong); backdrop-filter: blur(14px); border:1px solid var(--border); border-radius: 14px; padding: .6rem .9rem; box-shadow: var(--shadow); display:none; z-index: 1020; }

/* Dropdown menus on glass */
.dropdown-menu { background: var(--surface-solid); border:1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: rgba(120,120,200,.1); color: var(--text); }
.dropdown-item.text-danger { color: var(--danger); }

/* Tabs */
.nav-tabs .nav-link { color: var(--text-muted); }
.nav-tabs .nav-link.active { color: var(--primary-2); background: transparent; border-color: var(--border-strong) var(--border-strong) transparent; }

/* Modal */
.modal-content { background: var(--surface-solid); border:1px solid var(--border); border-radius: 16px; color: var(--text); }
.modal-backdrop.show { opacity:.4; }

/* Responsive */
.sidebar-overlay { display:none; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset:0; background: rgba(0,0,0,.4); z-index:1035; display:none; }
  .sidebar-overlay.show { display:block; }
  .main { margin-left: 0; }
}
@media (max-width: 575px) {
  .topbar { flex-wrap: wrap; }
  .global-search { order: 3; max-width: 100%; flex-basis: 100%; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120,120,200,.3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* Utility */
.text-muted2 { color: var(--text-muted); }
.fs-7 { font-size:.82rem; }
.cursor-pointer { cursor: pointer; }
.avatar { width: 34px; height:34px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background: linear-gradient(135deg,#2563eb,#7c3aed); color:#fff; font-weight:600; }
.print-only { display:none; }
@media print {
  .sidebar, .topbar, .no-print, .bulk-bar { display:none !important; }
  .main { margin-left:0; padding:0; }
  .print-only { display:block; }
  .card, body { box-shadow:none; background:#fff; border:none; }
}
