/* --------------------------------------------------------------------------
   Standalone Study Café Shop shell
   Loaded after the shared styles.css and css/shop.css. Only overrides the
   storefront layout; catalogue/product/cart styles remain the shared ones.
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

body.shop-app {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(198, 150, 46, 0.12), transparent 34rem),
    radial-gradient(circle at 100% 0%, rgba(37, 211, 102, 0.05), transparent 28rem),
    var(--bg-dark);
}

body.shop-app.modal-open {
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 3000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--gold-primary);
  color: #151006;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.shop-site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  border-bottom: 1px solid rgba(30, 38, 56, 0.85);
  background: rgba(8, 11, 17, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.shop-site-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px;
}

.shop-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--text-white);
  text-decoration: none;
}

.shop-brand-logo {
  height: 56px;
  width: auto;
  border-radius: 12px;
  object-fit: fill;
  background: #111622;
}

.shop-brand-logo-text {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}

.shop-main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shop-main-nav a {
  position: relative;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease;
}

.shop-main-nav a:hover,
.shop-main-nav a:focus-visible {
  color: var(--text-white);
  background: rgba(198, 150, 46, 0.08);
  outline: none;
}

.shop-main-nav a.active {
  color: var(--gold-primary);
}

.shop-main-nav a.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-gradient);
}

.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.shop-header-cart {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  background: var(--surface-dark);
  color: #dbe1eb;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.shop-header-cart:hover,
.shop-header-cart:focus-visible,
.shop-header-cart.has-items {
  border-color: rgba(198, 150, 46, 0.65);
  color: var(--gold-primary);
  outline: none;
}

.shop-header-cart .shop-cart-count {
  top: -5px;
  right: -5px;
}

.account-wrap {
  position: relative;
}

.account-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface-dark);
  color: var(--text-white);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.account-menu-btn:hover,
.account-menu-btn:focus-visible,
.account-menu-btn[aria-expanded="true"] {
  border-color: rgba(198, 150, 46, 0.65);
  outline: none;
}

.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: #171005;
  font-size: 0.85rem;
  font-weight: 800;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-label {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chevron {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.account-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 1100;
  width: 250px;
  padding: 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: #111622;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  animation: accountMenuIn 0.14s ease;
}

.account-menu[hidden] {
  display: none !important;
}

@keyframes accountMenuIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-menu-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px 11px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(30, 38, 56, 0.9);
}

.account-menu-head span:first-child {
  color: var(--text-white);
  font-size: 0.86rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-head span:last-child {
  color: var(--text-muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu a,
.account-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #dbe1eb;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.account-menu a:hover,
.account-menu a:focus-visible,
.account-menu button:hover,
.account-menu button:focus-visible {
  background: rgba(198, 150, 46, 0.1);
  color: var(--gold-primary);
  outline: none;
}

.account-menu a i,
.account-menu button i {
  width: 16px;
  color: var(--gold-primary);
  text-align: center;
}

.account-menu-sep {
  height: 1px;
  margin: 5px 8px;
  background: rgba(30, 38, 56, 0.9);
}

.account-menu-sep[hidden],
.account-menu a[hidden],
.account-menu button[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Main shell
   -------------------------------------------------------------------------- */

#shop-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 96px;
  outline: none;
}

#shop-main .view {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

#view-shop .shop-header {
  margin: 0 0 18px;
}

#view-shop .shop-header h1 {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--gold-primary);
  font-size: 1.9rem;
  line-height: 1.15;
}

#view-shop .shop-sub {
  margin-top: 5px;
  max-width: 62ch;
}

#view-shop .shop-search-wrap {
  margin-top: 4px;
}

#view-shop .shop-category-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* Product keeps a comfortable reading column; cart and orders fill the page. */
#shop-main #view-shop-product {
  max-width: 820px;
  margin: 0 auto;
}

#shop-main #view-shop-cart,
#shop-main #view-shop-orders {
  max-width: none;
  margin: 0;
  padding: 0;
}

#shop-main:has(#view-shop-cart.active),
#shop-main:has(#view-shop-orders.active) {
  max-width: none;
  margin: 0;
  padding: 0;
}

#view-shop-product .product-detail-content {
  padding-bottom: 10px;
}

#shop-main #view-shop-product .product-cta-bar {
  max-width: 820px;
}

#view-shop-product .product-cta--whatsapp {
  flex-basis: 100%;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #04140a;
  font-weight: 800;
  text-decoration: none;
}

#view-shop-product .product-cta--whatsapp:hover,
#view-shop-product .product-cta--whatsapp:focus-visible {
  filter: brightness(1.06);
  outline: 2px solid rgba(37, 211, 102, 0.5);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Auth
   -------------------------------------------------------------------------- */

body:has(#view-auth.active) {
  overflow-y: auto;
}

body:has(#view-auth.active) .shop-site-header,
body:has(#view-auth.active) .shop-site-footer {
  display: none;
}

body:has(#view-auth.active) #shop-main {
  max-width: 500px;
  padding-top: 40px;
  padding-bottom: 40px;
}

#view-auth .auth-card {
  margin-top: 0;
  padding: 28px 24px;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.auth-back-link:hover,
.auth-back-link:focus-visible {
  color: var(--gold-primary);
  outline: none;
}

.auth-subtitle {
  margin: -6px 0 20px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.55;
  text-align: center;
}

.auth-guest-note {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Account pages (profile / settings / privacy / 404)
   -------------------------------------------------------------------------- */

.account-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.account-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
}

.account-page-head h1 {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--gold-primary);
  font-size: 1.85rem;
  line-height: 1.15;
}

.account-page-head p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.profile-card {
  margin-top: 0;
}

.profile-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.profile-section-head h3,
.profile-section-head h2 {
  color: var(--text-white);
  font-size: 0.95rem;
  font-weight: 700;
}

.settings-card {
  margin-top: 14px;
  padding: 22px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--surface-dark);
}

.settings-card:first-of-type {
  margin-top: 0;
}

.settings-card h2 {
  margin-bottom: 13px;
  color: var(--text-white);
  font-size: 1rem;
  font-weight: 700;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-list > div {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(30, 38, 56, 0.65);
}

.settings-list > div:last-child {
  border-bottom: none;
}

.settings-list dt {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.settings-list dd {
  color: var(--text-white);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.settings-note {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.55;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.settings-actions .btn {
  flex: 1 1 150px;
  text-align: center;
  text-decoration: none;
}

.settings-logout {
  color: #f1a4a4;
  border-color: rgba(239, 107, 107, 0.35);
}

.settings-logout:hover,
.settings-logout:focus-visible {
  border-color: rgba(239, 107, 107, 0.7);
  color: #ffb9b9;
}

.privacy-card h2 {
  margin-top: 20px;
}

.privacy-card h2:first-child {
  margin-top: 0;
}

.privacy-card p {
  color: #c6cedb;
  font-size: 0.86rem;
  line-height: 1.7;
}

.privacy-card a {
  color: var(--gold-primary);
}

.privacy-updated {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(30, 38, 56, 0.7);
  color: var(--text-muted) !important;
  font-size: 0.74rem !important;
}

.empty-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  text-align: center;
}

.empty-page > i {
  margin-bottom: 16px;
  color: var(--gold-primary);
  font-size: 2.4rem;
}

.empty-page h1 {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--gold-primary);
  font-size: 1.8rem;
}

.empty-page p {
  margin: 8px 0 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.empty-page .btn {
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Footer and mobile navigation
   -------------------------------------------------------------------------- */

.shop-site-footer {
  border-top: 1px solid rgba(30, 38, 56, 0.8);
  background: rgba(8, 11, 17, 0.65);
}

.shop-site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 34px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 210px;
}

.footer-brand strong {
  color: var(--gold-primary);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
}

.footer-brand span,
.footer-copy {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: #c6cedb;
  font-size: 0.76rem;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--gold-primary);
  outline: none;
}

.footer-copy {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (min-width: 721px) {
  #view-shop .shop-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
    gap: 16px;
  }

  #view-shop-product .product-gallery-slide {
    aspect-ratio: 16 / 10;
    max-height: 460px;
  }

  #view-shop-product .product-gallery-slide img {
    object-fit: contain;
  }

  #view-shop-product .product-detail-content {
    padding-left: 26px;
    padding-right: 26px;
  }

  #view-shop-product .product-gallery {
    margin-left: -26px;
    margin-right: -26px;
  }
}

@media (max-width: 720px) {
  .shop-site-header-inner {
    gap: 10px;
    padding: 9px 14px;
  }

  .shop-main-nav {
    display: none;
  }

  .shop-brand-copy strong {
    font-size: 0.98rem;
  }

  .shop-header-actions {
    gap: 6px;
  }

  #shop-main:has(#view-shop-cart.active),
  #shop-main:has(#view-shop-orders.active) {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  #shop-main {
    padding: 18px 14px 28px;
  }

  #view-shop-cart .product-topbar {
    grid-template-columns: 1fr;
    justify-content: center;
    margin: 0;
    padding: 8px 14px;
    width: 100%;
    max-width: none;
  }

  #view-shop-cart .product-back-btn {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
  }

  #view-shop .shop-header h1 {
    font-size: 1.65rem;
  }

  #shop-main #view-shop-product,
  #shop-main #view-shop-cart,
  #shop-main #view-shop-orders {
    max-width: none;
  }

  #shop-main #view-shop-product .product-cta-bar {
    max-width: 100%;
  }

  #shop-main #view-shop-cart,
  #shop-main #view-shop-orders {
    padding: 0;
  }

  #shop-main:has(#view-shop-cart.active),
  #shop-main:has(#view-shop-orders.active) {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  #view-shop-product .product-gallery-slide {
    aspect-ratio: 1 / 1;
  }

  .account-menu {
    right: -4px;
    width: min(280px, calc(100vw - 24px));
  }
}

@media (max-width: 480px) {
  .account-label,
  .account-chevron {
    display: none;
  }

  .account-menu-btn {
    width: 44px;
    height: 44px;
    padding: 4px;
    justify-content: center;
  }

  .account-avatar {
    width: 34px;
    height: 34px;
  }

  #shop-main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .account-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .settings-card {
    padding: 18px 16px;
  }

  .settings-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .auth-card {
    padding: 22px 18px;
  }
}

@media (max-width: 360px) {
  .shop-brand-copy small {
    display: none;
  }

  .shop-header-cart,
  .account-menu-btn {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .account-menu {
    animation: none;
  }
}
