/* ============================================================
   Bitur B2B — app.css
   Bootstrap 5 override + custom styles
   Colors: #1E3162 (primary), #1BB1BC (accent)
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --primary:       #1E3162;
  --primary-dark:  #162548;
  --primary-light: #2a4280;
  --accent:        #1BB1BC;
  --accent-dark:   #159AA4;
  --accent-light:  #e8f9fa;

  --body-bg:       #F4F7FB;
  --surface:       #FFFFFF;
  --surface-alt:   #EEF2F9;
  --border:        #D0D9EC;
  --border-light:  #E6EBF5;

  --text-primary:  #0D1B3E;
  --text-secondary:#5A6A8A;
  --text-muted:    #8A98B8;

  --success:       #15803D;
  --success-bg:    #F0FDF4;
  --success-border:#BBF7D0;
  --danger:        #B91C1C;
  --danger-bg:     #FEF2F2;
  --danger-border: #FECACA;
  --warning:       #B45309;
  --warning-bg:    #FFFBEB;
  --warning-border:#FDE68A;
  --info:          #1BB1BC;
  --info-bg:       #E8F9FA;
  --info-border:   #A5F3F6;

  --sidebar-width: 240px;
  --topbar-height: 60px;

  --radius-sm:  4px;
  --radius:     6px;
  --radius-md:  8px;
  --radius-lg:  10px;

  --shadow-xs:  0 1px 3px rgba(30,49,98,.06);
  --shadow-sm:  0 2px 6px rgba(30,49,98,.08);
  --shadow:     0 4px 12px rgba(30,49,98,.10);
  --shadow-md:  0 6px 20px rgba(30,49,98,.12);

  --transition: 150ms ease;
}

/* ── Reset & base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--body-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dark); }

/* ── Bootstrap overrides ─────────────────────────────────────── */
.btn {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  letter-spacing: 0;
  line-height: 1.5;
}
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
.btn-lg { padding: 0.55rem 1.25rem; font-size: 0.9375rem; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--surface);
}
.btn-outline-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

.form-control, .form-select {
  font-size: 0.875rem;
  border-color: var(--border);
  border-radius: var(--radius);
  padding: 0.4375rem 0.75rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,177,188,.15);
  color: var(--text-primary);
}
.form-control::placeholder { color: var(--text-muted); }
.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.form-text { font-size: 0.75rem; color: var(--text-muted); }

.card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  background: var(--surface);
}
.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0.875rem 1.125rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}
.card-body { padding: 1.125rem; }
.card-footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--border-light);
  padding: 0.75rem 1.125rem;
}

.table { font-size: 0.8125rem; }
.table thead th {
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.625rem 0.875rem;
  border-color: var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface-alt); }
.table-sm thead th, .table-sm tbody td { padding: 0.4rem 0.75rem; }

.badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.25em 0.6em;
  border-radius: var(--radius-sm);
  letter-spacing: 0;
}
.badge-primary { background: var(--primary); color: #fff; }
.badge-accent   { background: var(--accent); color: #fff; }

/* Status badges */
.badge-pending     { background: var(--warning-bg);  color: var(--warning);  border: 1px solid var(--warning-border); }
.badge-active,
.badge-confirmed   { background: var(--success-bg);  color: var(--success);  border: 1px solid var(--success-border); }
.badge-failed,
.badge-cancelled,
.badge-suspended   { background: var(--danger-bg);   color: var(--danger);   border: 1px solid var(--danger-border); }
.badge-reserved    { background: var(--info-bg);     color: var(--info);     border: 1px solid var(--info-border); }
.badge-expired,
.badge-inactive    { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

.alert {
  font-size: 0.8125rem;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  border-width: 1px;
}
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info); }

.nav-tabs .nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1rem;
  border-radius: 0;
}
.nav-tabs .nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}
.nav-tabs { border-bottom: 1px solid var(--border-light); }

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.modal-body   { padding: 1.25rem; }
.modal-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface-alt);
}
.modal-title  { font-size: 0.9375rem; font-weight: 600; }

.pagination .page-link {
  font-size: 0.8125rem;
  color: var(--primary);
  border-color: var(--border-light);
  padding: 0.35rem 0.65rem;
}
.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}
.pagination .page-link:focus { box-shadow: 0 0 0 3px rgba(30,49,98,.15); }

.dropdown-menu {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.375rem;
  font-size: 0.8125rem;
}
.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  color: var(--text-primary);
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-alt); }
.dropdown-divider { border-color: var(--border-light); }

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 1.125rem 1.25rem 0.875rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-logo img { height: 28px; width: auto; }
.sidebar-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}
.sidebar-logo-text span { color: var(--accent); }

.sidebar-nav { padding: 0.75rem 0.75rem; flex: 1; }

.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.35);
  padding: 0.75rem 0.5rem 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,.72);
  font-size: 0.8125rem;
  font-weight: 450;
  transition: all var(--transition);
  margin-bottom: 1px;
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-link.active {
  background: rgba(27,177,188,.18);
  color: #fff;
}
.sidebar-link.active .sidebar-icon { color: var(--accent); }

.sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: rgba(255,255,255,.5);
  transition: color var(--transition);
}
.sidebar-link:hover .sidebar-icon { color: rgba(255,255,255,.85); }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-user {
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,.45);
}

/* ── Topbar ──────────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  z-index: 999;
}

.topbar-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--surface-alt); color: var(--text-primary); }
.topbar-btn svg { width: 16px; height: 16px; }

.topbar-notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.topbar-currency-lang {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.topbar-select {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.3rem 1.5rem 0.3rem 0.5rem;
  background: var(--surface);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.3rem center;
  background-size: 10px;
  transition: border-color var(--transition);
}
.topbar-select:focus { outline: none; border-color: var(--accent); }

.topbar-flag { width: 16px; height: 12px; border-radius: 2px; object-fit: cover; }

/* ── Main content ────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 1.5rem;
  min-height: calc(100vh - var(--topbar-height));
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.page-header-left h1 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.page-header-left .breadcrumb {
  font-size: 0.75rem;
  margin: 0;
  padding: 0;
  background: none;
}
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-secondary); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon-primary { background: rgba(30,49,98,.08); color: var(--primary); }
.stat-icon-accent  { background: rgba(27,177,188,.12); color: var(--accent); }
.stat-icon-success { background: var(--success-bg); color: var(--success); }
.stat-icon-warning { background: var(--warning-bg); color: var(--warning); }
.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Section card ────────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}
.section-card-header {
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.section-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.section-card-body { padding: 1.125rem; }

/* ── Search / filter bar ─────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.125rem;
  margin-bottom: 1.25rem;
}
.filter-bar .row { --bs-gutter-x: 0.75rem; }

/* ── Transfer result card ────────────────────────────────────── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.result-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.result-vehicle-img {
  width: 80px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
.result-info { flex: 1; min-width: 0; }
.result-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.result-meta  { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.875rem; flex-wrap: wrap; margin-top: 0.25rem; }
.result-meta-item { display: flex; align-items: center; gap: 0.25rem; }
.result-price { text-align: right; flex-shrink: 0; }
.result-price-value { font-size: 1.125rem; font-weight: 700; color: var(--primary); }
.result-price-old   { font-size: 0.75rem; color: var(--text-muted); text-decoration: line-through; }
.result-price-label { font-size: 0.7rem; color: var(--text-muted); }

/* ── Checkout steps ──────────────────────────────────────────── */
.steps-bar {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}
.step-item.active { color: var(--primary); }
.step-item.done   { color: var(--success); }
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-item.active .step-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-item.done .step-num   { background: var(--success); border-color: var(--success); color: #fff; }
.step-divider { flex: 1; height: 1px; background: var(--border-light); margin: 0 0.5rem; }

/* ── Order summary sidebar ───────────────────────────────────── */
.order-summary {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-height) + 1.25rem);
}
.order-summary-header {
  background: var(--primary);
  color: #fff;
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.order-summary-body { padding: 1rem 1.125rem; }
.order-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8125rem;
  padding: 0.3rem 0;
  color: var(--text-secondary);
}
.order-line-label { flex: 1; }
.order-line-value { font-weight: 500; color: var(--text-primary); }
.order-total {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary);
}

/* ── Wallet card ─────────────────────────────────────────────── */
.wallet-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  color: #fff;
}
.wallet-balance-label { font-size: 0.75rem; color: rgba(255,255,255,.6); }
.wallet-balance-value { font-size: 1.75rem; font-weight: 700; }
.wallet-currency      { font-size: 0.875rem; color: rgba(255,255,255,.6); }

/* ── Notification dropdown ───────────────────────────────────── */
.notif-dropdown {
  width: 320px;
  max-height: 440px;
  overflow-y: auto;
}
.notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--surface-alt); }
.notif-item.unread { background: var(--info-bg); }
.notif-title { font-size: 0.8125rem; font-weight: 500; color: var(--text-primary); }
.notif-body  { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.125rem; }
.notif-time  { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.125rem; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .35; }
.empty-state h6  { font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }
.empty-state p   { font-size: 0.8125rem; }

/* ── Loading spinner ─────────────────────────────────────────── */
.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ───────────────────────────────────────────────── */
.text-primary-c  { color: var(--primary)  !important; }
.text-accent     { color: var(--accent)   !important; }
.text-muted-c    { color: var(--text-muted) !important; }
.bg-primary-soft { background: rgba(30,49,98,.06)  !important; }
.bg-accent-soft  { background: rgba(27,177,188,.08) !important; }
.border-primary  { border-color: var(--primary)    !important; }
.border-accent   { border-color: var(--accent)     !important; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #topbar, #main-content {
    left: 0;
    margin-left: 0;
  }
  #topbar { left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 575px) {
  #main-content { padding: 1rem; }
  .page-header  { flex-direction: column; align-items: flex-start; }
  .result-card  { flex-wrap: wrap; }
  .result-price { width: 100%; text-align: left; }
}
