/* ============================================================
   Sweet Crumbs Bakery shared theme
   Glassmorphism, warm bakery palette, serif and sans type pairing.
   Icons come from Font Awesome (loaded in each page head).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700&family=Nunito+Sans:wght@400;600;700;800&display=swap');

:root {
  --cream:        #FBF3E7;
  --caramel:      #C98A4B;
  --caramel-dark: #9C6530;
  --cocoa:        #4A3226;
  --dusty-rose:   #D98E82;
  --sage:         #8A9A7E;
  --white-glass:        rgba(255, 255, 255, 0.55);
  --white-glass-strong: rgba(255, 255, 255, 0.75);
  --border-glass: rgba(255, 255, 255, 0.6);
  --shadow-soft:  0 8px 32px rgba(74, 50, 38, 0.12);
  --shadow-lift:  0 16px 40px rgba(74, 50, 38, 0.18);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito Sans', -apple-system, 'Segoe UI', sans-serif;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--cocoa);
  background: var(--cream);
  position: relative;
  overflow-x: hidden;
  line-height: 1.55;
}

/* Blurred color blobs behind the page so the glass blur is visible */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -1;
  opacity: 0.55;
  pointer-events: none;
}
body::before { width: 420px; height: 420px; background: var(--dusty-rose); top: -120px; left: -100px; }
body::after  { width: 480px; height: 480px; background: var(--caramel); bottom: -160px; right: -140px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--cocoa);
  margin: 0 0 0.4em;
  font-weight: 600;
  line-height: 1.15;
}

p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 3px solid rgba(156, 101, 48, 0.65);
  outline-offset: 2px;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.page-section { padding: 48px 0; }

/* ---------- Glass surfaces ---------- */
.glass {
  background: var(--white-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.glass-strong {
  background: var(--white-glass-strong);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
}
.navbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--caramel-dark);
}
.brand i { font-size: 1.2rem; }

.nav-links { display: flex; align-items: center; gap: 28px; font-weight: 600; }
.nav-links > a { opacity: 0.75; transition: opacity 0.2s ease, color 0.2s ease; }
.nav-links > a:hover, .nav-links > a.active { opacity: 1; color: var(--caramel-dark); }

.nav-actions { display: flex; align-items: center; gap: 14px; }
.nav-greeting { font-weight: 600; opacity: 0.75; font-size: 0.9rem; }

.cart-link { position: relative; display: inline-flex; font-size: 1.15rem; padding: 4px; }
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--dusty-rose);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  font-size: 1.3rem;
  color: var(--cocoa);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  text-align: center;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--caramel), var(--caramel-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(156, 101, 48, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(156, 101, 48, 0.45); transform: translateY(-1px); }

.btn-secondary {
  background: var(--white-glass-strong);
  color: var(--cocoa);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.92); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--caramel);
  color: var(--caramel-dark);
}
.btn-outline:hover { background: rgba(201, 138, 75, 0.1); }

.btn-danger {
  background: rgba(216, 92, 92, 0.12);
  color: #a83d37;
  border: 1px solid rgba(216, 92, 92, 0.3);
}
.btn-danger:hover { background: rgba(216, 92, 92, 0.2); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74, 50, 38, 0.18);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--cocoa);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(201, 138, 75, 0.2);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-hint { font-size: 0.78rem; opacity: 0.7; margin-top: 4px; }

.form-error, .form-note {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: none;
}
.form-error { background: rgba(216, 92, 92, 0.12); border: 1px solid rgba(216, 92, 92, 0.3); color: #9c3030; }
.form-note  { background: rgba(138, 154, 126, 0.2); border: 1px solid rgba(138, 154, 126, 0.4); color: #44503b; }
.form-error.show, .form-note.show { display: block; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card { width: 100%; max-width: 420px; padding: 40px 36px; }
.auth-card h1 { font-size: 1.8rem; text-align: center; }
.auth-sub { text-align: center; opacity: 0.75; margin-bottom: 28px; font-size: 0.92rem; }
.auth-switch { text-align: center; margin: 18px 0 0; font-size: 0.9rem; }
.auth-switch a { color: var(--caramel-dark); font-weight: 700; }
.demo-note {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(138, 154, 126, 0.15);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ---------- Hero carousel ---------- */
.hero { padding: 28px 0 8px; }

.carousel { padding: 12px; position: relative; }

.carousel-viewport {
  overflow: hidden;
  border-radius: 18px;
  position: relative;
  touch-action: pan-y;
}
.carousel-track {
  display: flex;
  transition: transform 0.75s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}
.slide {
  flex: 0 0 100%;
  position: relative;
  height: clamp(400px, 44vw, 500px);
  background: linear-gradient(135deg, #F6DDB8, #D9A066);
}
.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 50%;
  user-select: none;
  -webkit-user-drag: none;
}

/* Frosted caption card sitting on top of the image */
.slide-caption {
  position: absolute;
  left: 28px;
  bottom: 28px;
  max-width: 410px;
  padding: 24px 26px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 30px rgba(74, 50, 38, 0.18);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}
.slide.is-active .slide-caption { opacity: 1; transform: none; }
.slide-caption h2 { font-size: 1.9rem; margin-bottom: 0.3em; }
.slide-caption p { margin-bottom: 1.1em; font-size: 1rem; }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--cocoa);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
}
.carousel-btn:hover { background: rgba(255, 255, 255, 0.8); }
.carousel-prev { left: 26px; }
.carousel-next { right: 26px; }

.carousel-controls {
  position: absolute;
  right: 28px;
  bottom: 28px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}
.carousel-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cocoa);
  font-size: 0.8rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.carousel-dots { display: flex; align-items: center; gap: 8px; }
.dot {
  position: relative;
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(74, 50, 38, 0.28);
  cursor: pointer;
  overflow: hidden;
  transition: width 0.35s ease;
}
.dot.is-active { width: 38px; }
/* The fill inside the active dot shows how long until the next slide */
.dot.is-active::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--caramel-dark);
  transform-origin: left center;
  animation: dotFill 5s linear forwards;
}
.carousel.is-paused .dot.is-active::after { animation-play-state: paused; }
.carousel.is-stopped .dot.is-active::after { animation: none; }
@keyframes dotFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Search and filter bar ---------- */
.shop-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 36px 0 14px; flex-wrap: wrap; gap: 8px; }
.shop-heading h2 { font-size: 1.7rem; margin: 0; }
.shop-count { opacity: 0.7; font-size: 0.9rem; }

.filter-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); opacity: 0.55; pointer-events: none; }
.filter-bar input[type="text"] {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border-radius: 999px;
  border: 1px solid rgba(74, 50, 38, 0.15);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--cocoa);
}
.filter-bar select {
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(74, 50, 38, 0.15);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--cocoa);
}

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

.product-card {
  display: block;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); }
.product-card-img { width: 100%; height: 175px; object-fit: cover; background: #F0E4D3; }
.product-card-body { padding: 16px 18px 18px; }
.product-card-category { font-size: 0.78rem; font-weight: 700; color: var(--caramel-dark); margin-bottom: 4px; }
.product-card-name { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; margin-bottom: 6px; line-height: 1.25; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.price { font-weight: 800; color: var(--caramel-dark); font-size: 1.05rem; }
.stock-tag { font-size: 0.78rem; opacity: 0.7; }
.stock-tag.low, .stock-tag.out { color: #a83d37; opacity: 1; font-weight: 700; }

/* ---------- Loading states ---------- */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.4) 25%, rgba(255,255,255,0.7) 37%, rgba(255,255,255,0.4) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-card { height: 290px; }

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(201, 138, 75, 0.25);
  border-top-color: var(--caramel);
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: var(--shadow-lift);
  animation: toastIn 0.3s ease both;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}
.toast.success { background: linear-gradient(135deg, #8A9A7E, #6f8063); }
.toast.error   { background: linear-gradient(135deg, #d8746c, #b3453f); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------- Misc ---------- */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeSlideUp 0.45s ease both; }

.site-footer { text-align: center; padding: 32px 20px; opacity: 0.7; font-size: 0.85rem; }

.empty-state { text-align: center; padding: 56px 20px; }
.empty-state .icon { font-size: 2.4rem; color: var(--caramel); margin-bottom: 14px; }
.empty-state p { opacity: 0.8; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}
.status-pending   { background: rgba(216, 155, 92, 0.22); color: #8a5726; }
.status-preparing { background: rgba(217, 142, 130, 0.25); color: #8f4338; }
.status-delivered { background: rgba(138, 154, 126, 0.35); color: #3e4a37; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hamburger { display: block; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 18px;
    border-bottom: 1px solid var(--border-glass);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-actions { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .carousel { padding: 8px; }
  .slide { height: 440px; }
  .slide img { object-position: 78% 30%; }
  .slide-caption { left: 14px; right: 14px; bottom: 66px; max-width: none; padding: 18px 20px; }
  .slide-caption h2 { font-size: 1.45rem; }
  .carousel-btn { top: 32%; width: 38px; height: 38px; }
  .carousel-prev { left: 16px; }
  .carousel-next { right: 16px; }
  .carousel-controls { right: 50%; transform: translateX(50%); bottom: 18px; }
  .auth-card { padding: 30px 22px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  #toast-container { left: 16px; right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Google sign-in button and divider ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  font-size: 0.85rem;
  opacity: 0.7;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.25;
}
.btn-google i { margin-right: 8px; }

/* ---------- Forgot password link ---------- */
.forgot-link { text-align: right; margin: -6px 0 14px; font-size: 0.9rem; }
.forgot-link a { text-decoration: underline; opacity: 0.85; }

/* ---------- Shop by category tiles ---------- */
.category-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 28px; }
.tile { display: block; overflow: hidden; text-align: center; text-decoration: none; color: inherit; transition: transform .2s ease, box-shadow .2s ease; }
.tile:hover { transform: translateY(-3px); }
.tile img { width: 100%; height: 130px; object-fit: cover; display: block; background: #F0E4D3; }
.tile span { display: block; padding: 12px 8px; font-weight: 800; }
@media (max-width: 700px) { .category-tiles { grid-template-columns: repeat(2, 1fr); } .tile img { height: 100px; } }

/* ---------- Cancelled status, tags, password toggle ---------- */
.status-cancelled { background: rgba(120, 120, 120, 0.18); color: #555; }
.product-card { position: relative; }
.card-tag { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 4px 11px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.card-tag.best { background: linear-gradient(135deg, #D98E82, #b8584b); }
.card-tag.new  { background: linear-gradient(135deg, #8A9A7E, #5f7553); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 8px 10px; color: var(--cocoa); opacity: 0.6; font-size: 1rem; }
.pw-toggle:hover { opacity: 1; }

/* Connection notice (no internet / slow internet / back online) */
#net-notice {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 3000; display: none; align-items: center; gap: 10px;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  font-weight: 700; font-size: 0.92rem; color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
#net-notice.offline { background: #b3453f; }
#net-notice.slow { background: #c98a1a; }
#net-notice.back { background: #6f8063; }
