/* ============================================================
   iBizMasters Bookkeeping — Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary:       #1a56db;
  --primary-dark:  #1341b0;
  --primary-light: #e8f0fe;
  --success:       #0e9f6e;
  --danger:        #e02424;
  --warning:       #e3a008;
  --info:          #0694a2;
  --dark:          #111827;
  --gray-900:      #1f2937;
  --gray-800:      #374151;
  --gray-700:      #4b5563;
  --gray-600:      #6b7280;
  --gray-400:      #9ca3af;
  --gray-300:      #d1d5db;
  --gray-200:      #e5e7eb;
  --gray-100:      #f3f4f6;
  --gray-50:       #f9fafb;
  --white:         #ffffff;
  --sidebar-w:     250px;
  --topbar-h:      60px;
  --radius:        8px;
  --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--gray-900);
  overflow-y: auto;
  z-index: 100;
  transition: width .25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed nav a span { display: none; }
.sidebar.collapsed nav a { justify-content: center; padding: 12px; }
.sidebar.collapsed nav a i { margin: 0; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: var(--white);
  font-size: 18px;
  font-weight: 300;
  letter-spacing: -.3px;
  white-space: nowrap;
}
.sidebar-brand strong { font-weight: 700; color: #60a5fa; }
.sidebar-brand img { width: 32px; height: 32px; object-fit: contain; }

.nav-label {
  padding: 16px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--gray-600);
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-nav {
  padding: 8px 0 24px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--gray-400);
  font-size: 13.5px;
  font-weight: 400;
  transition: all .15s;
  white-space: nowrap;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: var(--white);
  background: rgba(255,255,255,.05);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: var(--white);
  background: rgba(96,165,250,.12);
  border-left-color: #60a5fa;
  font-weight: 500;
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left .25s ease;
  display: flex;
  flex-direction: column;
}
.sidebar.collapsed ~ .main-wrapper { margin-left: 60px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow);
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--gray-600);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--gray-100); }

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.client-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-700);
  font-size: 13.5px;
}
.user-menu a { color: var(--gray-500); font-size: 16px; }
.user-menu a:hover { color: var(--danger); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content { padding: 24px; flex: 1; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 12px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
}
.flash button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: .7;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-danger  { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info    { background: #e0f2fe; color: #0c4a6e; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}
.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: var(--primary); }
.stat-icon.green  { background: #d1fae5; color: var(--success); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.teal   { background: #ccfbf1; color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-sub   { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: var(--gray-50);
  padding: 11px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  text-align: left;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

.td-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary   { background: var(--primary);  color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success   { background: var(--success);  color: var(--white); }
.btn-danger    { background: var(--danger);   color: var(--white); }
.btn-warning   { background: var(--warning);  color: var(--white); }
.btn-outline   { background: transparent; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px 10px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-control, input[type="text"], input[type="email"],
input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.input-icon { position: relative; }
.input-icon i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}
.input-icon input { padding-left: 38px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #0c4a6e; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}
.page-header p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}
.page-header-actions { display: flex; gap: 8px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  gap: 4px;
}
.tab {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a56db 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-wrap { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img { height: 50px; margin-bottom: 10px; }
.login-logo h1 { font-size: 24px; font-weight: 300; color: var(--gray-900); }
.login-logo h1 strong { font-weight: 800; color: var(--primary); }
.login-logo p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.login-footer { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 24px; }

/* ============================================================
   VOUCHER ENTRY
   ============================================================ */
.voucher-lines-table td { padding: 6px 8px; }
.voucher-lines-table input, .voucher-lines-table select { margin: 0; }
.voucher-total-row td {
  font-weight: 700;
  background: var(--gray-50);
  border-top: 2px solid var(--gray-200);
}

/* ============================================================
   REPORT STYLES
   ============================================================ */
.report-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
}
.report-header h2 { font-size: 20px; font-weight: 700; }
.report-header p  { color: var(--gray-500); font-size: 13px; }

.report-section-title {
  font-weight: 700;
  background: var(--gray-100);
  padding: 8px 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-700);
}
.report-total-row td {
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-top: 2px solid var(--primary);
}
.report-grand-total td {
  font-weight: 800;
  background: var(--gray-900);
  color: var(--white);
  font-size: 14px;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .page-header-actions, .btn, .flash { display: none !important; }
  .main-wrapper { margin: 0; }
  .page-content { padding: 0; }
  body { background: white; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
