/* ============================================================
   Market Guli POS — Light Professional Theme
   Font : Noto Kufi Arabic  |  Direction: RTL Kurdish
   ============================================================ */

:root {
  /* ── Palette ── */
  --bg-body:       #f1f5f9;
  --bg-sidebar:    #1e293b;        /* dark sidebar (always) */
  --bg-sidebar-alt:#273548;
  --bg-card:       #ffffff;
  --bg-card-alt:   #f8fafc;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  /* ── Brand colors ── */
  --accent:        #4361ee;
  --accent-hover:  #3451d1;
  --accent-light:  #eef2ff;
  --accent-2:      #7c3aed;
  --success:       #16a34a;
  --success-light: #f0fdf4;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --danger:        #dc2626;
  --danger-light:  #fef2f2;
  --info:          #0284c7;
  --info-light:    #eff6ff;

  /* ── Layout ── */
  --sidebar-w:     260px;
  --topbar-h:      60px;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:     0 10px 28px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.05);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--bg-body);
  color: var(--text);
  font-family: 'Noto Kufi Arabic', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  direction: rtl;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Sidebar (always dark) ────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-left: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  font-size: 15px;
  font-weight: 800;
  color: #f1f5f9;
  border-bottom: 1px solid rgba(255,255,255,.07);
  letter-spacing: .3px;
}
.sidebar-brand i { color: #818cf8; font-size: 22px; }

.sidebar-nav { list-style: none; margin: 0; padding: 12px 8px; flex: 1; }
.sidebar-nav li { margin-bottom: 2px; }

.nav-section {
  font-size: 10px !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #475569 !important;
  padding: 16px 12px 5px !important;
  display: block;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
  position: relative;
}
.sidebar-nav .nav-link i { font-size: 16px; min-width: 20px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }
.sidebar-nav .nav-link.active {
  background: rgba(129,140,248,.15);
  color: #818cf8;
  font-weight: 700;
}
.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  right: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: #818cf8;
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 13px;
  color: #64748b;
}
.sidebar-footer a { color: #64748b; }

/* Desktop sidebar collapsed */
.sidebar.collapsed { transform: translateX(100%); }

/* ── Main Wrapper ──────────────────────────────────────────── */
.main-wrapper {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin .25s ease;
}
.main-wrapper.full { margin-right: 0; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 1020;
  box-shadow: var(--shadow-sm);
}
.topbar-breadcrumb { flex: 1; font-size: 15px; font-weight: 700; color: var(--text); }
.topbar-end { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  font-size: 16px;
}
.btn-icon:hover { background: var(--bg-body); color: var(--text); }

.notif-badge {
  position: absolute; top: 0; left: 0;
  min-width: 17px; height: 17px;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
}
.notif-menu {
  min-width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.notif-menu .dropdown-item { color: var(--text); font-size: 13px; padding: 9px 16px; border-radius: 8px; }
.notif-menu .dropdown-item:hover { background: var(--bg-card-alt); }

/* ── Page Content ──────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ── Card Light ────────────────────────────────────────────── */
.card-light {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-light-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Legacy alias used in views */
.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.mini-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 115px;
  box-shadow: var(--shadow);
}
.stat-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 52px;
  opacity: .12;
}
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat-value small { font-size: 12px; font-weight: 400; opacity: .75; }
.stat-label { font-size: 12.5px; opacity: .85; font-weight: 500; }
.stat-sub { font-size: 11px; opacity: .65; margin-top: 2px; }

.bg-gradient-blue   { background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%); }
.bg-gradient-purple { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); }
.bg-gradient-teal   { background: linear-gradient(135deg, #059669 0%, #0284c7 100%); }
.bg-gradient-orange { background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%); }

/* ── Alert Items (notifications) ──────────────────────────── */
.alert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}
.alert-item .ms-auto { margin-right: auto; margin-left: 0 !important; }

/* ── Light Tables (override Bootstrap table-dark) ─────────── */
.table-dark {
  --bs-table-bg:           transparent;
  --bs-table-border-color: var(--border);
  --bs-table-color:        var(--text);
  --bs-table-striped-bg:   var(--bg-card-alt);
  --bs-table-hover-bg:     var(--bg-card-alt);
}
.table-dark thead th,
.table-head th {
  background: var(--bg-card-alt) !important;
  color: var(--text-muted) !important;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
  padding: 13px 16px;
  border-bottom: 2px solid var(--border) !important;
  border-color: var(--border) !important;
}
.table-dark tbody td,
.table tbody td {
  padding: 13px 16px;
  border-color: var(--border);
  vertical-align: middle;
  color: var(--text);
  background: transparent;
}
.table-dark tbody tr:hover td,
.table tbody tr:hover td {
  background: var(--bg-card-alt);
}
.table-light {
  --bs-table-bg:           transparent;
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg:     var(--bg-card-alt);
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.form-control::placeholder { color: var(--text-light); }
.form-label { color: var(--text-muted); font-size: 12.5px; font-weight: 500; margin-bottom: 5px; }
.input-group-text {
  background: var(--bg-card-alt);
  border-color: var(--border-strong);
  color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-xs { font-size: 11.5px; padding: 3px 10px; border-radius: 6px; font-weight: 500; }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border-strong); }
.btn-outline-secondary:hover { background: var(--bg-card-alt); color: var(--text); border-color: var(--border-strong); }

/* ── Summary rows ──────────────────────────────────────────── */
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.summary-net { border-top: 2px solid var(--border); border-bottom: none; padding-top: 10px; margin-top: 4px; }

/* ── Login Page ────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, #eef2ff 0%, #f1f5f9 60%, #ede9fe 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-wrapper { width: 100%; max-width: 430px; }
.login-brand { text-align: center; margin-bottom: 32px; }
.brand-icon {
  width: 76px; height: 76px; border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 34px; color: #fff; margin-bottom: 16px;
  box-shadow: 0 12px 32px rgba(67,97,238,.35);
}
.login-brand h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.login-card .btn-primary { border-radius: 10px; padding: 12px; font-size: 15px; }

/* ── POS Layout ────────────────────────────────────────────── */
.pos-wrapper {
  display: flex; gap: 20px;
  height: calc(100vh - var(--topbar-h) - 48px);
}
.pos-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pos-right { width: 340px; flex-shrink: 0; }
.pos-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px; height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.pos-search-box { position: relative; }
.search-suggestions {
  position: absolute; top: 100%; right: 0; left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  z-index: 1000; max-height: 300px; overflow-y: auto;
  box-shadow: var(--shadow);
}
.search-suggestion-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  color: var(--text);
}
.search-suggestion-item:hover { background: var(--bg-card-alt); }
.search-suggestion-item:last-child { border-bottom: none; }
.pos-cart-table-wrap {
  flex: 1; overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.pos-cart-table-wrap .table td, .pos-cart-table-wrap .table th { padding: 9px 12px; }
.payment-type-btn.active, .receipt-type-btn.active { opacity: 1 !important; }
.payment-type-btn:not(.active), .receipt-type-btn:not(.active) { opacity: .5; }
.pos-checkout-btn { border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 700; }

/* ── Category Cards ────────────────────────────────────────── */
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.category-card-header {
  padding: 20px;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 90px;
}
.category-card-icon { font-size: 40px; opacity: .9; color: #fff; }
.category-card-count { position: absolute; top: 12px; left: 12px; }
.category-card-body { padding: 16px; }

.cat-badge {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

/* ── User Avatars ──────────────────────────────────────────── */
.user-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.user-avatar-admin { background: rgba(124,58,237,.12); color: var(--accent-2); }
.user-avatar-emp   { background: rgba(2,132,199,.12);  color: var(--info); }

.badge-role {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-admin { background: rgba(124,58,237,.1); color: var(--accent-2); }
.badge-emp   { background: rgba(2,132,199,.1);  color: var(--info); }

.table-row-inactive td { opacity: .55; }

/* ── Permission Card ───────────────────────────────────────── */
.permission-card { padding: 12px 16px; border-radius: var(--radius); }
.border-purple { border-color: var(--accent-2) !important; }
.text-purple { color: var(--accent-2); }

/* ── Bootstrap Overrides ───────────────────────────────────── */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
  color: var(--text);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 24px;
  background: var(--bg-card-alt);
}
.modal-footer { border-top: 1px solid var(--border); padding: 14px 24px; }
.modal-body { padding: 24px; }
.btn-close { filter: none; }

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
}
.dropdown-item { color: var(--text); border-radius: 6px; }
.dropdown-item:hover { background: var(--bg-card-alt); }
.dropdown-divider { border-color: var(--border); }
.dropdown-header { color: var(--text-muted); font-size: 11px; letter-spacing: .6px; }

.badge { font-weight: 600; letter-spacing: .2px; }
.alert { border-radius: var(--radius); }
.progress { border-radius: 20px; background: var(--bg-card-alt); }

.nav-tabs { border-bottom: 1px solid var(--border) !important; }
.nav-tabs .nav-link { color: var(--text-muted); border: none; border-bottom: 2px solid transparent; background: none; padding: 11px 18px; font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); background: none; font-weight: 700; }

/* ── Scrollbars ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Sidebar backdrop (mobile overlay) ─────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .52);
  z-index: 1025;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity .25s;
}
.sidebar-backdrop.show { display: block; }

/* ── Mobile  (≤ 991px) ─────────────────────────────────────── */
@media (max-width: 991px) {
  /* Sidebar hides off-screen, slides in as overlay */
  .sidebar { transform: translateX(100%); z-index: 1030; box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-wrapper { margin-right: 0 !important; }

  /* Stat cards */
  .stat-card  { min-height: 100px; padding: 16px 14px; }
  .stat-value { font-size: 20px; }
  .stat-icon  { font-size: 40px; }
  .stat-sub   { font-size: 10px; }

  /* POS stacks vertically */
  .pos-wrapper { flex-direction: column; height: auto; gap: 14px; }
  .pos-right   { width: 100%; }

  /* Page padding */
  .page-content { padding: 12px; }
  .topbar { padding: 0 14px; gap: 10px; }

  /* Tables: horizontal scroll with touch */
  .table-responsive { -webkit-overflow-scrolling: touch; }

  /* Modals full-width on small screens */
  .modal-dialog { margin: .5rem; }
}

/* ── Small phones (≤ 480px) ────────────────────────────────── */
@media (max-width: 480px) {
  .stat-value { font-size: 18px; }
  .stat-card  { min-height: 90px; }
  .topbar-breadcrumb { font-size: 13px; }
  .page-content { padding: 10px; }
  .login-card { padding: 24px 18px; }
}

/* ── Desktop sidebar collapse (≥ 992px) ────────────────────── */
@media (min-width: 992px) {
  .sidebar.collapsed { transform: translateX(100%); }
  .main-wrapper.full { margin-right: 0; }
}

/* ── Medium / Laptop (992px – 1399px) ─────────────────────── */
@media (min-width: 992px) and (max-width: 1399px) {
  :root { --sidebar-w: 250px; }
  .page-content { padding: 20px 24px; }
  .stat-value { font-size: 22px; }
  .stat-card  { min-height: 112px; }
  .pos-right  { width: 320px; }
}

/* ── Large screens (≥ 1400px) ──────────────────────────────── */
@media (min-width: 1400px) {
  :root { --sidebar-w: 280px; }
  .page-content  { padding: 28px 36px; }
  .stat-value    { font-size: 26px; }
  .stat-label    { font-size: 13px; }
  .stat-card     { min-height: 128px; padding: 26px 22px; }
  .stat-icon     { font-size: 58px; }
  .topbar        { padding: 0 32px; height: 64px; }
  .topbar-breadcrumb { font-size: 16px; }
  .sidebar-nav .nav-link { font-size: 14px; padding: 10px 16px; }
  .sidebar-brand { font-size: 16px; padding: 20px 22px; }
  .pos-right     { width: 380px; }
  .table-dark thead th, .table-head th { padding: 14px 18px; font-size: 12px; }
  .table-dark tbody td, .table tbody td { padding: 14px 18px; }
}

/* ── Extra large / Full HD (≥ 1920px) ─────────────────────── */
@media (min-width: 1920px) {
  :root { --sidebar-w: 300px; --topbar-h: 68px; }
  html, body { font-size: 15px; }
  .page-content  { padding: 36px 52px; }
  .stat-value    { font-size: 30px; }
  .stat-label    { font-size: 13.5px; }
  .stat-card     { min-height: 148px; padding: 30px 26px; }
  .stat-icon     { font-size: 68px; }
  .topbar        { padding: 0 44px; }
  .topbar-breadcrumb { font-size: 17px; }
  .sidebar-nav .nav-link { font-size: 14.5px; padding: 11px 18px; }
  .sidebar-brand { font-size: 17px; padding: 22px 24px; }
  .pos-right     { width: 420px; }
  .table-dark thead th, .table-head th { padding: 16px 20px; }
  .table-dark tbody td, .table tbody td { padding: 15px 20px; }
  /* Cap content width so lines don't stretch across 4K */
  .page-content > .container-fluid {
    max-width: 2000px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ── 4K / Ultra-wide (≥ 2560px) ────────────────────────────── */
@media (min-width: 2560px) {
  :root { --sidebar-w: 320px; --topbar-h: 72px; }
  html, body { font-size: 16px; }
  .page-content  { padding: 48px 72px; }
  .stat-value    { font-size: 36px; }
  .stat-card     { min-height: 170px; padding: 36px 30px; }
  .stat-icon     { font-size: 80px; }
  .topbar        { padding: 0 60px; }
  .sidebar-nav .nav-link { font-size: 15px; padding: 13px 20px; }
  .sidebar-brand { font-size: 18px; padding: 26px 28px; }
  .pos-right     { width: 480px; }
  .page-content > .container-fluid { max-width: 2600px; }
}
