/* =========================================================
   Maha Autism and Sensory Store — Theme
   Design intent: low visual noise, calming muted palette,
   generous spacing, soft corners, no jarring motion/contrast.
   ========================================================= */

:root {
  /* Calming, low-saturation palette: soft sage, dusty blue, warm sand */
  --maha-bg: #f7f6f2;            /* warm off-white background, not stark white */
  --maha-surface: #ffffff;
  --maha-primary: #5b7f8c;       /* dusty blue */
  --maha-primary-dark: #466370;
  --maha-secondary: #8aab8e;     /* soft sage green */
  --maha-accent: #e7b690;        /* warm muted sand/peach for CTAs */
  --maha-accent-dark: #d49a6d;
  --maha-text: #2f3437;          /* soft near-black, not pure black */
  --maha-text-muted: #6b7178;
  --maha-border: #e2ddd3;
  --maha-success: #6f9c76;
  --maha-danger: #c47a72;
  --maha-radius: 14px;
  --maha-shadow: 0 2px 10px rgba(47, 52, 55, 0.06);
}

* {
  scroll-behavior: auto; /* avoid smooth-scroll motion that can be uncomfortable */
}

body {
  background-color: var(--maha-bg);
  color: var(--maha-text);
  font-family: "Atkinson Hyperlegible", "Segoe UI", Verdana, Arial, sans-serif;
  line-height: 1.65;
  letter-spacing: 0.1px;
}

a {
  color: var(--maha-primary-dark);
  text-decoration: none;
}
a:hover { color: var(--maha-accent-dark); text-decoration: underline; }

/* Reduce motion for users sensitive to animation */
@media (prefers-reduced-motion: no-preference) {
  .maha-fade { transition: opacity 0.25s ease; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Navbar ---------- */
.maha-navbar {
  background-color: var(--maha-surface);
  border-bottom: 1px solid var(--maha-border);
  box-shadow: var(--maha-shadow);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.maha-navbar .navbar-brand {
  font-weight: 600;
  color: var(--maha-primary-dark);
}
.maha-logo-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--maha-secondary);
}
.maha-navbar .nav-link {
  color: var(--maha-text);
  font-weight: 500;
}
.maha-navbar .nav-link:hover { color: var(--maha-primary-dark); }

/* ---------- Buttons ---------- */
.btn-primary {
  background-color: var(--maha-primary);
  border-color: var(--maha-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--maha-primary-dark);
  border-color: var(--maha-primary-dark);
}
.btn-outline-primary {
  color: var(--maha-primary-dark);
  border-color: var(--maha-primary);
}
.btn-outline-primary:hover {
  background-color: var(--maha-primary);
  border-color: var(--maha-primary);
}
.btn-accent {
  background-color: var(--maha-accent);
  border-color: var(--maha-accent);
  color: var(--maha-text);
  font-weight: 600;
}
.btn-accent:hover {
  background-color: var(--maha-accent-dark);
  border-color: var(--maha-accent-dark);
}

/* Focus states kept clear (don't remove for "calmness" — accessibility first) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--maha-primary);
  outline-offset: 2px;
}

/* ---------- Cards / Product grid ---------- */
.maha-card {
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: var(--maha-radius);
  box-shadow: var(--maha-shadow);
  overflow: hidden;
  height: 100%;
}
.maha-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background-color: #eef0ee;
}
.maha-card-body { padding: 1rem 1.1rem 1.25rem; }
.maha-price { font-weight: 700; color: var(--maha-primary-dark); font-size: 1.1rem; }
.maha-price-old { text-decoration: line-through; color: var(--maha-text-muted); font-size: 0.95rem; }
.maha-badge-sale {
  background: var(--maha-accent);
  color: var(--maha-text);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.maha-rating { color: var(--maha-accent-dark); }

/* ---------- Hero ---------- */
.maha-hero {
  background: linear-gradient(135deg, #eef3ee 0%, #f3eee6 100%);
  border-radius: var(--maha-radius);
  padding: 3rem 2rem;
}

/* ---------- Category pill ---------- */
.maha-category-pill {
  display: inline-block;
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  margin: 0.2rem;
  color: var(--maha-text);
  font-size: 0.9rem;
}
.maha-category-pill.active {
  background: var(--maha-secondary);
  color: white;
  border-color: var(--maha-secondary);
}

/* ---------- Footer ---------- */
.maha-footer {
  background-color: var(--maha-surface);
  border-top: 1px solid var(--maha-border);
}
.maha-footer h5, .maha-footer h6 { color: var(--maha-primary-dark); }
.maha-footer a { color: var(--maha-text-muted); }

/* ---------- Forms ---------- */
.form-control:focus, .form-select:focus {
  border-color: var(--maha-primary);
  box-shadow: 0 0 0 0.2rem rgba(91, 127, 140, 0.18);
}

/* ---------- Stars / reviews ---------- */
.maha-stars { letter-spacing: 1px; }

/* ---------- Admin dashboard accents ---------- */
.maha-admin-sidebar {
  background: var(--maha-surface);
  border-right: 1px solid var(--maha-border);
  min-height: 100vh;
}
.maha-stat-card {
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: var(--maha-radius);
  padding: 1.25rem;
}

/* =========================================================
   Drag-and-drop image uploader (admin: products + banners)
   ========================================================= */
.maha-dropzone {
  border: 2px dashed var(--maha-border);
  border-radius: var(--maha-radius);
  background: #fbfaf7;
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.maha-dropzone:hover,
.maha-dropzone:focus-visible {
  border-color: var(--maha-primary);
  background: #f3f6f5;
}
.maha-dropzone.is-dragover {
  border-color: var(--maha-secondary);
  background: #eef3ee;
}
.maha-dropzone.has-error {
  border-color: var(--maha-danger);
  background: #fbf1f0;
}
.maha-dropzone-icon {
  font-size: 1.9rem;
  display: block;
  margin-bottom: 0.4rem;
  opacity: 0.75;
}
.maha-dropzone-title { font-weight: 600; color: var(--maha-text); margin-bottom: 0.2rem; }
.maha-dropzone-hint { color: var(--maha-text-muted); font-size: 0.85rem; }
.maha-dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
  clip: rect(0,0,0,0);
}
.maha-dropzone-error { color: var(--maha-danger); font-size: 0.85rem; margin-top: 0.5rem; display: none; }
.maha-dropzone.has-error .maha-dropzone-error { display: block; }

/* Single-image preview (e.g. product main image) */
.maha-single-preview {
  position: relative;
  width: 100%;
  max-width: 220px;
  border-radius: var(--maha-radius);
  overflow: hidden;
  border: 1px solid var(--maha-border);
  background: #eef0ee;
}
.maha-single-preview img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.maha-single-preview .maha-remove-btn { top: 6px; right: 6px; }

/* Multi-image gallery grid (product gallery / banner reorder list) */
.maha-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.maha-gallery-item {
  position: relative;
  border: 1px solid var(--maha-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--maha-surface);
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.maha-gallery-item:active { cursor: grabbing; }
.maha-gallery-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: #eef0ee; }
.maha-gallery-item.is-dragging { opacity: 0.4; }
.maha-gallery-item.drag-over-target { box-shadow: 0 0 0 3px var(--maha-secondary) inset; }
.maha-gallery-item .maha-drag-handle {
  position: absolute; top: 4px; left: 4px;
  background: rgba(47,52,55,0.55);
  color: #fff;
  border-radius: 6px;
  font-size: 0.7rem;
  padding: 2px 6px;
  letter-spacing: 1px;
  pointer-events: none;
}
.maha-remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(47,52,55,0.65);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.maha-remove-btn:hover { background: var(--maha-danger); }
.maha-upload-progress {
  font-size: 0.8rem;
  color: var(--maha-text-muted);
  margin-top: 0.5rem;
}

/* =========================================================
   Homepage hero carousel — gentle, pausable, no strobing
   ========================================================= */
.maha-hero-carousel {
  position: relative;
  border-radius: var(--maha-radius);
  overflow: hidden;
  box-shadow: var(--maha-shadow);
  background: linear-gradient(135deg, #eef3ee 0%, #f3eee6 100%);
}
.maha-hero-slides { position: relative; width: 100%; aspect-ratio: 16/7; min-height: 260px; }
.maha-hero-slide {
  position: absolute; inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease;
  display: flex; align-items: flex-end;
}
.maha-hero-slide.is-active { opacity: 1; visibility: visible; position: relative; }
.maha-hero-slide img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.maha-hero-slide-caption {
  position: relative;
  z-index: 2;
  color: #fff;
  padding: 1.75rem 2rem;
  width: 100%;
  background: linear-gradient(to top, rgba(20,24,26,0.62), rgba(20,24,26,0));
}
.maha-hero-slide-caption h2 { font-weight: 700; margin-bottom: 0.3rem; }
.maha-hero-slide-caption p { opacity: 0.92; margin-bottom: 0.75rem; max-width: 36rem; }
.maha-hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 3;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.85);
  color: var(--maha-text);
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--maha-shadow);
}
.maha-hero-arrow:hover { background: #fff; }
.maha-hero-arrow.prev { left: 14px; }
.maha-hero-arrow.next { right: 14px; }
.maha-hero-dots {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 3;
  display: flex; gap: 0.4rem;
}
.maha-hero-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.55);
  cursor: pointer;
  padding: 0;
}
.maha-hero-dot.is-active { background: #fff; width: 22px; border-radius: 5px; }
.maha-hero-pause {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  background: rgba(255,255,255,0.85);
  border: none; border-radius: 999px;
  font-size: 0.75rem; padding: 0.25rem 0.65rem;
  cursor: pointer;
}

/* =========================================================
   "At a glance" category cards
   ========================================================= */
.maha-glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.maha-glance-card {
  display: block;
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: var(--maha-radius);
  padding: 1.1rem 0.9rem;
  text-align: center;
  text-decoration: none;
  color: var(--maha-text);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.maha-glance-card:hover, .maha-glance-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(47,52,55,0.1);
  border-color: var(--maha-secondary);
  text-decoration: none;
  color: var(--maha-text);
}
.maha-glance-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--maha-bg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.6rem;
  font-size: 1.5rem;
}
.maha-glance-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.2rem; }
.maha-glance-count { font-size: 0.78rem; color: var(--maha-text-muted); }

/* =========================================================
   Tabbed product browsing (Featured / New / Best-loved)
   ========================================================= */
.maha-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.maha-tab-btn {
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--maha-text-muted);
  cursor: pointer;
}
.maha-tab-btn.is-active {
  background: var(--maha-primary);
  border-color: var(--maha-primary);
  color: #fff;
}
.maha-tab-panel { display: none; }
.maha-tab-panel.is-active { display: block; }

/* =========================================================
   Product card quick-view overlay
   ========================================================= */
.maha-card { position: relative; }
.maha-card-media { position: relative; overflow: hidden; }
.maha-card-media img { transition: opacity 0.25s ease; }
.maha-card-media img.maha-img-secondary {
  position: absolute; inset: 0; opacity: 0;
}
.maha-card:hover .maha-card-media img.maha-img-secondary,
.maha-card-media:focus-within img.maha-img-secondary { opacity: 1; }
.maha-card-quickbar {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  z-index: 2;
}
.maha-quick-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--maha-border);
  background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--maha-shadow);
}
.maha-quick-btn:hover { background: #fff; }
.maha-quick-btn.is-active { color: var(--maha-danger); border-color: var(--maha-danger); }
.maha-card-quickadd {
  position: absolute;
  left: 0.6rem; right: 0.6rem; bottom: 0.6rem;
  z-index: 2;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.maha-card:hover .maha-card-quickadd,
.maha-card:focus-within .maha-card-quickadd { opacity: 1; transform: translateY(0); }
.maha-glance-badge {
  position: absolute; top: 0.6rem; left: 0.6rem; z-index: 2;
}

/* =========================================================
   Promo strip + trust badges
   ========================================================= */
.maha-promo-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem;
}
.maha-promo-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--maha-text);
  text-decoration: none;
}
.maha-promo-chip:hover { border-color: var(--maha-secondary); text-decoration: none; color: var(--maha-text); }
.maha-promo-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--maha-secondary); }

.maha-trust-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}
.maha-trust-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: var(--maha-radius);
  padding: 1rem;
}
.maha-trust-item .icon { font-size: 1.4rem; }
.maha-trust-item h4 { font-size: 0.88rem; margin: 0 0 0.15rem; }
.maha-trust-item p { font-size: 0.78rem; color: var(--maha-text-muted); margin: 0; }

/* =========================================================
   Admin: banners list (drag-to-reorder rows)
   ========================================================= */
.maha-banner-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--maha-surface);
  border: 1px solid var(--maha-border);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  cursor: grab;
}
.maha-banner-row.is-dragging { opacity: 0.4; }
.maha-banner-row.drag-over-target { box-shadow: 0 0 0 3px var(--maha-secondary) inset; }
.maha-banner-row img { width: 96px; height: 56px; object-fit: cover; border-radius: 8px; background: #eef0ee; flex: 0 0 auto; }
.maha-banner-row .grip { color: var(--maha-text-muted); font-size: 1.1rem; flex: 0 0 auto; }
.maha-banner-row .meta { flex: 1 1 auto; min-width: 0; }
.maha-banner-row .meta .title { font-weight: 600; }
.maha-banner-row .meta .sub { font-size: 0.8rem; color: var(--maha-text-muted); }
.maha-toast {
  position: fixed; bottom: 18px; right: 18px; z-index: 1080;
  background: var(--maha-text);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: var(--maha-shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.maha-toast.is-visible { opacity: 1; transform: translateY(0); }

/* =========================================================
   Live cart badge (nav) — real-time count, gentle pulse on update
   ========================================================= */
.maha-cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--maha-accent-dark);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: top;
  margin-left: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .maha-cart-badge.is-bumping { animation: maha-badge-bump 0.4s ease; }
}
@keyframes maha-badge-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.maha-cart-row.is-removing { opacity: 0.35; }
