:root {
  --primary: #F59E0B;
  --primary-dark: #D97706;
  --sidebar-bg: #0f172a;
  --sidebar-width: 250px;
  --header-height: 70px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  margin: 0;
  padding: 0;
}

/* ─── WRAPPER ─────────────────────────────── */
.wrapper { min-height: 100vh; }

/* ─── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.brand-icon { width: 42px; height: 42px; flex-shrink: 0; }

.nav-link-item {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}
.nav-link-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.nav-link-item.active {
  background: rgba(245,158,11,0.2);
  color: #F59E0B;
  font-weight: 600;
}
.nav-link-item.active .nav-icon { color: #F59E0B; }

/* ─── TOP NAVBAR ──────────────────────────── */
.top-navbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

.avatar-sm { width: 32px; height: 32px; flex-shrink: 0; }

/* ─── CARDS ───────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 12px 12px 0 0 !important;
  font-weight: 600;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ─── TABLES ──────────────────────────────── */
.table { font-size: 0.875rem; }
.table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}
.table td { vertical-align: middle; border-color: #f1f5f9; }
.table-hover tbody tr:hover { background: #fafbff; }

/* ─── BADGES ──────────────────────────────── */
.badge { font-weight: 500; font-size: 0.72rem; }

/* ─── BUTTONS ─────────────────────────────── */
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

/* ─── FORMS ───────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(245,158,11,0.15);
}
.form-label { font-size: 0.8rem; font-weight: 600; color: #475569; }

/* ─── POS ─────────────────────────────────── */
.pos-product-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.pos-product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(245,158,11,0.15);
  transform: translateY(-1px);
}
.pos-product-card.in-cart { border-color: var(--primary); background: #fffbeb; }

.cart-panel {
  background: #fff;
  border-left: 1px solid #e2e8f0;
  width: 360px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
}

.cart-items { flex: 1; overflow-y: auto; }
.cart-item {
  border-bottom: 1px solid #f1f5f9;
  padding: 0.75rem 1rem;
}
.cart-footer {
  border-top: 2px solid #f1f5f9;
  padding: 1rem;
  background: #fafbff;
}

/* ─── PRODUCT GRID ────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

/* ─── ALERTS ──────────────────────────────── */
.low-stock-badge { animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── PRINT ───────────────────────────────── */
@media print {
  .sidebar, .top-navbar, .no-print, .btn { display: none !important; }
  .main-content { margin: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: #fff; }
}

/* ─── MOBILE ──────────────────────────────── */
@media (max-width: 991px) {
  :root { --sidebar-width: 260px; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    z-index: 999; opacity: 0; visibility: hidden; transition: all 0.25s;
  }
  .sidebar-overlay.show { opacity: 1; visibility: visible; }
  .page-content { padding: 1rem !important; }
  .top-navbar { padding: 0.75rem 1rem !important; }
  .top-navbar h5 { font-size: 1rem; }
}

@media (max-width: 767px) {
  .stat-card { padding: 0.875rem; }
  .stat-icon { width: 40px; height: 40px; font-size: 1rem; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { min-height: 44px; font-size: 16px; }
  .table { font-size: 0.8rem; white-space: nowrap; }
  .table th, .table td { padding: 0.6rem 0.5rem; }
  .modal-dialog { margin: 0.5rem; }
  .modal-content { border-radius: 12px; }
  .modal-header, .modal-footer, .modal-body { padding: 1rem; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .nav-tabs .nav-link { white-space: nowrap; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; }
  .pos-product-card { padding: 0.625rem; }
  .pos-wrapper { flex-direction: column; height: auto; min-height: calc(100vh - 120px); }
  .pos-products { flex: none; height: auto; padding-bottom: 80px; }
  .cart-panel {
    position: fixed; left: 0; right: 0; bottom: 0;
    width: 100% !important; min-width: unset !important;
    height: 60px; border-top: 2px solid #f1f5f9; z-index: 99;
    transform: translateY(calc(100% - 60px)); transition: transform 0.3s ease;
  }
  .cart-panel.mobile-open { transform: translateY(0); height: 80vh; }
  .cart-toggle {
    position: absolute; top: -48px; right: 12px;
    background: var(--primary); color: #fff; border: none;
    border-radius: 24px; padding: 10px 16px; font-weight: 700;
    box-shadow: 0 4px 12px rgba(245,158,11,0.35);
    display: flex; align-items: center; gap: 6px; z-index: 100;
  }
  .cart-header { padding: 0.75rem 1rem; }
  .cart-body { padding: 0.5rem; }
  .cart-footer { padding: 0.75rem; }
}

@media (max-width: 575px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card h5, .stat-card .fw-black { font-size: 1.1rem !important; }
  .stat-card .text-muted { font-size: 0.65rem !important; }
  .d-flex.flex-wrap.gap-2.justify-content-between { flex-direction: column; align-items: stretch !important; gap: 0.75rem; }
  .d-flex.flex-wrap.gap-2.justify-content-between form, .d-flex.flex-wrap.gap-2.justify-content-between .btn { width: 100%; }
  .input-group { flex-wrap: nowrap; }
  .modal-dialog.modal-xl, .modal-dialog.modal-lg { max-width: 100%; margin: 0.25rem; }
  .modal-fullscreen-sm { width: 100%; max-width: none; height: 100%; margin: 0; }
  .modal-fullscreen-sm .modal-content { height: 100%; border-radius: 0; }
}

/* ─── UTILS ───────────────────────────────── */
.rounded-xl { border-radius: 12px !important; }
.text-primary { color: var(--primary) !important; }
.bg-primary-soft { background: rgba(245,158,11,0.1) !important; }
.fw-black { font-weight: 800 !important; }
