/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #0A2A7A;
  --navy2:   #0F3885;
  --blue:    #1A6FD8;
  --accent:  #3B82F6;
  --green:   #10B981;
  --red:     #EF4444;
  --bg:      #F5F7FA;
  --surface: #FFFFFF;
  --border:  #E5E9F0;
  --text:    #0F172A;
  --muted:   #64748B;
  --radius:  14px;
  --shadow:  0 2px 16px rgba(10,42,122,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #0D1117;
    --surface: #161B27;
    --border:  #1E2A3D;
    --text:    #E8EDF5;
    --muted:   #7A8AAA;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Utilities ── */
.hidden { display: none !important; }
.screen { min-height: 100vh; }
.screen-center { display: flex; align-items: center; justify-content: center; }
.container { max-width: 900px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── Spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .nav { background: rgba(22,27,39,0.85); }
}
.nav-inner {
  max-width: 900px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-size: 18px; font-weight: 700; color: var(--navy); }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.role-badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; background: var(--navy); color: #fff;
}
.role-badge.store { background: var(--green); }

/* ── Login Card ── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 24px; }

/* ── Tabs ── */
.tab-group {
  display: flex; gap: 4px;
  background: var(--bg);
  border-radius: 10px; padding: 4px;
  margin-bottom: 24px;
}
.tab {
  flex: 1; padding: 8px;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  background: transparent; color: var(--muted);
  transition: all .2s;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ── Form Fields ── */
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; margin-top: 16px; }
.field-input, input[type=tel], input[type=number], input[type=email], input[type=password], input[type=text], input[type=search] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
input:focus { border-color: var(--accent); }
.phone-row { display: flex; align-items: center; gap: 8px; }
.phone-prefix {
  padding: 12px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px; color: var(--muted);
  background: var(--bg); white-space: nowrap;
}
.phone-row input { flex: 1; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; margin-top: 16px;
  padding: 14px;
  background: var(--navy);
  color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  width: 100%; margin-top: 10px;
  padding: 10px;
  background: transparent; color: var(--muted);
  border: none; font-size: 14px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

/* ── Error ── */
.error-msg {
  margin-top: 12px; padding: 10px 12px;
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: 10px; color: var(--red);
  font-size: 13px; text-align: center;
}

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-top: 8px;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.wallet-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 14px; font-weight: 600;
}

/* ── Search ── */
.search-input {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: 14px;
}

/* ── Store Grid ── */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.store-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(10,42,122,0.12); }
.store-card-icon { font-size: 32px; margin-bottom: 10px; }
.store-card-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.store-card-cat { font-size: 12px; color: var(--muted); }
.store-card-empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 48px; }

/* ── Stats Row ── */
.store-header { margin-bottom: 20px; padding-top: 8px; }
.store-header h2 { font-size: 22px; font-weight: 700; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--navy); }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Section Tabs ── */
.section-tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.sec-tab {
  padding: 10px 20px;
  border: none; background: transparent;
  font-size: 14px; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.sec-tab.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ── Orders List ── */
.orders-list, .products-list { display: flex; flex-direction: column; gap: 12px; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-id { font-size: 13px; color: var(--muted); }
.order-status {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px;
}
.status-pending { background: #FEF3C7; color: #92400E; }
.status-confirmed { background: #D1FAE5; color: #065F46; }
.status-ready { background: #DBEAFE; color: #1E40AF; }
.order-items { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.order-footer { display: flex; justify-content: space-between; align-items: center; }
.order-total { font-weight: 700; font-size: 15px; }
.order-actions { display: flex; gap: 8px; }
.btn-sm {
  padding: 6px 12px;
  border-radius: 8px; border: none;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.btn-confirm { background: var(--green); color: #fff; }
.btn-ready { background: var(--accent); color: #fff; }

/* ── Product Row ── */
.product-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
}
.product-row-info { flex: 1; }
.product-row-name { font-size: 14px; font-weight: 600; }
.product-row-cat { font-size: 12px; color: var(--muted); }
.product-row-price { font-size: 15px; font-weight: 700; color: var(--navy); }
.product-row-stock { font-size: 12px; color: var(--muted); text-align: right; }

/* ── Setup Card ── */
.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 400px; margin: 40px auto;
  text-align: center;
  box-shadow: var(--shadow);
}
.setup-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.setup-card p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.setup-card .field-input { text-align: left; }

/* ── Empty State ── */
.empty-state { text-align: center; color: var(--muted); padding: 48px 0; }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

/* ── Cookie Banner ── */
.cookie-banner {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  display: flex; align-items: center; gap: 16px;
  z-index: 9999;
}
.cookie-text { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.5; }
.cookie-text a { color: var(--accent); }
.btn-cookie {
  padding: 8px 18px;
  background: var(--navy); color: #fff;
  border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}

@media (max-width: 480px) {
  .login-card { padding: 32px 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat-card:last-child { grid-column: 1/-1; }
  .cookie-banner { flex-direction: column; align-items: flex-start; }
}
