@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --navy: #1a56c4;
  --navy-light: #2563d4;
  --navy-mid: #3b72e0;
  --teal: #4a90e2;
  --teal-light: #5ba3f5;
  --teal-dim: rgba(74, 144, 226, 0.10);
  --white: #ffffff;
  --off-white: #f4f7fc;
  --text-primary: #0f1f35;
  --text-secondary: #5a6a7a;
  --text-muted: #8a9aaa;
  --border: #dde6f0;
  --border-dark: #c8d8ea;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 1px 3px rgba(26,86,196,0.08);
  --shadow-md: 0 4px 16px rgba(26,86,196,0.10);
  --shadow-lg: 0 8px 32px rgba(26,86,196,0.14);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--off-white);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── NAVBAR ── */
.navbar {
  background: var(--navy);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-logo {
  width: 32px;
  height: 32px;
  background: var(--teal);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: -0.5px;
}

.navbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.2px;
}

.navbar-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-user {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
}

.navbar-user strong {
  color: var(--white);
  font-weight: 500;
}

.btn-logout {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.14);
  color: var(--white);
}

/* ── TABS ── */
.tabs-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.tab-badge {
  background: var(--teal-dim);
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
}

/* ── MAIN LAYOUT ── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-section { display: none; }
.page-section.active { display: block; }

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ── PRODUCT GRID ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.product-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-dark);
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.product-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.product-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'DM Mono', monospace;
}

.product-price-block {
  text-align: right;
}

.product-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  font-family: 'DM Mono', monospace;
}

.product-savings {
  font-size: 11px;
  color: var(--success);
  font-weight: 500;
  margin-top: 2px;
}

.product-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1rem;
}

.qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.qty-btn {
  width: 32px;
  height: 36px;
  background: var(--off-white);
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover { background: var(--border); }

.qty-input {
  width: 44px;
  height: 36px;
  border: none;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.btn-add {
  flex: 1;
  background: var(--teal);
  color: var(--white);
  border: none;
  padding: 0 16px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}

.btn-add:hover { background: var(--teal-light); }
.btn-add.added { background: var(--success); }

/* ── MODEL SELECTOR ── */
.model-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.model-option {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.model-option.selected {
  border-color: var(--teal);
  background: var(--teal-dim);
}

.model-option-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.model-option-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── CART ── */
.cart-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .cart-container { grid-template-columns: 1fr; }
}

.cart-items { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }

.cart-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-name {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
}

.cart-item-qty {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: center;
}

.cart-item-total {
  font-weight: 500;
  font-size: 14px;
  min-width: 70px;
  text-align: right;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}

.cart-item-remove:hover { color: var(--danger); }

.cart-empty {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── ORDER SUMMARY ── */
.order-summary {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 76px;
}

.summary-header {
  background: var(--navy);
  padding: 1rem 1.25rem;
  color: var(--white);
  font-weight: 600;
  font-size: 14px;
}

.summary-body { padding: 1.25rem; }

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.summary-row span:last-child {
  font-weight: 500;
  color: var(--text-primary);
}

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

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.summary-total span:last-child {
  color: var(--navy);
}

.btn-submit {
  width: 100%;
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 13px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
  letter-spacing: 0.2px;
}

.btn-submit:hover { background: var(--navy-light); }
.btn-submit:disabled { background: var(--text-muted); cursor: not-allowed; }

.payment-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}

/* ── FORMS ── */
.form-group { margin-bottom: 1.25rem; }

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,180,162,0.12);
}

.form-textarea { min-height: 100px; resize: vertical; }

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

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── INFO BOX ── */
.info-box {
  background: var(--teal-dim);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.info-box strong { color: var(--text-primary); }

/* ── STATUS BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-info { background: var(--teal-dim); color: var(--teal); }
.badge-navy { background: rgba(15,31,53,0.08); color: var(--navy); }

/* ── ORDER HISTORY TABLE ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: var(--off-white);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--off-white); }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 48px;
  height: 48px;
  background: var(--navy);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--teal);
  margin-bottom: 1.5rem;
}

.login-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.btn-login {
  width: 100%;
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 13px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn-login:hover { background: var(--navy-light); }

.login-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1rem;
  display: none;
}

/* ── ADMIN STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--navy);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,31,53,0.6);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-secondary {
  background: var(--off-white);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}

.btn-secondary:hover { background: var(--border); }

.btn-primary {
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--navy-light); }

/* ── LOADING ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

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

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .tabs-bar { padding: 0 1rem; }
  .main-content { padding: 1.5rem 1rem; }
  .product-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .navbar-subtitle { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tab-btn { padding: 12px 14px; font-size: 13px; }
}
