/* Logged-in customer shop — clean e-commerce shell (light surface, navy accents, gold CTAs) */
:root {
  --cx-navy: #1e2d54;
  --cx-navy-mid: #2d3e6e;
  --cx-gold: #c9a227;
  --cx-gold-light: #e8c347;
  --cx-bg: #f4f6fb;
  --cx-card: #ffffff;
  --cx-border: #e8ecf4;
  --cx-muted: #647196;
  --cx-text: #1a2238;
}

/* Uses global dashboard shell from style.css (sidebar + main-wrapper). Typography + accents here. */
body.customer-app {
  font-family: 'Barlow', system-ui, sans-serif;
  color: var(--cx-text);
}

/* Topbar search (shared customer shell) */
.customer-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.customer-topbar-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.customer-topbar-search input[type='search'] {
  width: min(220px, 42vw);
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.84rem;
  font-family: inherit;
}
.customer-topbar-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--navy);
  color: var(--gold-light);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.customer-topbar-search button:hover {
  background: var(--navy-dark);
  color: #fff;
}

.sidebar-nav .nav-item .cx-sidebar-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
}

/* Fill the whole main content column (same as admin pages — no narrow “mobile column”). */
.cx-customer-page {
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}

.cx-hero {
  background: linear-gradient(135deg, var(--cx-navy) 0%, var(--cx-navy-mid) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 28px 26px;
  margin-bottom: 26px;
  position: relative;
  overflow: hidden;
}
.cx-hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid rgba(232, 195, 71, 0.2);
  pointer-events: none;
}
.cx-hero h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 900;
  margin: 0 0 8px;
  position: relative;
  z-index: 1;
}
.cx-hero p {
  margin: 0;
  opacity: 0.88;
  font-size: 0.95rem;
  max-width: min(920px, 90%);
  line-height: 1.55;
  position: relative;
  z-index: 1;
}

.cx-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}
.cx-toolbar select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 10px 38px 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--cx-border);
  font-family: inherit;
  min-width: 180px;
  cursor: pointer;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235a6580' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 8 10 13 15 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}
.cx-count {
  font-size: 0.86rem;
  color: var(--cx-muted);
  width: 100%;
}

.cx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 20px;
  align-items: stretch;
}
@media (min-width: 900px) {
  .cx-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1280px) {
  .customer-app .content-area .cx-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cx-card {
  background: var(--cx-card);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--cx-border);
  box-shadow: 0 8px 28px rgba(30, 45, 84, 0.06);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cx-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(30, 45, 84, 0.1);
}

.cx-card-media {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;
  flex: 0 0 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(45, 62, 110, 0.35);
  font-size: 2.2rem;
  border-bottom: 1px solid var(--cx-border);
}
.cx-card-media:not(:has(img)) {
  background: linear-gradient(145deg, #eef1f8, #dfe6f5);
}
.cx-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  padding: 0;
}

.cx-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.cx-card-info {
  flex: 1;
}
.cx-card-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--cx-border);
}
.cx-card-cat {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cx-gold);
  margin-bottom: 6px;
}
.cx-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.cx-card-code {
  font-size: 0.74rem;
  color: var(--cx-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}
.cx-card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.cx-card-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.28rem;
  font-weight: 900;
  color: var(--cx-navy);
  line-height: 1.1;
}
.cx-card-price small {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cx-muted);
}

.cx-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  width: fit-content;
  flex-shrink: 0;
}
.cx-pill-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.cx-pill-low {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.cx-pill-out {
  background: rgba(248, 113, 113, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.cx-flash {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #047857;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.cx-flash--danger {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: rgba(220, 38, 38, 0.35);
  color: #991b1b;
}

.cx-add-form {
  margin: 0;
}

/* Shared product-card button system */
.cx-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Barlow Condensed', sans-serif;
  text-decoration: none;
  border: 1px solid transparent;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.cx-btn:hover {
  transform: translateY(-1px);
}
.cx-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #ff6b4a 0%, #ee4d2d 55%, #e8341e 100%);
  box-shadow: 0 4px 12px rgba(238, 77, 45, 0.28);
}
.cx-btn-primary:hover {
  box-shadow: 0 6px 16px rgba(238, 77, 45, 0.38);
}
.cx-cart-added {
  filter: brightness(1.06);
}
.cx-oos-note {
  margin: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #b91c1c;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: 'Barlow Condensed', sans-serif;
  background: rgba(248, 113, 113, 0.08);
  border: 1px dashed rgba(248, 113, 113, 0.45);
  border-radius: 10px;
}

.cx-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cx-btn-outline {
  border-color: var(--cx-border);
  color: var(--cx-navy);
  background: #fff;
}
.cx-btn-outline:hover {
  background: #f8fafc;
}
.cx-btn-gold {
  background: linear-gradient(135deg, var(--cx-gold), var(--cx-gold-light));
  color: var(--cx-navy);
  border-color: rgba(201, 162, 39, 0.5);
}
.cx-btn-details {
  background: var(--cx-navy);
  color: #fff !important;
}
.cx-btn-details:hover {
  opacity: 0.92;
}

/* Legacy class used on cart / other pages */
.cx-add-cart {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #ff6b4a 0%, #ee4d2d 55%, #e8341e 100%);
  box-shadow: 0 4px 12px rgba(238, 77, 45, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}
.cx-add-cart:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(238, 77, 45, 0.38);
}
.cx-btn-link {
  width: 100%;
  text-align: center;
  padding: 10px 12px;
  min-height: 42px;
  border-radius: 10px;
  background: var(--cx-navy);
  color: #fff !important;
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Barlow Condensed', sans-serif;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cx-btn-link:hover {
  opacity: 0.92;
}

.customer-app .pagination {
  padding: 14px 0;
}

.cx-empty {
  text-align: center;
  padding: 48px 20px;
  background: #fff;
  border-radius: 14px;
  border: 1px dashed var(--cx-border);
  color: var(--cx-muted);
}
.cx-empty--cart i {
  font-size: 2.5rem;
  color: var(--cx-border);
  margin-bottom: 12px;
  display: block;
}
.cx-btn-shop {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ff6b4a, #ee4d2d);
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

/* --- Cart page --- */
.cx-cart-hero {
  margin-bottom: 20px;
}
.cx-cart-hero h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--cx-navy);
  margin: 0 0 6px;
}
.cx-cart-hero p {
  margin: 0;
  color: var(--cx-muted);
  font-size: 0.92rem;
  max-width: 560px;
  line-height: 1.5;
}
.cx-cart-warn {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #fef3c7;
  font-size: 0.82rem;
  max-width: 640px;
}
.cx-cart-warn code {
  font-size: 0.78em;
  background: rgba(0, 0, 0, 0.2);
  padding: 1px 6px;
  border-radius: 4px;
}

.cx-cart-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 120px;
}
.cx-cart-row {
  display: grid;
  grid-template-columns: 88px 1fr auto auto auto;
  gap: 14px 16px;
  align-items: center;
  background: var(--cx-card);
  border: 1px solid var(--cx-border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 18px rgba(30, 45, 84, 0.05);
}
.cx-cart-thumb {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: #eef1f8;
}
.cx-cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cx-cart-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(45, 62, 110, 0.35);
  font-size: 1.5rem;
}
.cx-cart-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--cx-text);
}
.cx-cart-meta {
  font-size: 0.78rem;
  color: var(--cx-muted);
}
.cx-cart-stock-note {
  font-size: 0.72rem;
  color: var(--cx-muted);
  margin-top: 4px;
}
.cx-cart-line-total {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--cx-navy);
  white-space: nowrap;
}
.cx-qty-form {
  margin: 0;
}
.cx-qty-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cx-muted);
  margin-bottom: 4px;
}
.cx-qty-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--cx-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.cx-qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f4f6fb;
  color: var(--cx-navy);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.cx-qty-btn:hover:not(:disabled) {
  background: #e8ecf4;
}
.cx-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cx-qty-input {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 36px;
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--cx-navy);
  background: #fff;
}
.cx-cart-remove-form {
  margin: 0;
}
.cx-cart-remove {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #fef2f2;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.95rem;
}
.cx-cart-remove:hover {
  background: #fee2e2;
}

/* Align with dashboard shell: sidebar is fixed 260px — bar must not sit under it (was left:0 full viewport). */
.cx-cart-bar {
  position: fixed;
  left: var(--sidebar-w, 260px);
  right: 0;
  bottom: 0;
  z-index: 300;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--cx-border);
  box-shadow: 0 -8px 32px rgba(30, 45, 84, 0.08);
}
@media (max-width: 768px) {
  body.customer-app .cx-cart-bar {
    left: 0;
  }
}
.cx-cart-bar-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.cx-cart-total-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cx-cart-total-label {
  font-size: 0.75rem;
  color: var(--cx-muted);
  font-weight: 600;
}
.cx-cart-total-amt {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
  color: #ee4d2d;
}
.cx-cart-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.cx-btn-clear {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--cx-border);
  background: #fff;
  color: var(--cx-muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}
.cx-btn-checkout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ff6b4a, #ee4d2d);
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.82rem;
  box-shadow: 0 4px 14px rgba(238, 77, 45, 0.35);
}
.cx-btn-checkout:hover {
  filter: brightness(1.05);
}
.cx-checkout-form {
  margin: 0;
  display: inline-block;
}
.cx-btn-checkout--secondary {
  background: #fff !important;
  color: var(--cx-navy) !important;
  border: 2px solid var(--cx-border) !important;
  box-shadow: none !important;
}
.cx-btn-checkout--secondary:hover {
  filter: none;
  background: #f4f6fb !important;
}

.cx-orders-table-wrap {
  overflow-x: auto;
  background: var(--cx-card);
  border: 1px solid var(--cx-border);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(30, 45, 84, 0.05);
}
.cx-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.cx-orders-table th,
.cx-orders-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--cx-border);
}
.cx-orders-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cx-muted);
  font-weight: 800;
}
.cx-orders-table tr:last-child td {
  border-bottom: none;
}
.cx-order-note {
  font-size: 0.75rem;
  color: var(--cx-muted);
  margin-top: 4px;
}

@media (max-width: 720px) {
  .cx-cart-row {
    position: relative;
    padding-right: 52px;
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto auto;
  }
  .cx-cart-thumb {
    width: 72px;
    height: 72px;
    grid-row: span 2;
  }
  .cx-cart-qty {
    grid-column: 2;
  }
  .cx-cart-line-total {
    grid-column: 2;
    justify-self: start;
  }
  .cx-cart-remove-form {
    position: absolute;
    top: 14px;
    right: 14px;
  }
}

@media (max-width: 720px) {
  .customer-topbar-search input[type='search'] {
    width: min(160px, 36vw);
  }
}
