/* ════════════════════════════════════════════════════════
   RiyanHisab POS — Design System
   ════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  /* Brand */
  --brand:          #16a34a;
  --brand-d:        #15803d;
  --brand-dd:       #166534;
  --brand-light:    #dcfce7;
  --brand-lighter:  #f0fdf4;

  /* Sidebar */
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  rgba(22,163,74,.14);
  --sidebar-active: #16a34a;
  --sidebar-text:   #94a3b8;
  --sidebar-text-h: #ffffff;
  --sidebar-w:      248px;

  /* Surfaces */
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-d:       #cbd5e1;

  /* Typography */
  --text:           #0f172a;
  --text-2:         #334155;
  --text-muted:     #64748b;
  --text-subtle:    #94a3b8;

  /* Topbar */
  --topbar-h:       56px;

  /* Status */
  --success:        #16a34a;
  --danger:         #dc2626;
  --warning:        #d97706;
  --info:           #0ea5e9;

  /* Shadows */
  --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,.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);

  /* Radius */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Hind Siliguri', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-text { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-brand-sub  { font-size: .68rem; color: var(--sidebar-text); font-weight: 400; }

/* Nav body */
.sidebar-nav { padding: .75rem 0; flex: 1; }

/* Section headers */
.nav-section {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #475569;
  padding: .9rem 1.25rem .3rem;
}

/* Links */
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--sidebar-text);
  padding: .48rem 1rem;
  margin: .05rem .65rem;
  border-radius: var(--r-sm);
  font-size: .855rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar .nav-link .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-h);
}
.sidebar .nav-link.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.sidebar .nav-link.active .nav-icon { color: #fff; }

/* Premium lock badge on sidebar links */
.sidebar .nav-link .nav-lock {
  margin-left: auto;
  font-size: .65rem;
  color: #fbbf24;
  opacity: .8;
  flex-shrink: 0;
}
.sidebar .nav-link.active .nav-lock { color: #fde68a; opacity: 1; }

/* Bottom actions */
.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .65rem;
  border-radius: var(--r-sm);
  margin-bottom: .35rem;
  background: rgba(255,255,255,.05);
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.sidebar-user-name  { color: #fff; font-size: .82rem; font-weight: 600; line-height: 1.2; }
.sidebar-user-role  { color: var(--sidebar-text); font-size: .7rem; }
.sidebar-logout {
  display: flex; align-items: center; gap: .5rem;
  color: #f87171; font-size: .82rem; font-weight: 500;
  text-decoration: none;
  padding: .4rem .65rem;
  border-radius: var(--r-sm);
  transition: background .15s;
}
.sidebar-logout:hover { background: rgba(220,38,38,.12); }

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .38rem .85rem;
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: .15s;
  font-family: inherit;
}
.topbar-btn-premium {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.topbar-btn-premium:hover { background: #fef3c7; }
.topbar-btn-pos {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.topbar-btn-pos:hover { background: var(--brand-d); }
.topbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: .15s;
  position: relative;
}
.topbar-icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .88rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════ */
.page-body { padding: 1.5rem; flex: 1; }

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card {
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r) var(--r) 0 0 !important;
  padding: 1rem 1.25rem;
}
.card-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r) var(--r) !important;
}

/* ═══════════════════════════════════════
   KPI / STAT CARDS
═══════════════════════════════════════ */
.kpi-card {
  background: var(--surface);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kpi-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.kpi-icon-green  { background: #dcfce7; color: #15803d; }
.kpi-icon-blue   { background: #dbeafe; color: #1d4ed8; }
.kpi-icon-purple { background: #ede9fe; color: #7c3aed; }
.kpi-icon-orange { background: #ffedd5; color: #c2410c; }
.kpi-icon-rose   { background: #ffe4e6; color: #be123c; }
.kpi-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 1.55rem; font-weight: 700; color: var(--text); margin: .2rem 0 0; line-height: 1.2; }
.kpi-sub   { font-size: .75rem; color: var(--text-subtle); margin-top: .15rem; }
.kpi-trend-up   { color: var(--success); }
.kpi-trend-down { color: var(--danger); }

/* ═══════════════════════════════════════
   TABLES
═══════════════════════════════════════ */
.table {
  font-size: .875rem;
  color: var(--text-2);
}
.table thead th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: .65rem 1rem;
}
.table tbody td { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--brand-lighter); }
.table tfoot td  { padding: .7rem 1rem; font-weight: 600; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  font-family: 'Hind Siliguri', sans-serif;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: .15s;
}
.btn-success   { background: var(--brand); border-color: var(--brand); }
.btn-success:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-outline-success { color: var(--brand); border-color: var(--brand); }
.btn-outline-success:hover { background: var(--brand); color: #fff; }
.btn-primary   { background: #1d4ed8; border-color: #1d4ed8; }
.btn-primary:hover { background: #1e40af; }

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-control, .form-select {
  border-color: var(--border-d);
  border-radius: var(--r-sm);
  font-family: 'Hind Siliguri', sans-serif;
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.form-label { font-weight: 600; font-size: .82rem; color: var(--text-2); margin-bottom: .35rem; }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  font-family: 'Hind Siliguri', sans-serif;
  font-weight: 600;
  border-radius: 6px;
  font-size: .72rem;
  padding: .25em .6em;
}
.bg-success { background: var(--brand) !important; }
.bg-success-subtle { background: #dcfce7 !important; }
.text-success { color: var(--brand) !important; }
.badge.bg-success-subtle.text-success { background: #dcfce7 !important; color: #166534 !important; }

/* ═══════════════════════════════════════
   FLASH / ALERTS
═══════════════════════════════════════ */
.alert {
  border-radius: var(--r-sm);
  border: none;
  font-size: .875rem;
}
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid var(--brand); }
.alert-danger  { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #f0f9ff; color: #075985; border-left: 4px solid var(--info); }

/* ═══════════════════════════════════════
   AUTH PAGES
═══════════════════════════════════════ */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #0f4c2a 60%, #15803d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border: none;
  overflow: hidden;
}
.brand-logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand);
}

/* ═══════════════════════════════════════
   BADGE NOTIFICATIONS
═══════════════════════════════════════ */
.badge-notif {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid #fff;
}

/* ═══════════════════════════════════════
   PAGINATION
═══════════════════════════════════════ */
.pagination { gap: 3px; }
.page-link {
  border-radius: var(--r-sm) !important;
  border-color: var(--border);
  color: var(--text-2);
  font-size: .82rem;
  padding: .38rem .7rem;
}
.page-link:hover  { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dd); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }

/* ═══════════════════════════════════════
   MODALS
═══════════════════════════════════════ */
.modal-content  { border-radius: var(--r-lg); border: none; box-shadow: var(--shadow-lg); }
.modal-header   { border-bottom: 1px solid var(--border); padding: 1.25rem 1.5rem; }
.modal-footer   { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }
.modal-body     { padding: 1.25rem 1.5rem; }
.modal-title    { font-size: 1rem; font-weight: 700; }

/* ═══════════════════════════════════════
   DROPDOWNS
═══════════════════════════════════════ */
.dropdown-menu  { border-radius: var(--r); border: 1px solid var(--border); box-shadow: var(--shadow); padding: .4rem; }
.dropdown-item  { border-radius: var(--r-sm); font-size: .875rem; padding: .45rem .75rem; }
.dropdown-item:hover { background: var(--brand-lighter); color: var(--brand-dd); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 767.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 1rem; }
}
