/* ============================================================
   The Slimming Lounge - Design System
   ============================================================ */

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

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg:            #FDF6F5;
  --bg-subtle:     #F9E4E2;
  --bg-card:       #FFFFFF;
  --bg-hero:       #000000;

  /* Text */
  --text:          #121012;
  --muted:         #6B5457;
  --text-on-hero:  #F9E4E2;

  /* Brand */
  --pink:          #DB5A68;
  --pink-hi:       #F67A8F;
  --rose:          #962A2A;
  --gold:          #E4A685;

  /* Lines */
  --border:        rgba(150, 42, 42, 0.14);
  --border-strong: #E4A685;

  /* Gradients */
  --grad:          linear-gradient(135deg, #F67A8F 0%, #DB5A68 50%, #962A2A 100%);
  --grad-gold:     linear-gradient(135deg, #F3CDB8 0%, #E4A685 50%, #C98462 100%);

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(18, 16, 18, 0.06);
  --shadow:        0 2px 8px rgba(18, 16, 18, 0.08);
  --shadow-lg:     0 4px 20px rgba(18, 16, 18, 0.12);

  /* Radii */
  --radius:        8px;
  --radius-sm:     4px;
  --radius-lg:     12px;

  /* Sidebar */
  --sidebar-w:     260px;

  /* Transitions */
  --ease:          0.2s ease;
}


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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--rose);
  text-decoration: none;
  transition: color var(--ease);
}
a:hover {
  color: var(--pink);
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}


/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: 2rem;   margin-bottom: 1rem; }
h2 { font-size: 1.6rem; margin-bottom: 0.85rem; }
h3 { font-size: 1.3rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.6rem; }
h5 { font-size: 1rem;   margin-bottom: 0.5rem; }
h6 { font-size: 0.875rem; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }

.accent-font {
  font-family: 'Allura', cursive;
}

p + p {
  margin-top: 0.75rem;
}

small {
  font-size: 0.8125rem;
}


/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
  white-space: nowrap;
  text-align: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--rose);
  color: #FFFFFF;
  border-color: var(--rose);
}
.btn-primary:hover:not(:disabled) {
  background: #7a2222;
  border-color: #7a2222;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--rose);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: #f3d5d2;
  border-color: var(--gold);
}

.btn-outline {
  background: transparent;
  color: var(--rose);
  border-color: var(--rose);
}
.btn-outline:hover:not(:disabled) {
  background: var(--rose);
  color: #FFFFFF;
}

.btn-danger {
  background: #dc2626;
  color: #FFFFFF;
  border-color: #dc2626;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-sm {
  padding: 0.35rem 0.9rem;
  font-size: 0.8125rem;
}


/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease);
}

.card:hover {
  box-shadow: var(--shadow);
}


/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-pink {
  background: rgba(219, 90, 104, 0.12);
  color: var(--pink);
}

.badge-rose {
  background: rgba(150, 42, 42, 0.1);
  color: var(--rose);
}

.badge-gold {
  background: rgba(228, 166, 133, 0.18);
  color: #A06B4A;
}

.badge-green {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.badge-muted {
  background: rgba(107, 84, 87, 0.1);
  color: var(--muted);
}


/* ---------- Pills (order status) ---------- */
.pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  white-space: nowrap;
  text-transform: capitalize;
}

.pill-quote {
  background: rgba(107, 84, 87, 0.12);
  color: #6B5457;
}

.pill-confirmed {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.pill-paid {
  background: rgba(219, 90, 104, 0.12);
  color: #DB5A68;
}

.pill-processing {
  background: rgba(150, 42, 42, 0.1);
  color: #962A2A;
}

.pill-dispatched {
  background: rgba(228, 166, 133, 0.15);
  color: #A06B4A;
}

.pill-delivered {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.pill-integrity_hold {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}


/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(228, 166, 133, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #baa4a7;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B5457' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

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

.form-error {
  font-size: 0.8125rem;
  color: #dc2626;
  margin-top: 0.3rem;
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: #dc2626;
}


/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.table-wrap table {
  min-width: 600px;
}

table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}

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

table tbody tr:hover {
  background: rgba(249, 228, 226, 0.3);
}


/* ---------- Modals ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

.modal.is-active {
  display: flex;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 18, 0.45);
  z-index: 9001;
}

.modal-content {
  position: relative;
  z-index: 9002;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.25rem;
  transition: background var(--ease);
}
.modal-close:hover {
  background: var(--bg-subtle);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}


/* ---------- Sidebar (owner / reseller) ---------- */
.layout-sidebar {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-hero);
  color: var(--text-on-hero);
  display: flex;
  flex-direction: column;
  z-index: 800;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(249, 228, 226, 0.1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.sidebar-profile {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(249, 228, 226, 0.1);
  font-size: 0.875rem;
}

.sidebar-profile .profile-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  color: rgba(249, 228, 226, 0.7);
  transition: background var(--ease), color var(--ease);
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: rgba(249, 228, 226, 0.06);
  color: var(--text-on-hero);
}

.sidebar-link.active {
  background: rgba(249, 228, 226, 0.1);
  color: #FFFFFF;
  border-left-color: var(--gold);
  font-weight: 600;
}

.sidebar-link svg,
.sidebar-link .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link.active .icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(249, 228, 226, 0.1);
  font-size: 0.8125rem;
}

.sidebar-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}


/* ---------- Top Navigation (client / guest) ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 700;
  background: var(--bg-hero);
  color: var(--text-on-hero);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 60px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.topnav-brand {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-on-hero);
  white-space: nowrap;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topnav-link {
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(249, 228, 226, 0.75);
  border-radius: var(--radius);
  transition: background var(--ease), color var(--ease);
}

.topnav-link:hover {
  color: #FFFFFF;
  background: rgba(249, 228, 226, 0.08);
}

.topnav-link.active {
  color: #FFFFFF;
  background: rgba(249, 228, 226, 0.12);
  font-weight: 600;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--pink-hi);
  color: #FFFFFF;
  border-radius: 100px;
  margin-left: 0.3rem;
}

.cart-badge:empty,
.cart-badge[data-count="0"] {
  display: none;
}


/* ---------- Mobile hamburger ---------- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  cursor: pointer;
  z-index: 900;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text-on-hero);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.is-open span:nth-child(2) {
  opacity: 0;
}
.hamburger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 790;
}

.mobile-overlay.is-active {
  display: block;
}


/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease forwards;
  max-width: 380px;
}

.toast-success {
  background: #16a34a;
  color: #FFFFFF;
}

.toast-error {
  background: #dc2626;
  color: #FFFFFF;
}

.toast.is-leaving {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}


/* ---------- Loader ---------- */
.loader {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loader-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.page-loader {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

body.auth-loading .page-loader {
  display: flex;
}

.coin-spin {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  animation: coinSpin 1.2s ease-in-out infinite;
}

@keyframes coinSpin {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

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


/* ---------- Stats Grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--rose);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-card .stat-value {
  font-family: 'Cinzel', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card .stat-sub {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.25rem;
}


/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state svg,
.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.35;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 360px;
  margin: 0 auto;
}


/* ---------- Auth loading ---------- */
body.auth-loading > *:not(.page-loader):not(script) {
  visibility: hidden;
}


/* ---------- Legal Footer ---------- */
.legal-footer {
  background: var(--bg-hero);
  color: rgba(249, 228, 226, 0.65);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  font-size: 0.75rem;
  line-height: 1.7;
}

.legal-footer-inner {
  max-width: 900px;
  margin: 0 auto;
}

.legal-footer h6 {
  color: var(--gold);
  font-size: 0.7rem;
  font-family: 'Montserrat', sans-serif;
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}

.legal-footer h6:first-child {
  margin-top: 0;
}

.legal-footer p {
  margin-bottom: 0.5rem;
}

.legal-footer a {
  color: var(--gold);
}


/* ---------- Page content wrapper ---------- */
.page-content {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9375rem;
}


/* ---------- Utility classes ---------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--muted); }
.text-pink   { color: var(--pink); }
.text-rose   { color: var(--rose); }
.text-gold   { color: var(--gold); }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex         { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-1        { gap: 0.5rem; }
.gap-2        { gap: 1rem; }

.hidden  { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}


/* ---------- Responsive: tablet and below ---------- */
@media (max-width: 768px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.15rem; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-content {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content {
    padding: 1rem;
  }

  .topnav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-hero);
    flex-direction: column;
    padding: 0.75rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  .topnav-links.is-open {
    display: flex;
  }

  .topnav-link {
    width: 100%;
    padding: 0.65rem 1.5rem;
    border-radius: 0;
  }

  .modal-content {
    max-width: 100%;
    margin: 0 0.5rem;
    border-radius: var(--radius);
  }

  .table-wrap table {
    min-width: 500px;
  }
}


/* ---------- Responsive: mobile ---------- */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 0.55rem 1rem;
    font-size: 0.8125rem;
  }

  .stat-card .stat-value {
    font-size: 1.4rem;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    max-width: 100%;
  }
}


/* ---------- Print ---------- */
@media print {
  .sidebar,
  .topnav,
  .hamburger,
  .mobile-overlay,
  .toast-container,
  .cart-badge,
  .btn,
  .legal-footer {
    display: none !important;
  }

  .sidebar-content {
    margin-left: 0 !important;
  }

  body {
    background: #FFFFFF;
    color: #000000;
    font-size: 12pt;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  a {
    color: #000000;
    text-decoration: underline;
  }

  .page-content {
    max-width: 100%;
    padding: 0;
  }
}
