/* ===========================
   SaaS Premium Design System
=========================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

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

:root {
  --bg: #F7F9FC;
  --bg2: #FFFFFF;
  --bg3: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --blue: #0070F3;
  --blue-hover: #0060D0;
  --green: #10B981;
  --purple: #6366F1;
  --red: #EF4444;
  --yellow: #F59E0B;
  --radius: 16px;
  --radius-s: 8px;
  --font-ar: 'Cairo', sans-serif;
  --font-en: 'Inter', sans-serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --glass-bg: rgba(255, 255, 255, 0.75);
}

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===========================
   Sidebar (Navigation)
=========================== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon i,
.logo-icon svg {
  font-size: 28px;
  color: var(--blue);
}

.logo-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
  transform: translateX(-4px);
}

.nav-item.active {
  background: rgba(0, 112, 243, 0.08);
  color: var(--blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--blue);
  border-radius: 4px 0 0 4px;
}

.nav-icon i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

/* ===========================
   Main Layout & Header
=========================== */
.main {
  flex: 1;
  margin-right: 240px;
  padding: 24px 16px;
  min-height: 100vh;
  width: 100%;
  /* Spacious layout */
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===========================
   Cards & Stats (Bento)
=========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(0, 112, 243, 0.2);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-s);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg3);
}

.stat-card.green .stat-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.stat-card.blue .stat-icon {
  background: rgba(0, 112, 243, 0.1);
  color: var(--blue);
}

.stat-card.purple .stat-icon {
  background: rgba(99, 102, 241, 0.1);
  color: var(--purple);
}

.stat-card.red .stat-icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-en);
  letter-spacing: -0.03em;
  color: var(--text);
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* ===========================
   Generic Cards & Layouts
=========================== */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ===========================
   Tables (SaaS UI)
=========================== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.table th {
  text-align: right;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  font-weight: 500;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr {
  transition: background 0.2s ease;
}

.table tr:hover td {
  background: var(--bg3);
}

/* ===========================
   Badges / Status Pills
=========================== */
.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status.received {
  background: rgba(99, 102, 241, 0.1);
  color: var(--purple);
}

.status.inprogress {
  background: rgba(0, 112, 243, 0.1);
  color: var(--blue);
}

.status.ready {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.status.delivered {
  background: var(--bg3);
  color: var(--muted);
}

/* ===========================
   Buttons
=========================== */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-ar);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 112, 243, 0.2);
}

.btn-primary:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 112, 243, 0.3);
}

/* Filter Buttons */
.filter-btn {
  padding: 8px 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ar);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.filter-btn.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 2px 4px rgba(0, 112, 243, 0.2);
}

.btn-success {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background: #0D946A;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-ghost {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg3);
  border-color: #CBD5E1;
}

/* ===========================
   Forms & Inputs
=========================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-full {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) inset;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.15);
}

/* ===========================
   Search Box (Command K Style)
=========================== */
.search-box {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  position: relative;
}

.search-box .form-input {
  flex: 1;
  padding-right: 40px;
  height: 48px;
  font-size: 15px;
  border-radius: 24px;
}

.search-box i.ph-magnifying-glass {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
}

/* ===========================
   Modals (Glassmorphism)
=========================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 32px;
  width: 90%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
}

/* ===========================
   Sales Page (High-Speed POS)
=========================== */
.sales-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}

.cashier-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 24px;
  box-shadow: var(--shadow-card);
}

.cashier-header {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}

.cashier-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius-s);
  padding: 16px;
  margin-top: 24px;
  margin-bottom: 16px;
}

.cashier-total span {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.cashier-total .cashier-total-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--green);
  font-family: var(--font-en);
}

.discount-type-toggle {
  display: flex;
  background: var(--bg3);
  border-radius: var(--radius-s);
  overflow: hidden;
  border: 1px solid var(--border);
}

.disc-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.disc-btn.active {
  background: var(--blue);
  color: #fff;
}

/* ===========================
   Animations
=========================== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main>* {
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.main>*:nth-child(1) {
  animation-delay: 0.1s;
}

.main>*:nth-child(2) {
  animation-delay: 0.15s;
}

.main>*:nth-child(3) {
  animation-delay: 0.2s;
}

/* ===========================
   Toasts
=========================== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 32px;
  background: var(--text);
  color: #fff;
  padding: 14px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast.error {
  background: var(--red);
}

.toast.success {
  background: var(--green);
}

/* ===========================
   Sidebar User
=========================== */
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(0, 112, 243, 0.3);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state i {
  font-size: 48px;
  color: var(--border);
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
}