@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&family=Playfair+Display:wght@600&display=swap');
@import url('https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css');

:root {
  --bg: #F5F5DC;
  --panel: #ffffff;
  --card: #ffffff;
  --sand: #F5F5DC;
  --accent: #ff0000;
  --accent-2: #ff4500;
  --text: #333333;
  --muted: #666666;
  --border: #ff0000;
  --shadow: 0 15px 50px rgba(255, 0, 0, 0.1);
  --radius: 18px;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.student-banner {
  background: var(--accent);
  color: white;
  text-align: center;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: calc(-1 * clamp(18px, 5vw, 38px));
  margin-bottom: 20px;
}

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

a:hover {
  color: var(--accent);
}

.page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 32px);
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  /* ensure absolute positioning of the cart toggle works */
  position: sticky;
}

.brand {
  grid-column: 1;
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.main-nav {
  grid-column: 2;
  justify-self: end;
}

.main-nav ul {
  display: flex;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.main-nav a {
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.main-nav a:hover {
  background: rgba(255, 0, 0, 0.12);
  color: var(--accent);
}

.main-nav .auth-nav-item {
  display: flex;
  align-items: center;
}

.main-nav .auth-user-label {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: #fff;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.main-nav .auth-logout-btn {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.main-nav .auth-logout-btn:hover {
  background: rgba(255, 0, 0, 0.12);
  color: var(--accent);
}

.auth-status-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 14px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.9rem;
}

.auth-status-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-status-links a {
  color: var(--accent);
  font-weight: 600;
}

.auth-status-links button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
}

.auth-message {
  min-height: 20px;
  margin: 8px 0 14px;
  font-weight: 600;
}

.auth-message.error {
  color: #721c24;
}

.auth-message.success {
  color: #155724;
}

.cart-toggle {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 0, 0, 0.12);
  color: var(--accent);
  font-weight: 700;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
  position: static; /* place inside header grid instead of overlaying */
  grid-column: 3;
  justify-self: end;
  transform: none;
}

.cart-toggle:hover {
  background: rgba(255, 0, 0, 0.2);
}

.breadcrumb {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 12px clamp(18px, 4vw, 32px) 0;
}

.breadcrumb ol {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.breadcrumb li::after {
  content: '/';
  margin-left: 8px;
  color: var(--border);
}

.breadcrumb li:last-child::after {
  content: '';
}

.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(18px, 5vw, 38px) clamp(18px, 4vw, 32px) 64px;
  flex: 1;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  align-items: center;
  padding: 28px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.hero p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.hero .cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #0b1222;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
}

.hero-visual {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: url('https://images.unsplash.com/photo-1447933601403-0c6688de566e?auto=format&fit=crop&w=1200&q=80') center/cover no-repeat;
  border: 2px solid var(--border);
}

.section-title {
  margin: 36px 0 16px;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.category-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.category-card h3 {
  margin: 0;
}

.category-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.product-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: 10px;
  padding: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.product-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1; /* make the thumbnail square */
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid var(--border);
}

.product-name {
  font-weight: 700;
  margin: 0;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  color: var(--accent);
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: rgba(255, 0, 0, 0.12);
  color: var(--accent);
  font-weight: 700;
  transition: background 0.2s ease;
}

.button:hover {
  background: rgba(255, 0, 0, 0.2);
}

.product-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.product-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.product-visual {
  display: grid;
  gap: 12px;
}

.swiper {
  width: 100%;
  height: auto;
  position: relative;
}

.swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

.swiper-slide img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
  min-height: 300px;
}

.swiper-pagination {
  position: relative !important;
  margin-top: 16px !important;
  display: flex !important;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.swiper-pagination-bullet {
  width: 12px !important;
  height: 12px !important;
  background: var(--border) !important;
  opacity: 0.5 !important;
  transition: opacity 0.3s ease;
  cursor: pointer !important;
}

.swiper-pagination-bullet:hover {
  opacity: 0.75 !important;
}

.swiper-pagination-bullet-active {
  background: var(--accent) !important;
  opacity: 1 !important;
}

.swiper-button-prev,
.swiper-button-next {
  width: 44px !important;
  height: 44px !important;
  background: var(--border) !important;
  border-radius: 50% !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 20 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
  background: var(--accent) !important;
  transform: translateY(-50%) scale(1.1) !important;
}

.swiper-button-prev::after,
.swiper-button-next::after {
  font-size: 20px !important;
  color: white !important;
  font-weight: bold !important;
}

.product-visual img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
  min-height: 260px;
}

.product-copy h2 {
  margin: 0 0 10px;
}

.product-copy p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detail-meta .price {
  font-size: 1.2rem;
}

.auth-panel {
  max-width: 560px;
  margin: 0 auto;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-panel-wide {
  max-width: 620px;
}

.auth-panel h1 {
  margin: 0 0 10px;
}

.auth-intro {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .form-group {
  display: grid;
  gap: 8px;
}

.auth-form label {
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.auth-form input:focus-visible {
  outline: 3px solid rgba(255, 0, 0, 0.2);
  outline-offset: 1px;
}

.auth-form .button {
  justify-self: start;
}

.auth-links {
  margin: 10px 0 0;
}

.auth-links a {
  font-weight: 600;
  color: var(--accent);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 28px clamp(18px, 4vw, 32px);
  color: var(--muted);
  background: rgba(12, 18, 30, 0.95);
}

/* Shopping list overlay */
.cart-control {
  position: fixed;
  top: -100px;
  left: -100px;
  opacity: 0;
  pointer-events: none;
}

.shopping-list {
  position: fixed;
  top: 80px;
  right: 20px;
  width: min(380px, 95vw);
  max-height: 80vh;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
}

#cart-control:checked + .page .shopping-list {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cart-head h3 {
  margin: 0;
}

.cart-close {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
}

.cart-body {
  flex: 1;
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
}

.cart-body p {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  margin: 0;
}

.cart-footer {
  display: grid;
  gap: 10px;
}

.cart-footer .hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.checkout-button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0b1222;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.cart-pill {
  /* Hide the floating pill by default so it doesn't block page buttons; count shown via header toggle */
  display: none;
}

.cart-pill label {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px;
    position: relative;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .cart-toggle {
    /* on small screens keep toggle visible in header, but anchored to the right */
    position: absolute;
    right: 12px;
    top: 10px;
    transform: none;
    grid-column: auto;
    justify-self: end;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
  }

  .main-nav ul {
    justify-content: center;
  }

  .product-card {
    width: 100%;
  }

  .shopping-list {
    top: 60px;
    right: 6px;
    left: 6px;
    width: auto;
    max-height: 60vh;
  }

  .cart-pill {
    display: none; /* keep hidden on mobile to avoid overlaying category buttons */
    right: 12px;
    transform: none;
  }
}
/* Cart Items Styling */
.cart-items {
  list-style: none;
  padding: 0;
  margin: 0 0 15px 0;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item-name {
  font-weight: 600;
  color: var(--text);
}

.cart-item-price {
  font-size: 0.9em;
  color: var(--muted);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn,
.remove-btn {
  padding: 4px 8px;
  font-size: 0.9em;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.qty-btn:hover,
.remove-btn:hover {
  background: var(--accent);
  color: white;
}

.qty {
  min-width: 30px;
  text-align: center;
}

.remove-btn {
  font-size: 0.8em;
  padding: 4px 6px;
}

.cart-total {
  padding: 12px;
  border-top: 2px solid var(--border);
  text-align: right;
  font-weight: 700;
  color: var(--text);
}