@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@400;600;700&display=swap');

:root {
  --cream: #F1F8F6;
  --cream-dark: #E0EDE8;
  --blue: #2D6E8E;
  --blue-dark: #20536B;
  --green: #4C8C5F;
  --green-dark: #3A6F49;
  --teal: #3FA7A0;
  --navy: #1F3A52;
  --text: #1E2B28;
  --muted: #5C7268;
  --white: #FFFFFF;
  --success: #2E9A57;
  --danger: #C0463A;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 14px rgba(30, 43, 40, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, .display {
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 700;
  margin: 0 0 0.5em;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header --- */

.site-header {
  background: var(--blue);
  color: var(--white);
  padding: 16px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  color: var(--white);
}

.brand .name {
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.brand .tagline {
  font-size: 13px;
  opacity: 0.9;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav a {
  color: var(--white);
  font-weight: 600;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.auth-nav .who {
  opacity: 0.95;
}

.auth-nav .admin-link {
  background: var(--teal);
  color: var(--navy);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

.cart-button {
  position: relative;
  background: var(--teal);
  color: var(--navy);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--navy);
  color: var(--white);
  border-radius: 999px;
  font-size: 12px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }

.btn-secondary { background: var(--green); color: var(--white); }
.btn-secondary:hover { background: var(--green-dark); }

.btn-ghost { background: transparent; color: var(--blue); border: 2px solid var(--blue); }

.btn-danger { background: var(--danger); color: var(--white); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Wavy divider --- */

.wavy-divider {
  width: 100%;
  height: 24px;
  margin: 32px 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 20'%3E%3Cpath d='M0 10 Q 15 0, 30 10 T 60 10 T 90 10 T 120 10' fill='none' stroke='%232D6E8E' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 90px 20px;
  opacity: 0.6;
}

/* --- Cards --- */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 16px 0 8px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card .img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.product-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; }

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

.product-card .name { font-weight: 700; font-size: 17px; }
.product-card .desc { color: var(--muted); font-size: 13px; flex: 1; }
.product-card .price { color: var(--blue); font-weight: 800; font-size: 18px; }

.qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.qty-row .stepper {
  display: flex;
  align-items: center;
  border: 2px solid var(--cream-dark);
  border-radius: 999px;
}

.qty-row .stepper button {
  background: none;
  border: none;
  width: 30px;
  height: 30px;
  font-size: 18px;
  cursor: pointer;
  color: var(--blue);
}

.qty-row .stepper span { min-width: 24px; text-align: center; font-weight: 700; }

/* --- Category section --- */

.category-section h2 {
  color: var(--green-dark);
  font-size: 24px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 16px;
}

/* --- Cart drawer --- */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 43, 40, 0.4);
  z-index: 40;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(380px, 100%);
  background: var(--cream);
  z-index: 41;
  box-shadow: -8px 0 24px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.cart-drawer .close-btn {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
}

.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--cream-dark);
  gap: 8px;
}

.cart-line .info { flex: 1; }
.cart-line .name { font-weight: 700; font-size: 14px; }
.cart-line .price { color: var(--muted); font-size: 13px; }

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
  font-weight: 800;
  margin: 16px 0;
  color: var(--blue);
}

/* --- Forms --- */

label { font-weight: 700; font-size: 14px; display: block; margin-bottom: 4px; }

input, textarea, select {
  width: 100%;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  background: var(--white);
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--teal);
}

.field { margin-bottom: 16px; }

.radio-row { display: flex; gap: 16px; margin-bottom: 8px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.radio-row input { width: auto; }

.helper-text { color: var(--muted); font-size: 13px; margin-top: 4px; }

.error-text { color: var(--danger); font-size: 14px; margin: 8px 0; font-weight: 700; }
.success-text { color: var(--success); font-size: 14px; margin: 8px 0; font-weight: 700; }

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
}
.badge.status-new { background: var(--teal); color: var(--navy); }
.badge.status-confirmed { background: var(--blue); }
.badge.status-ready { background: var(--green); }
.badge.status-done { background: var(--success); }
.badge.status-cancelled { background: var(--navy); }
.badge.unavailable { background: var(--muted); }
.badge.available { background: var(--green); }

/* --- Tables --- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--cream-dark); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: var(--cream-dark); }

/* --- Footer --- */

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
  font-size: 13px;
}

/* --- Admin shell --- */

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 220px;
  background: var(--navy);
  color: var(--white);
  padding: 24px 0;
  flex-shrink: 0;
}

.admin-sidebar .brand { padding: 0 20px 24px; color: var(--white); }

.admin-sidebar nav button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--white);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.8;
}

.admin-sidebar nav button.active { opacity: 1; background: rgba(255,255,255,0.12); border-left: 4px solid var(--teal); }
.admin-sidebar nav button:hover { opacity: 1; }

.admin-main { flex: 1; padding: 32px; max-width: 1100px; }

.admin-tab { display: none; }
.admin-tab.active { display: block; }

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-tiles { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-tile {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  min-width: 160px;
}
.stat-tile .label { color: var(--muted); font-size: 13px; }
.stat-tile .value { font-size: 26px; font-weight: 800; color: var(--blue); }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; margin: 16px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-chart .bar { width: 100%; background: var(--blue); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-chart .bar-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 43, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 24px;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.hidden { display: none !important; }

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.toggle-switch .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.15s;
}
.toggle-switch input:checked + .slider { background: var(--green); }
.toggle-switch input:checked + .slider::before { transform: translateX(20px); }

/* --- Dashboard tiles --- */

.dashboard-tile-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dashboard-tile {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  min-width: 170px;
  flex: 1;
}
.dashboard-tile .label { color: var(--muted); font-size: 13px; }
.dashboard-tile .value { font-size: 28px; font-weight: 800; color: var(--blue); }
.dashboard-tile.attention .value { color: var(--teal); }

@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px 0; }
  .admin-sidebar .brand { display: none; }
  .admin-sidebar nav { display: flex; }
  .admin-sidebar nav button { white-space: nowrap; border-left: none !important; }
  .admin-main { padding: 16px; }
}
