/* ============================================================
   LAYOUT — Container, Navbar, Page Wrapper, Grid System
   ============================================================ */

/* ── Container ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad-x);
  overflow-x: hidden;
}

.container--sm {
  max-width: var(--max-w-sm);
}

.container--md {
  max-width: var(--max-w-md);
}

/* ── Page ────────────────────────────────────────────────── */
#app {
  min-height: calc(100dvh - var(--navbar-h));
  padding-top: var(--navbar-h);
  overflow-x: hidden;
  width: 100%;
}

/* ── Navbar Shell ────────────────────────────────────────── */
#navbar-mount {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  z-index: var(--z-sticky);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-h);
  padding-inline: var(--pad-x);
  background: rgba(255, 245, 247, 0.90);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  gap: var(--sp-6);
}

/* Mobile: reduce gap */
@media (max-width: 640px) {
  .navbar {
    gap: var(--sp-2);
    padding-inline: var(--sp-4);
  }
}

.navbar__brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.navbar__logo {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--text);
  letter-spacing: 2px;
  line-height: 1;
  transition: color var(--t-fast) var(--ease-out);
}

.navbar__logo:hover {
  color: var(--accent);
}

.navbar__tagline {
  font-size: var(--text-xs);
  color: var(--text-3);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Hide tagline on mobile */
@media (max-width: 640px) {
  .navbar__tagline {
    display: none;
  }

  .navbar__logo {
    font-size: var(--text-xl);
  }
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* Hide nav links on mobile to save space */
@media (max-width: 768px) {
  .navbar__nav {
    display: none;
  }
}

.navbar__link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast) var(--ease-out);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
}

.navbar__link:hover,
.navbar__link.is-active {
  color: var(--text);
  background: var(--surface);
}

.navbar__link.is-active {
  font-weight: 600;
  color: var(--accent);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Mobile: reduce gap between actions */
@media (max-width: 640px) {
  .navbar__actions {
    gap: var(--sp-2);
  }
}

/* Cart button in navbar */
.cart-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  border: 1px solid rgba(212, 112, 143, 0.2);
  border-radius: var(--r-full);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
  position: relative;
}

.cart-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.cart-btn__icon {
  font-size: 16px;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding-inline: var(--sp-1);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--r-full);
  transition: transform var(--t) var(--ease-spring);
}

.cart-badge.is-bump {
  animation: badge-bump 0.35s var(--ease-spring);
}

/* Mobile adjustments for cart button */
@media (max-width: 640px) {
  .cart-btn {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
  }

  .cart-btn__icon {
    font-size: 14px;
  }

  .cart-badge {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }
}

/* ── Product Grid ─────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-6);
}

@media (max-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
  }
}

@media (max-width: 400px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Two-column Checkout Layout ──────────────────────────── */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--sp-8);
  align-items: start;
}

@media (max-width: 900px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .checkout-summary-col {
    order: -1;
  }
}

/* ── Section Padding ────────────────────────────────────────── */
.section-pad {
  padding: var(--pad-y) 0;
}

/* ── Authentication ──────────────────────────────────────── */

.btn-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth:hover {
  background: #fff;
  border-color: var(--border-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Mobile adjustments for auth button */
@media (max-width: 640px) {
  .btn-auth {
    padding: 6px 10px;
    font-size: 12px;
  }
}

.user-profile {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: box-shadow 0.2s;
}

.user-profile:hover,
.user-profile:focus {
  box-shadow: 0 0 0 2px var(--accent-light);
  outline: none;
}

.user-profile__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-profile__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  min-width: 180px;
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  visibility: hidden;
  /* Added to ensure it doesn't block interactions */
  transition: all 0.2s var(--ease-out);
  z-index: 50;
}

/* Fix: Ensure hover works by using a more direct approach or ensuring no gap */
.user-profile:hover .user-profile__menu,
.user-profile:focus-within .user-profile__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  display: block;
  /* Reinforce display */
}

.user-profile__email {
  display: block;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-3);
  border-bottom: 1px solid var(--surface-2);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile__logout {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  color: #e63946;
  border-radius: 4px;
  cursor: pointer;
}

.user-profile__logout:hover {
  background: #fff5f5;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-top: var(--sp-16);
  padding-bottom: var(--sp-8);
  margin-top: auto;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: var(--sp-12);
  margin-bottom: var(--sp-12);
}

.footer__col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.footer__logo {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--text);
  letter-spacing: 1px;
}

.footer__description {
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: 1.6;
  max-width: 320px;
}

.footer__title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast);
  cursor: pointer;
}

.footer__link:hover {
  color: var(--accent);
}

.footer__contact-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-2);
}

.footer__bottom {
  border-top: 1px solid var(--border-2);
  padding-top: var(--sp-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.footer__copy {
  font-size: var(--text-xs);
  color: var(--text-3);
}

.footer__credits {
  font-size: var(--text-xs);
  color: var(--text-3);
}

.footer__credits strong {
  color: var(--text-2);
}

@media (max-width: 900px) {
  .footer__grid {
    grid-template-columns: 1.2fr 1fr;
    gap: var(--sp-8);
  }
}

@media (max-width: 600px) {
  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--sp-10);
  }

  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }
}