/* =====================================================================
   Supermarket POS - Global Stylesheet
   Mobile-First. No heavy CSS frameworks. CSS variables for theming.
   ===================================================================== */

:root {
  --color-primary: #5b5ef7;
  --color-primary-dark: #3f41d8;
  --color-secondary: #06b6d4;
  --color-accent: #f97316;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;
  --color-bg: #eef2ff;
  --color-surface: rgba(255, 255, 255, 0.88);
  --color-surface-strong: #ffffff;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: rgba(148, 163, 184, 0.22);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --tap-target: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --card-bg: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.82));
}

[data-theme="dark"] {
  --color-bg: #070b17;
  --color-surface: rgba(17, 24, 39, 0.88);
  --color-surface-strong: #111827;
  --color-text: #e5e7eb;
  --color-text-muted: #94a3b8;
  --color-border: rgba(148, 163, 184, 0.16);
  --card-bg: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(17, 24, 39, 0.82));
  --card-border: rgba(148, 163, 184, 0.14);
}
[data-theme="dark"] .btn-outline {
  background: rgba(30, 41, 59, 0.62);
  color: #a5b4fc;
  border-color: rgba(91, 94, 247, 0.28);
}
[data-theme="dark"] .btn-outline:hover {
  background: rgba(30, 41, 59, 0.84);
  border-color: rgba(91, 94, 247, 0.42);
}
[data-theme="dark"] .btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* no horizontal scrolling */
}

body {
  font-family: -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(91, 94, 247, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(6, 182, 212, 0.18), transparent 26%),
    radial-gradient(circle at bottom center, rgba(249, 115, 22, 0.10), transparent 22%),
    var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  background-attachment: fixed;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
}

body::before {
  width: 220px;
  height: 220px;
  right: -40px;
  top: 10vh;
  background: rgba(91, 94, 247, 0.30);
}

body::after {
  width: 260px;
  height: 260px;
  left: -60px;
  bottom: 8vh;
  background: rgba(6, 182, 212, 0.24);
}

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

.container { width: 100%; padding: 18px; max-width: 1180px; margin: 0 auto; }

.page-shell {
  padding: 20px;
  max-width: 1180px;
  margin: 0 auto;
}

.page-shell.tight { max-width: 980px; }

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* ---- Buttons: large, touch friendly (min 48px tap target) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap-target);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  box-shadow: var(--shadow-soft);
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline {
  background: rgba(255, 255, 255, 0.62);
  color: var(--color-primary);
  border: 1.5px solid rgba(91, 94, 247, 0.18);
  box-shadow: none;
}
.btn-outline:hover {
  border-color: rgba(91, 94, 247, 0.32);
  background: rgba(255, 255, 255, 0.84);
}
.btn-danger { background: linear-gradient(135deg, #ef4444, #fb7185); }
.btn-success { background: linear-gradient(135deg, #10b981, #22c55e); }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #fb923c); color: #fff; }
.btn-info { background: linear-gradient(135deg, #3b82f6, #06b6d4); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: none;
}

/* ---- Form controls ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--color-text-muted); }
.form-control {
  width: 100%;
  min-height: var(--tap-target);
  padding: 10px 14px;
  font-size: 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-strong);
  color: var(--color-text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: rgba(91, 94, 247, 0.55);
  box-shadow: 0 0 0 4px rgba(91, 94, 247, 0.12);
}

/* ---- Card / Surface ---- */
.card {
  background: var(--card-bg, linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.82)));
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  border-color: rgba(91, 94, 247, 0.18);
}

.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.soft-panel {
  background: linear-gradient(135deg, rgba(91, 94, 247, 0.12), rgba(6, 182, 212, 0.10));
  border: 1px solid rgba(91, 94, 247, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-danger { background: linear-gradient(135deg, rgba(254, 226, 226, 0.92), rgba(253, 164, 175, 0.35)); color: #991b1b; border-color: rgba(239, 68, 68, 0.18); }
.alert-success { background: linear-gradient(135deg, rgba(220, 252, 231, 0.92), rgba(134, 239, 172, 0.36)); color: #166534; border-color: rgba(16, 185, 129, 0.18); }
.alert-info { background: linear-gradient(135deg, rgba(219, 234, 254, 0.92), rgba(147, 197, 253, 0.35)); color: #1d4ed8; border-color: rgba(59, 130, 246, 0.18); }
.alert-warning { background: linear-gradient(135deg, rgba(254, 243, 199, 0.92), rgba(253, 186, 116, 0.35)); color: #92400e; border-color: rgba(245, 158, 11, 0.18); }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Bottom Navigation (mobile) ---- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: rgba(255,255,255,0.82);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.08);
  padding-bottom: var(--safe-bottom);
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0 12px;
  font-size: 11px;
  color: var(--color-text-muted);
  transition: color 0.15s ease, transform 0.15s ease;
}
.bottom-nav a.active {
  color: var(--color-primary);
  transform: translateY(-1px);
}
.bottom-nav a.active span {
  background: linear-gradient(135deg, rgba(91, 94, 247, 0.14), rgba(6, 182, 212, 0.14));
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---- Floating Action Button ---- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(72px + var(--safe-bottom));
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 14px 30px rgba(91, 94, 247, 0.28);
  border: none;
  z-index: 60;
}

/* ---- Login screen specific ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}
.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo h1 {
  font-size: 30px;
  margin: 10px 0 0;
  letter-spacing: -0.03em;
}
.login-screen .container {
  max-width: 1120px;
}
.theme-toggle {
  position: fixed;
  top: 16px; right: 16px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  min-width: 44px; height: 44px;
  padding: 0 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  align-items: center;
  width: 100%;
}

.auth-hero {
  padding: 32px;
  border-radius: 28px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(91, 94, 247, 0.96), rgba(6, 182, 212, 0.88)),
    linear-gradient(135deg, #5b5ef7, #06b6d4);
  box-shadow: 0 30px 80px rgba(91, 94, 247, 0.28);
  position: relative;
  overflow: hidden;
}

.auth-hero::after {
  content: "";
  position: absolute;
  inset: auto -20px -30px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  filter: blur(4px);
}

.auth-hero h2,
.auth-hero h1 {
  margin: 0 0 10px;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.auth-hero p {
  margin: 0;
  max-width: 540px;
  color: rgba(255,255,255,0.88);
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.feature-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  backdrop-filter: blur(10px);
}

.feature-pill strong { display: block; font-size: 14px; }
.feature-pill span { display: block; font-size: 12px; color: rgba(255,255,255,0.8); }

.login-card {
  border-radius: 28px;
  overflow: hidden;
}

.login-card .card {
  padding: 28px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.hero-grid {
  display: block;
}

.hero-panel {
  padding: 26px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(91, 94, 247, 0.96), rgba(6, 182, 212, 0.90)),
    linear-gradient(135deg, #5b5ef7, #06b6d4);
  color: #fff;
  box-shadow: 0 30px 80px rgba(91, 94, 247, 0.28);
  position: relative;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}

.hero-panel h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: -0.05em;
}

.hero-panel p {
  margin: 10px 0 0;
  max-width: 700px;
  color: rgba(255,255,255,0.90);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-actions .btn,
.hero-actions .btn-outline,
.hero-actions .btn-ghost {
  width: auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--color-border);
  background: var(--card-bg, linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.80)));
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -24px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.25;
}

.stat-card.primary::after { background: rgba(91, 94, 247, 0.30); }
.stat-card.success::after { background: rgba(16, 185, 129, 0.30); }
.stat-card.warning::after { background: rgba(245, 158, 11, 0.32); }
.stat-card.info::after { background: rgba(59, 130, 246, 0.32); }

.stat-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-subtext {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.action-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--color-border);
  background: var(--card-bg, linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.82)));
  box-shadow: var(--shadow-soft);
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.action-card:hover {
  transform: translateY(-3px);
  border-color: rgba(91, 94, 247, 0.20);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.10);
}

.action-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  box-shadow: var(--shadow-soft);
}

.action-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.action-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.chip.primary { background: rgba(91, 94, 247, 0.12); color: var(--color-primary); border-color: rgba(91, 94, 247, 0.16); }
.chip.success { background: rgba(16, 185, 129, 0.12); color: #059669; border-color: rgba(16, 185, 129, 0.16); }
.chip.warning { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.16); }
.chip.info { background: rgba(59, 130, 246, 0.12); color: #2563eb; border-color: rgba(59, 130, 246, 0.16); }

.table-wrap,
.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.responsive-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.responsive-table th,
.responsive-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.responsive-table thead th {
  background: linear-gradient(135deg, rgba(91, 94, 247, 0.08), rgba(6, 182, 212, 0.08));
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.responsive-table tbody tr:hover td {
  background: rgba(91, 94, 247, 0.04);
}

.banner {
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(91, 94, 247, 0.12), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(91, 94, 247, 0.14);
}

.banner h3,
.banner h4,
.banner h5 { margin: 0 0 6px; }

.banner p { margin: 0; color: var(--color-text-muted); }

@media (max-width: 992px) {
  .grid-3,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-hero h2,
  .auth-hero h1 {
    font-size: 34px;
  }
}

@media (max-width: 768px) {
  .container { padding: 12px; }
  .page-shell { padding: 12px; }
  .grid-2,
  .grid-3,
  .grid-auto,
  .stat-grid,
  .action-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .hero-panel,
  .auth-hero,
  .login-card .card {
    border-radius: 20px;
    padding: 16px;
  }
  .hero-actions {
    flex-direction: column;
    gap: 8px;
  }
  .hero-actions .btn {
    width: 100%;
  }
  .form-control, input, select, textarea {
    font-size: 16px !important; /* Prevents auto-zoom on mobile devices */
  }
  /* Bottom navigation clearance */
  body {
    padding-bottom: calc(75px + var(--safe-bottom));
  }
  .table-wrap,
  .table-card {
    border-radius: 14px;
    margin-left: -4px;
    margin-right: -4px;
  }
}

@media (max-width: 480px) {
  .container, .page-shell {
    padding: 8px;
  }
  .card {
    padding: 14px;
    border-radius: 16px;
  }
  .stat-value {
    font-size: 26px;
  }
  .banner {
    padding: 14px;
  }
}

/* ---- Responsive: tablet/desktop widen container ---- */
@media (min-width: 768px) {
  .container { max-width: 1180px; }
}
@media (min-width: 1200px) {
  .container { max-width: 1240px; }
}
