/* ============================================================
   Mini ERP — UI Styles (White Theme)
   ============================================================ */

:root {
  --sidebar-width: 248px;
  --topbar-height: 58px;
  --primary: #1565C0;
  --primary-light: #e8f0fe;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1565C0;
  --sidebar-text: #94a3b8;
  --sidebar-active-text: #fff;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.07);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  background: var(--sidebar-bg);
  overflow-y: auto;
  transition: transform 0.25s ease;
  z-index: 1040;
}

.sidebar-inner { padding: 10px 0 50px; }

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  border-radius: 0 6px 6px 0;
  margin-right: 10px;
}

.sidebar-menu a:hover {
  background: var(--sidebar-hover);
  color: #cbd5e1;
}

.sidebar-menu a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  border-left-color: #93c5fd;
}

.sidebar-menu a .bi { font-size: 16px; flex-shrink: 0; width: 18px; text-align: center; }

.menu-label {
  padding: 14px 18px 5px;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #334155;
  font-weight: 700;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

/* ─── Topbar ──────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-height);
  background: #fff !important;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

#topbar .navbar-brand { color: var(--primary) !important; font-size: 16px; }
#topbar .navbar-brand:hover { color: #0d47a1 !important; }

#topbar #sidebarToggle { color: var(--text-muted) !important; }

/* ─── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin 0.25s ease;
  background: var(--bg);
}

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h4 {
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
  font-size: 18px;
}

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
}

.card:hover { box-shadow: var(--shadow) !important; transition: box-shadow .2s; }

.card-header {
  background: var(--card-bg) !important;
  border-bottom: 1px solid var(--border) !important;
  font-weight: 600;
  font-size: 14px;
  padding: 14px 18px;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  color: var(--text-main);
}

.card-footer {
  background: #f8fafc !important;
  border-top: 1px solid var(--border) !important;
}

/* ─── KPI Cards ───────────────────────────────────────────── */
.kpi-card {
  border-left: 4px solid !important;
  transition: transform .15s, box-shadow .15s;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow) !important;
}

.kpi-card .kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-card .kpi-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi-card .kpi-value { font-size: 22px; font-weight: 800; color: var(--text-main); line-height: 1.1; }
.kpi-card .kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Tables ──────────────────────────────────────────────── */
.table {
  font-size: 13.5px;
  border-color: var(--border) !important;
}

.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
  background: #f8fafc !important;
  border-bottom: 2px solid var(--border) !important;
  padding: 10px 14px;
}

.table td {
  vertical-align: middle;
  padding: 10px 14px;
  border-color: #f1f5f9 !important;
}

.table-hover tbody tr:hover { background: #f8fafc; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  font-weight: 600;
  font-size: 13px;
  border-radius: 7px;
  letter-spacing: .1px;
  transition: all .15s;
}

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #0d47a1; border-color: #0d47a1; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: 12.5px; color: #374151; margin-bottom: 5px; }

.form-control, .form-select {
  font-size: 13.5px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
  outline: none;
}

.input-group-text {
  background: #f8fafc;
  border: 1.5px solid #d1d5db;
  color: var(--text-muted);
}

/* ─── Badges ──────────────────────────────────────────────── */
.badge { font-weight: 600; letter-spacing: .2px; }

/* ─── Alerts ──────────────────────────────────────────────── */
.alert { border-radius: 8px; border: none; }
.alert-success { background: #f0fdf4; color: #166534; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ─── Bill/Invoice Items Table ────────────────────────────── */
.items-table { background: #fff; border-radius: 8px; }
.items-table thead th { background: #eff6ff !important; color: var(--primary); border-bottom-color: #bfdbfe !important; }
.item-row td { padding: 5px 7px; }

/* ─── Print Styles ────────────────────────────────────────── */
@media print {
  .sidebar, #topbar, .no-print, .btn { display: none !important; }
  .main-content { margin: 0 !important; background: #fff; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff; font-size: 12px; }
}

/* ─── Bill Print Layout ───────────────────────────────────── */
.bill-print-header { border-bottom: 2px solid var(--primary); padding-bottom: 14px; margin-bottom: 16px; }
.bill-print-company { font-size: 20px; font-weight: 800; color: var(--primary); }
.bill-print-title { font-size: 16px; font-weight: 700; text-align: center; margin: 10px 0; letter-spacing: 3px; color: #374151; background: #f8fafc; padding: 6px; border-radius: 4px; }
.bill-print-table th { background: var(--primary) !important; color: #fff !important; }
.bill-total-row td { font-weight: 700; font-size: 15px; background: #eff6ff; }
.bill-footer { border-top: 2px solid var(--primary); margin-top: 20px; padding-top: 14px; }
.sign-box { border-top: 1px solid #000; width: 160px; margin-top: 50px; text-align: center; padding-top: 6px; }

/* ─── Status Badges ───────────────────────────────────────── */
.badge-customer { background: #dbeafe; color: #1d4ed8; }
.badge-supplier { background: #fce7f3; color: #9d174d; }
.badge-expense  { background: #fee2e2; color: #991b1b; }
.badge-income   { background: #d1fae5; color: #065f46; }
.badge-employee { background: #ede9fe; color: #5b21b6; }
.badge-cash     { background: #fef3c7; color: #92400e; }
.badge-bank     { background: #e0f2fe; color: #0c4a6e; }

/* ─── OTP Step UI ─────────────────────────────────────────── */
.otp-input {
  letter-spacing: 8px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--primary);
  border-radius: 8px;
}

/* ─── Login Page ──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1565C0 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #1565C0, #1976d2);
  padding: 28px 32px 22px;
  text-align: center;
  color: #fff;
}

.login-body { padding: 28px 32px; }

.login-logo {
  width: 56px; height: 56px;
  background: rgba(255,255,255,.2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 26px;
}

/* ─── Sidebar Collapsed (Desktop) ────────────────────────── */
.sidebar.collapsed {
  transform: translateX(-100%);
}
.main-content.expanded {
  margin-left: 0;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .kpi-value { font-size: 18px; }
  .page-header h4 { font-size: 15px; }
}

/* ─── Utilities ───────────────────────────────────────────── */
.text-danger-hover:hover { color: #dc3545 !important; }
.cursor-pointer { cursor: pointer; }
.fs-13 { font-size: 13px; }
.fw-semibold { font-weight: 600; }
.text-muted { color: var(--text-muted) !important; }

/* ─── Progress Bar ────────────────────────────────────────── */
.progress { background: #f1f5f9; }

/* ─── Dropdown ────────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 10px;
  padding: 6px;
}

.dropdown-item {
  border-radius: 6px;
  font-size: 13.5px;
  padding: 7px 12px;
}

.dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
