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

:root {
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --ink: #1d1d1f;
  --muted: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --bg-body: #f5f5f7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #34c759;
  --danger: #ff3b30;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.06);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Glassmorphism Navbar */
.app-navbar {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 1040;
}

.app-brand {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink) !important;
  text-decoration: none;
}

.nav-logo {
  border-radius: var(--radius-sm);
  height: 40px;
  object-fit: contain;
  width: 40px;
  margin-right: 0.5rem;
}

.navbar-nav .nav-link {
  color: var(--muted) !important;
  font-weight: 500;
  transition: color 0.2s ease;
  padding: 0.5rem 1rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  color: var(--ink) !important;
}

.navbar-text {
  color: var(--ink) !important;
  font-weight: 500;
}

/* Buttons */
.btn {
  border-radius: 999px; /* Pill shape standard for some Apple buttons, or use radius-sm for squircles. We will use squircles for standard, pill for nav. */
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0.5rem 1.25rem;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
}

.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
  background-color: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.4);
}

.btn-outline-light {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-solid);
}

.btn-outline-light:hover {
  background: var(--line);
  color: var(--ink);
  border-color: transparent;
}

/* Forms */
.form-control,
.form-select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background-color: var(--surface-solid);
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
  outline: none;
}

/* Layout and Panels */
.content-band {
  max-width: 1200px;
  margin: 0 auto;
}

.content-band.narrow {
  max-width: 600px;
}

.panel,
.login-panel,
.metric-box,
.scanner-zone,
.sale-zone {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hover effects for interactive cards */
.metric-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* Login Shell */
.login-shell {
  background-image: radial-gradient(circle at 50% -20%, #e2eafc, #f5f5f7);
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.25rem;
}

.login-panel {
  width: min(100%, 400px);
  padding: 2.5rem 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.login-logo {
  border-radius: var(--radius-md);
  display: block;
  margin: 0 auto 1.5rem;
  width: 100px;
  height: 100px;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

/* Metrics */
.metric-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.metric-box span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.metric-box strong {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.metric-primary {
  background: linear-gradient(135deg, var(--accent), #005bb5);
  border: none;
  color: white;
}

.metric-primary span,
.metric-primary strong {
  color: white;
}

/* Stall & Cashier Shell */
.stall-shell {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(320px, 1fr) 420px;
  margin: 0 auto;
  max-width: 1200px;
}

#qr-reader {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: none !important;
  box-shadow: inset 0 0 0 1px var(--line);
}

.client-state {
  background: #fcfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.client-state strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.client-state .balance {
  color: var(--success);
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-top: 0.5rem;
}

.client-state.muted {
  color: var(--muted);
}

.cashier-reader {
  min-height: 300px;
}

.muted-reader {
  align-items: center;
  background: #f9f9fb;
  border: 2px dashed #d2d2d7;
  border-radius: var(--radius-md);
  color: var(--muted);
  display: flex;
  justify-content: center;
  font-weight: 500;
}

/* Tables */
.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
  vertical-align: middle;
}

.table th {
  font-weight: 600;
  color: var(--muted);
  border-bottom-width: 2px;
  border-bottom-color: var(--line);
}

.table td {
  border-bottom-color: var(--line);
  color: var(--ink);
}

.badge {
  padding: 0.4em 0.8em;
  border-radius: 999px;
  font-weight: 600;
}

.badge.text-bg-success {
  background-color: rgba(52, 199, 89, 0.15) !important;
  color: var(--success) !important;
}

.toast-stack {
  margin: 0 auto 1.5rem;
  max-width: 600px;
}

.alert {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

@media (max-width: 900px) {
  .metric-grid,
  .stall-shell {
    grid-template-columns: 1fr;
  }

  .navbar-text {
    display: block;
    margin-bottom: 1rem;
  }
}
