/* ============================================================
   shop.css — Operix Webshop Module
   Self-hosted, no Tailwind CDN, no Alpine.js dependency
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary: var(--shop-primary, #2563eb);
  --primary-dark: var(--shop-accent, #1d4ed8);
  --primary-light: #dbeafe;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --surface: #fff;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --transition: 0.15s ease;
  --success: #16a34a;
}

/* ── Box Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body ───────────────────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Container ──────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ─────────────────────────────────────────────────── */
.shop-header {
  background: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.shop-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* ── Logo ───────────────────────────────────────────────────── */
.shop-logo {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-logo img {
  max-height: 40px;
  width: auto;
}

/* ── Desktop Nav Links ──────────────────────────────────────── */
.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

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

/* ── Nav Actions ────────────────────────────────────────────── */
.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Cart Button ────────────────────────────────────────────── */
.btn-cart {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
  font-size: 0.9rem;
}

.btn-cart:hover {
  background: var(--primary-dark);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Language Selector ──────────────────────────────────────── */
.lang-select {
  position: relative;
}

.lang-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  transition: border-color var(--transition);
}

.lang-btn:hover {
  border-color: var(--primary);
}

.lang-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  min-width: 140px;
  z-index: 200;
  display: none;
}

.lang-dropdown.open {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.lang-option {
  text-decoration: none;
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 4px;
  color: var(--text);
  text-align: center;
  transition: background var(--transition);
}

.lang-option:hover {
  background: var(--bg);
}

.lang-option.active {
  font-weight: 700;
  color: var(--primary);
}

/* ── Mobile Menu Toggle ─────────────────────────────────────── */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}

/* ── Mobile Menu ────────────────────────────────────────────── */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px;
  z-index: 99;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu a {
  display: block;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.mobile-menu a:last-child {
  border-bottom: none;
}

/* ── Flash Messages ─────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 0.9rem;
}

.flash.success {
  background: #dcfce7;
  color: #166534;
}

.flash.error {
  background: #fee2e2;
  color: #991b1b;
}

.flash.info {
  background: #dbeafe;
  color: #1e40af;
}

/* ── Main ───────────────────────────────────────────────────── */
main.shop-main {
  min-height: 60vh;
  padding: 32px 0;
}

/* ── Hero ───────────────────────────────────────────────────── */
.shop-hero {
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  padding: 60px 40px;
  text-align: center;
  margin-bottom: 40px;
}

.shop-hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  margin-bottom: 12px;
}

.shop-hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 28px;
}

.btn-hero {
  display: inline-block;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 12px;
  text-decoration: none;
  transition: background var(--transition);
}

.btn-hero:hover {
  background: var(--bg);
}

/* ── Section Headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.section-link {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.section-link:hover {
  text-decoration: underline;
}

/* ── Category Grid ──────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.category-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.category-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.category-icon {
  font-size: 2rem;
}

.category-name {
  font-weight: 600;
  font-size: 0.9rem;
}

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

.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.product-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-img-placeholder {
  width: 100%;
  height: 200px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.product-info {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  margin-bottom: 8px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-title:hover {
  color: var(--primary);
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.product-price {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.product-badge-oos {
  font-size: 0.75rem;
  color: #ef4444;
  font-weight: 500;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
  border-radius: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

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

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

.breadcrumb-sep {
  color: var(--border);
}

/* ── Product Detail ─────────────────────────────────────────── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.product-images {
  position: sticky;
  top: 80px;
}

.product-main-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.product-thumbnails {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thumb-btn {
  width: 64px;
  height: 64px;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: none;
  transition: border-color var(--transition);
}

.thumb-btn.active {
  border-color: var(--primary);
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-name {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.product-price-lg {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.price-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.stock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}

.stock-dot.oos {
  background: #ef4444;
}

.qty-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.qty-btn {
  background: var(--bg);
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background var(--transition);
  color: var(--text);
}

.qty-btn:hover {
  background: var(--border);
}

.qty-input {
  border: none;
  text-align: center;
  width: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 0;
  outline: none;
}

.product-meta {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-row {
  display: flex;
  gap: 8px;
  font-size: 0.875rem;
}

.meta-label {
  color: var(--text-muted);
  min-width: 80px;
}

.description-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-top: 32px;
}

.description-box h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.description-content {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ── Sidebar Layout ─────────────────────────────────────────── */
.shop-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.shop-sidebar {
  position: sticky;
  top: 80px;
}

.sidebar-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.filter-link {
  display: block;
  padding: 4px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.filter-link:hover {
  color: var(--primary);
}

.filter-link.active {
  color: var(--primary);
  font-weight: 700;
}

.sort-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: #fff;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

/* ── Search ─────────────────────────────────────────────────── */
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
  background: #fff;
}

.search-input:focus {
  border-color: var(--primary);
}

.results-info {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.page-link {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}

.page-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-current {
  padding: 8px 14px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Cart Table ─────────────────────────────────────────────── */
.cart-table {
  width: 100%;
  border-collapse: collapse;
}

.cart-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 8px 0;
  border-bottom: 2px solid var(--border);
}

.cart-row {
  border-bottom: 1px solid var(--border);
}

.cart-row td {
  padding: 16px 0;
  vertical-align: middle;
}

.cart-product {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.cart-name {
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text);
  transition: color var(--transition);
}

.cart-name:hover {
  color: var(--primary);
}

.cart-sku {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.cart-summary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 6px 0;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 800;
  padding-top: 12px;
  border-top: 2px solid var(--border);
  margin-top: 8px;
}

/* ── Checkout Form ──────────────────────────────────────────── */
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
  color: var(--text);
  width: 100%;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.payment-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 16px;
}

.payment-info p {
  font-size: 0.875rem;
  color: #0c4a6e;
}

/* ── Order Pages ────────────────────────────────────────────── */
.order-page {
  text-align: center;
  padding: 60px 20px;
}

.order-icon {
  font-size: 5rem;
  margin-bottom: 20px;
}

.order-page h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.order-page p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 28px;
}

.order-details {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: left;
  max-width: 500px;
  margin: 0 auto 28px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.shop-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

.footer-main {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  padding: 40px 0;
}

.footer-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 14px;
  color: var(--text);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-lang {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-lang a {
  font-size: 0.75rem;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}

.footer-lang a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.footer-lang a.active {
  font-weight: 700;
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .product-detail {
    grid-template-columns: 1fr;
  }

  .product-images {
    position: static;
  }

  .shop-layout {
    grid-template-columns: 1fr;
  }

  .shop-sidebar {
    position: static;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .shop-hero {
    padding: 40px 24px;
  }

  .cart-table th:nth-child(2),
  .cart-row td:nth-child(2) {
    display: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

/* product-detail-grid + info-cards-grid responsive */
@media (max-width: 768px) {
  .product-detail-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .info-cards-grid { grid-template-columns: 1fr !important; }
}
