/* ==========================================================
   Storefront styles
   Sections: base, navbar, buttons, flash, hero, sections,
   categories, products, perks, footer, responsive
   ========================================================== */

/* ---------- Base ---------- */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --accent: #f59e0b;
  --text: #334155;
  --heading: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --radius: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
}

.main-content {
  flex: 1;
}

/* ---------- Navbar ---------- */
.navbar {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 68px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links > li > a {
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-links > li > a:hover {
  color: var(--primary);
}

.nav-container > .nav-links:nth-of-type(1) {
  margin-right: auto;
}

.cart-count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}

/* Category dropdown (opens on hover or keyboard focus, no JavaScript) */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: -12px;
  min-width: 220px;
  padding: 8px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.18);
  z-index: 1000;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
}

.dropdown-menu a:hover {
  background: #eef2ff;
  color: var(--primary);
}

.dropdown-empty {
  padding: 8px 12px;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: #eef2ff;
  color: var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary);
  color: #fff;
}

.btn-light {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.btn-light:hover {
  background: rgba(255, 255, 255, 0.28);
}

.btn-lg {
  padding: 14px 30px;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.88rem;
}

/* ---------- Flash messages ---------- */
.flash-wrap {
  margin-top: 1rem;
}

.flash {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

/* ---------- Admin banner (logged-in admins only) ---------- */
.admin-banner {
  background: #1e1b4b;
  color: #e0e7ff;
  font-size: 0.9rem;
}

.admin-banner-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.admin-banner strong {
  color: #fff;
  margin-right: 8px;
}

.admin-banner-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
  padding-top: 72px;
  padding-bottom: 72px;
}

.hero-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 18px;
}

.hero-accent {
  color: #fcd34d;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  margin-bottom: 30px;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-visual {
  position: relative;
}

.hero-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  transform: rotate(2deg);
}

.hero-tag {
  position: absolute;
  left: -14px;
  top: 28px;
  display: flex;
  flex-direction: column;
  padding: 12px 18px;
  background: #fff;
  color: var(--heading);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.hero-tag span {
  color: var(--primary);
  font-weight: 700;
}

/* ---------- Sections ---------- */
.section {
  padding-top: 56px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.section-head h2 {
  font-size: 1.7rem;
  color: var(--heading);
  letter-spacing: -0.5px;
}

.section-link {
  font-weight: 600;
  color: var(--primary);
}

.section-link:hover {
  text-decoration: underline;
}

.page-header {
  padding: 40px 20px 20px;
}

.page-header h2 {
  font-size: 2rem;
  color: var(--heading);
}

/* ---------- Category tiles ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px;
  min-height: 170px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.category-card:nth-child(4n + 2) { background: linear-gradient(135deg, #ec4899, #be185d); }
.category-card:nth-child(4n + 3) { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.category-card:nth-child(4n + 4) { background: linear-gradient(135deg, #f59e0b, #d97706); }

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 28px -10px rgba(15, 23, 42, 0.35);
}

.category-card h3 {
  font-size: 1.3rem;
}

.category-card p {
  font-size: 0.9rem;
  opacity: 0.9;
  flex: 1;
}

.category-link {
  font-weight: 600;
}

/* ---------- Products ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 26px;
  padding-bottom: 60px;
}

.section .product-grid {
  padding-bottom: 0;
}

.product-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px -10px rgba(15, 23, 42, 0.2);
}

.product-image-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  background: #f1f5f9;
}

.product-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.product-info {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.6px;
}

.product-title {
  font-size: 1.05rem;
  color: var(--heading);
  margin: 4px 0 8px;
  line-height: 1.3;
}

.product-title:hover {
  color: var(--primary);
}

.product-desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--heading);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- Perks strip ---------- */
.perks {
  margin-top: 64px;
  background: #fff;
  border-top: 1px solid var(--border);
}

.perks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 24px;
  padding-top: 40px;
  padding-bottom: 40px;
  text-align: center;
}

.perk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #eef2ff;
  font-size: 1.6rem;
}

.perk h4 {
  color: var(--heading);
}

.perk p {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  background-color: #0f172a;
  color: #cbd5e1;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  padding-top: 48px;
  padding-bottom: 32px;
}

.footer-logo {
  color: #fff;
  display: inline-block;
  margin-bottom: 8px;
}

.footer h4 {
  color: #fff;
  margin-bottom: 10px;
}

.footer ul {
  list-style: none;
}

.footer li {
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.footer a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 18px;
  padding-bottom: 22px;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .nav-container {
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px 20px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .hero-visual {
    max-width: 420px;
  }

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