/* =============================================
   BASE.CSS — Reset, typography, layout utilities
   ============================================= */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

main#app {
  flex: 1;
  padding-top: 64px; /* navbar height */
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover, a:focus-visible {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* ============ CONTAINER ============ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .container { padding: 0 2rem; }
}

/* ============ TYPOGRAPHY ============ */
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; line-height: 1.4; }
h4 { font-size: 1.1rem; font-weight: 600; }
p  { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* ============ NAVBAR ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 8px var(--color-shadow);
  height: 64px;
}

.navbar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon { font-size: 1.4rem; }

.navbar__nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  margin-left: 1rem;
}

@media (min-width: 768px) {
  .navbar__nav { display: flex; }
}

.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover, .nav-link.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  text-decoration: none;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Theme switcher */
.theme-switcher {
  display: none;
  align-items: center;
  gap: 0.15rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 0.2rem 0.4rem;
}

@media (min-width: 640px) {
  .theme-switcher { display: flex; }
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.2s, transform 0.15s;
  opacity: 0.6;
}

.theme-btn:hover {
  background: var(--color-primary-subtle);
  opacity: 1;
  transform: scale(1.15);
}

.theme-btn.active {
  background: var(--color-primary-subtle);
  opacity: 1;
}

/* Icon buttons (cart/wishlist) */
.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  text-decoration: none;
}

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.badge[data-count="0"], .badge:empty { display: none; }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.hamburger:hover { background: var(--color-primary-subtle); }

@media (min-width: 768px) {
  .hamburger { display: none; }
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 0.5rem 0;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  box-shadow: 0 8px 16px var(--color-shadow);
}

.mobile-nav-link {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.mobile-nav-link:hover {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  text-decoration: none;
}

/* ============ FOOTER ============ */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 2rem 1rem;
}

@media (min-width: 768px) {
  .footer__inner { grid-template-columns: 1fr 2fr 1fr; }
}

.footer__brand .logo-icon { font-size: 1.5rem; }
.footer__tagline { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

.footer__disclaimer-bar {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.footer__links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  align-items: center;
}

.footer__links a {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.footer__links a:hover { color: var(--color-primary); }

.footer__bottom {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  text-align: center;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ============ LOADING ============ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 1rem;
  color: var(--color-text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ TOAST ============ */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}

.toast {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px var(--color-shadow);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast--success { border-left-color: var(--color-success); }
.toast--error   { border-left-color: var(--color-danger); }
.toast--info    { border-left-color: var(--color-info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(16px); }
}

/* ============ UTILITY ============ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.section {
  padding: 3rem 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
}

.see-all-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-primary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.empty-state p {
  font-size: 0.95rem;
  max-width: 360px;
  margin: 0 auto 1.5rem;
}

/* Price formatting */
.price {
  font-weight: 700;
  color: var(--color-primary);
}

.price--original {
  text-decoration: line-through;
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 0.85em;
}

.price--discount {
  color: var(--color-danger);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb__sep { opacity: 0.4; }
.breadcrumb__current { color: var(--color-text); }

/* Page layout */
.page {
  padding: 1.5rem 0 3rem;
}

.page-title {
  margin-bottom: 1.5rem;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-bg) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
