:root {
  --navy: #1a2744;
  --navy-dark: #111b33;
  --navy-light: #243358;
  --accent: #2e7de0;
  --accent-hover: #2468c7;
  --accent-light: #eff6ff;
  --bg: #f4f6fa;
  --white: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --sidebar-width: 230px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Login page ─────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--navy-dark);
}

.login-hero {
  padding: 60px 32px 44px;
  text-align: center;
}

.login-brand {
  font-size: 38px;
  font-weight: 800;
  color: var(--white);
  margin: 0 0 10px;
  letter-spacing: -1.5px;
}

.login-tagline {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  margin: 0 0 28px;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

.login-hero-bullets {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.login-hero-bullets span {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 7px;
}

.login-hero-bullets span::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(74,222,128,0.2);
  color: #4ade80;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.login-cards {
  display: flex;
  gap: 24px;
  justify-content: center;
  padding: 0 32px 40px;
  flex-wrap: wrap;
  align-items: start;
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  flex: 1;
  min-width: 300px;
}

.login-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}

.login-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.login-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 24px;
}

.login-footer {
  text-align: center;
  padding: 0 32px 48px;
  font-size: 13px;
  color: rgba(255,255,255,0.35);
}

.login-footer a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
}

.login-footer a:hover { color: var(--white); }

/* ── Layout ─────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  margin-top: 3px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
}

.sidebar-nav a.active {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border-left-color: var(--accent);
  padding-left: 17px;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 15px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-customer {
  margin-bottom: 12px;
}

.sidebar-customer-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-customer-email {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── Main content area ───────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* ── Account info strip ──────────────────────────────────────────────── */
.account-strip {
  background: var(--accent-light);
  border-bottom: 1px solid #bfdbfe;
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: #1e40af;
  flex-wrap: wrap;
}

.account-strip-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.account-strip-label {
  color: #3b82f6;
  font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(46,125,224,0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 3px 8px rgba(46,125,224,0.35);
}

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}
.btn-danger:hover { background: #fecaca; }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-full { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,125,224,0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Filter bar ──────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-bar .form-select,
.filter-bar .form-input {
  width: auto;
  font-size: 13px;
  padding: 7px 10px;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.filter-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}

.filter-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Product grid ────────────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.product-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg);
  display: block;
}

.product-card-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.product-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}

.product-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.product-card-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.product-card-controls .form-input {
  width: 64px;
  text-align: center;
  padding: 7px 8px;
}

.product-card-controls .form-select {
  flex: 1;
  padding: 7px 8px;
  font-size: 13px;
}

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: var(--white);
}

.badge-danger { background: var(--danger); }
.badge-success { background: var(--success); }

.out-of-stock-badge {
  display: inline-block;
  padding: 3px 8px;
  background: #fee2e2;
  color: var(--danger);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: var(--accent-light);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* ── Cart table ──────────────────────────────────────────────────────── */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cart-table th {
  background: #f8fafc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.cart-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

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

.cart-table .qty-input {
  width: 70px;
  text-align: center;
  padding: 6px 8px;
}

.cart-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

/* ── Cart + Address layout ───────────────────────────────────────────── */
.cart-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 28px;
  align-items: start;
}

.cart-panel,
.address-panel {
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ── Checkout layout ─────────────────────────────────────────────────── */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.spinner-dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--accent);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading state ───────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-muted);
  gap: 12px;
  font-size: 14px;
}

/* ── Confirmation ────────────────────────────────────────────────────── */
.confirmation-card {
  max-width: 520px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 52px 48px;
  text-align: center;
}

.confirmation-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}

.confirmation-icon-success {
  background: #dcfce7;
  color: var(--success);
}

.confirmation-icon-error {
  background: #fee2e2;
  color: var(--danger);
}

.confirmation-card h2 {
  color: var(--navy);
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}

.confirmation-card p {
  color: var(--text-muted);
  margin: 0 0 28px;
  line-height: 1.65;
}

/* ── Nav cart badge ──────────────────────────────────────────────────── */
.nav-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cart-layout,
  .checkout-layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .main { margin-left: 0; }
  .sidebar-nav {
    display: flex;
    padding: 0;
    overflow-x: auto;
  }
  .sidebar-nav a {
    white-space: nowrap;
    padding: 12px 16px;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  .sidebar-nav a.active {
    border-left: none;
    border-bottom-color: var(--accent);
    padding-left: 16px;
  }
  .sidebar-footer { display: none; }
  .page-content { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .account-strip { padding: 10px 16px; }
  .page-header { padding: 16px; }
  .filter-bar { padding: 10px 16px; }
}
