/* ============================================
   LAYOUT.CSS - Layout & Structure
============================================ */

/* ===== HEADER ===== */
.header {
  background-color: rgba(250, 250, 250, 0.95);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-lg);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  padding: var(--space-sm) 0;
  transition: transform var(--transition-default);
}

.logo:hover {
  transform: scale(1.02);
}

.logo-img {
  height: 50px;
  width: auto;
  object-fit: contain;
  border-radius: var(--border-radius-sm);
}

.logo-text {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-dark-brown);
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--color-gold), var(--color-terracotta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex: 1;
  justify-content: flex-end;
}

.nav-menu {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.nav-link {
  font-weight: var(--font-weight-medium);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  transition: all var(--transition-default);
  color: var(--text-secondary);
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link:hover {
  color: var(--color-rich-brown);
  background-color: var(--bg-accent);
}

.nav-link.active {
  color: var(--color-rich-brown);
  font-weight: var(--font-weight-semibold);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-gold), var(--color-terracotta));
  border-radius: 2px;
}

/* Search Form */
.search-form {
  display: flex;
  gap: 0;
  min-width: 250px;
}

.search-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  background-color: var(--bg-primary);
  transition: all var(--transition-default);
  min-width: 0;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-terracotta);
  box-shadow: 0 0 0 3px rgba(198, 151, 107, 0.1);
}

.search-button {
  background-color: var(--color-gold);
  color: var(--color-dark-brown);
  border: 1px solid var(--color-gold);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: var(--space-sm) var(--space-lg);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-default);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-button:hover {
  background-color: var(--color-dark-gold);
  transform: translateY(-1px);
}

/* Cart Badge */
.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: var(--color-terracotta);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  min-width: 18px;
  height: 18px;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 2px solid var(--bg-primary);
}

/* Auth Buttons */
.auth-buttons {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  min-height: calc(100vh - var(--header-height) - 200px);
  padding: var(--space-2xl) 0;
  background-color: var(--bg-primary);
}

.page-header {
  margin-bottom: var(--space-2xl);
  text-align: center;
}

.page-header h1 {
  margin-bottom: var(--space-sm);
}

.page-subtitle {
  color: var(--text-light);
  font-size: var(--text-lg);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== FOOTER ===== */
.footer {
  background-color: var(--color-dark-brown);
  color: var(--color-cream);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: auto;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    var(--color-gold) 0%,
    var(--color-terracotta) 33%,
    var(--color-rich-brown) 66%,
    var(--color-gold) 100%);
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2xl);
  position: relative;
  z-index: 1;
}

.footer-section h3 {
  color: var(--color-gold);
  margin-bottom: var(--space-lg);
  font-size: var(--text-xl);
  position: relative;
  padding-bottom: var(--space-sm);
}

.footer-section h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 2px;
  background-color: var(--color-terracotta);
  border-radius: 1px;
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--color-terracotta);
  transition: color var(--transition-fast), transform var(--transition-fast);
  display: inline-block;
}

.footer-links a:hover {
  color: var(--color-gold);
  transform: translateX(4px);
}

.footer-bottom {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(240, 214, 121, 0.1);
  text-align: center;
  color: var(--color-terracotta);
  font-size: var(--text-sm);
}

/* ===== SIDEBAR LAYOUT ===== */
.layout-sidebar {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-2xl);
}

.sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  height: fit-content;
  box-shadow: var(--shadow-sm);
}

.sidebar-section {
  margin-bottom: var(--space-xl);
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-dark-brown);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--bg-accent);
}

/* ===== RESPONSIVE ===== */

/* Tablet: 901px–1100px
   Sidebar layout stacks, container stretches */
@media (max-width: 1100px) {
  :root {
    --container-max-width: 100%;
  }

  .layout-sidebar {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .sidebar {
    order: -1;
  }
}

/* Mobile: ≤900px
   Header is handled entirely by the mobile topbar + drawer in base.html.
   We just clean up anything that might conflict. */
@media (max-width: 900px) {
  .header {
    height: auto;
    padding: 0;
  }

  /* Hide the old desktop header-container on mobile
     (the mobile-topbar inside base.html takes over) */
  .header-container {
    display: none;
  }

  .main-content {
    padding: var(--space-xl) 0;
  }

  .footer-container {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    text-align: center;
  }

  .footer-section h3::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .footer-links a:hover {
    transform: none;
  }
}

/* Small mobile: ≤600px */
@media (max-width: 600px) {
  :root {
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
  }

  .footer-container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }

  .container {
    padding: 0 var(--space-md);
  }

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

  .layout-sidebar {
    gap: var(--space-lg);
  }
}

/* ===== POLICY PAGES ===== */
.policy-page {
  background: #fff;
  padding: 3rem 1rem;
}

.policy-container {
  max-width: 960px;
  margin: auto;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: #111;
}

.policy-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.policy-body h2 {
  margin-top: 2rem;
  font-size: 1.4rem;
}

.policy-body ul {
  margin-left: 1.2rem;
}

.policy-body p {
  margin-bottom: 1rem;
}