/* ═══════════════════════════════════════════════════════════════════════════
   GURA — Layout CSS
   Page layouts, grid system, responsive utilities
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page Shell ───────────────────────────────────────────────────────────── */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-body {
  flex: 1;
  padding-bottom: 80px;
}

/* Hide top nav on mobile — only bottom nav visible */
@media (max-width: 768px) {
  .top-nav { display: none !important; }
  .page-body { padding-top: var(--sp-2); }
}
@media (min-width: 769px) {
  .page-body { padding-bottom: 0; padding-top: 0; }
}

/* ── Container ────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
.container-sm { max-width: 640px; }
.container-md { max-width: 960px; }
.container-lg { max-width: 1280px; }

/* ── Flex ──────────────────────────────────────────────────────────────────── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.flex-1     { flex: 1; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.items-stretch  { align-items: stretch; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }

/* ── Grid ──────────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Product grid — responsive */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
@media (min-width: 600px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Spacing ──────────────────────────────────────────────────────────────── */
.m-0{margin:0}.mt-1{margin-top:var(--sp-1)}.mt-2{margin-top:var(--sp-2)}
.mt-3{margin-top:var(--sp-3)}.mt-4{margin-top:var(--sp-4)}.mt-5{margin-top:var(--sp-5)}
.mt-6{margin-top:var(--sp-6)}.mt-7{margin-top:var(--sp-7)}.mt-8{margin-top:var(--sp-8)}
.mb-1{margin-bottom:var(--sp-1)}.mb-2{margin-bottom:var(--sp-2)}.mb-3{margin-bottom:var(--sp-3)}
.mb-4{margin-bottom:var(--sp-4)}.mb-5{margin-bottom:var(--sp-5)}.mb-6{margin-bottom:var(--sp-6)}
.p-2{padding:var(--sp-2)}.p-3{padding:var(--sp-3)}.p-4{padding:var(--sp-4)}
.p-5{padding:var(--sp-5)}.p-6{padding:var(--sp-6)}
.px-3{padding-left:var(--sp-3);padding-right:var(--sp-3)}
.px-4{padding-left:var(--sp-4);padding-right:var(--sp-4)}
.py-2{padding-top:var(--sp-2);padding-bottom:var(--sp-2)}
.py-3{padding-top:var(--sp-3);padding-bottom:var(--sp-3)}
.py-4{padding-top:var(--sp-4);padding-bottom:var(--sp-4)}
.py-6{padding-top:var(--sp-6);padding-bottom:var(--sp-6)}

/* ── Horizontal Scroll ────────────────────────────────────────────────────── */
.h-scroll {
  display: flex;
  overflow-x: auto;
  gap: var(--sp-3);
  padding-bottom: var(--sp-2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* ── Navbar Layout ────────────────────────────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  padding: var(--sp-3) var(--sp-4);
}
.top-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.nav-logo {
  font-size: var(--fs-xl);
  font-weight: var(--fw-extrabold);
  color: var(--primary);
  letter-spacing: -0.5px;
}
.nav-links {
  display: none;
  gap: var(--sp-5);
  align-items: center;
}
.nav-links a {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-medium);
  transition: color var(--tr-fast);
  padding: var(--sp-1) 0;
  position: relative;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
}
.nav-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  transition: background var(--tr-fast);
  color: var(--text-dark);
}
.nav-icon-btn:hover { background: var(--divider-light); }
.nav-icon-btn svg  { width: 22px; height: 22px; }
.nav-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: var(--fw-bold);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
}
.hamburger-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-dark);
}
.hamburger-btn svg { width: 24px; height: 24px; }

@media (min-width: 769px) {
  .nav-links { display: flex; }
  .hamburger-btn { display: none; }
}

/* ── Mobile Nav Menu ──────────────────────────────────────────────────────── */
.mobile-menu {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: var(--z-modal);
  display: none;
}
.mobile-menu.open { display: block; }
.mobile-menu-overlay {
  position: absolute; inset: 0;
  background: var(--overlay);
  animation: fadeIn var(--tr-fast) both;
}
.mobile-menu-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 280px; max-width: 85%;
  background: var(--surface);
  padding: var(--sp-6);
  animation: slideInRight var(--tr-normal) both;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.mobile-menu-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-4);
}
.mobile-menu-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-weight: var(--fw-medium);
  color: var(--text-dark);
  transition: background var(--tr-fast);
}
.mobile-menu-link:hover { background: var(--divider-light); }
.mobile-menu-link.active { color: var(--primary); background: var(--cat-food-bg); }
.mobile-menu-link svg { width: 20px; height: 20px; }
.mobile-menu-divider {
  height: 1px; background: var(--divider); margin: var(--sp-3) 0;
}

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: var(--z-sticky);
  background: var(--surface);
  border-top: 1px solid var(--divider);
  display: flex;
  padding: var(--sp-2) 0 max(var(--sp-2), env(safe-area-inset-bottom));
}
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: var(--sp-1) 0;
  color: var(--text-light);
  font-size: 10px; font-weight: var(--fw-medium);
  transition: color var(--tr-fast);
  position: relative;
  text-decoration: none;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-badge {
  position: absolute; top: 0; right: calc(50% - 18px);
  min-width: 16px; height: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 9px; font-weight: var(--fw-bold);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
@media (min-width: 769px) {
  .bottom-nav { display: none; }
}

/* ── Dashboard Layout ─────────────────────────────────────────────────────── */
.dash-layout {
  display: flex;
  min-height: 100vh;
}
.dash-sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--divider);
  padding: var(--sp-6) 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: var(--z-sticky);
  transition: transform var(--tr-normal);
}
.dash-sidebar-header {
  padding: 0 var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--divider);
  margin-bottom: var(--sp-4);
}
.dash-sidebar-logo {
  font-size: var(--fs-xl);
  font-weight: var(--fw-extrabold);
  color: var(--primary);
}
.dash-sidebar-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-light);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dash-nav-group {
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}
.dash-nav-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
}
.dash-nav-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-medium);
  transition: all var(--tr-fast);
  margin-bottom: 2px;
}
.dash-nav-link:hover { background: var(--divider-light); color: var(--text-dark); }
.dash-nav-link.active { background: var(--cat-food-bg); color: var(--primary); font-weight: var(--fw-semibold); }
.dash-nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.dash-main {
  flex: 1;
  margin-left: 260px;
  padding: var(--sp-7);
  min-height: 100vh;
}
.dash-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-7);
}
.dash-topbar h1 { font-size: var(--fs-2xl); }
.dash-sidebar-toggle {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-dark);
}

@media (max-width: 1024px) {
  .dash-sidebar {
    transform: translateX(-100%);
  }
  .dash-sidebar.open {
    transform: translateX(0);
  }
  .dash-main {
    margin-left: 0;
  }
  .dash-sidebar-toggle {
    display: flex;
  }
}

/* ── Section ──────────────────────────────────────────────────────────────── */
.section {
  margin-bottom: var(--sp-7);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.section-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}
.section-link {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--primary);
  transition: opacity var(--tr-fast);
}
.section-link:hover { opacity: 0.8; }

/* ── Auth Layout ──────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: linear-gradient(135deg, var(--background) 0%, #FFE8D6 100%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-8);
  animation: fadeInUp var(--tr-slow) both;
}
.auth-logo {
  text-align: center;
  margin-bottom: var(--sp-7);
}
.auth-logo-text {
  font-size: 42px;
  font-weight: var(--fw-extrabold);
  color: var(--primary);
  letter-spacing: -1px;
}
.auth-logo-sub {
  font-size: var(--fs-sm);
  color: var(--text-light);
  margin-top: var(--sp-1);
}

/* ── Hero Banner ──────────────────────────────────────────────────────────── */
.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--sp-6);
  height: 200px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
@media (min-width: 768px) { .hero-banner { height: 280px; } }
.hero-banner img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.5) 0%, transparent 70%);
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-6) var(--sp-7);
  color: #fff;
}
.hero-overlay h2 { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.hero-overlay p  { font-size: var(--fs-md); opacity: 0.9; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}
.empty-state svg { width: 80px; height: 80px; color: var(--divider); margin-bottom: var(--sp-5); }
.empty-state h3  { color: var(--text-medium); margin-bottom: var(--sp-2); }
.empty-state p   { color: var(--text-light); font-size: var(--fs-sm); max-width: 320px; }
