/* Hijab Shop - Modest Islamic Fashion Theme */
:root {
  --primary: #0d5c4d;       /* Emerald green */
  --primary-dark: #094033;
  --primary-light: #e8f5f1;
  --accent: #c9a66b;        /* Soft gold */
  --bg: #faf8f5;            /* Warm cream */
  --card: #ffffff;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --border: #e8e4de;
  --success: #0d5c4d;
  --warning: #d97706;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(13, 92, 77, 0.08);
  --shadow-hover: 0 6px 24px rgba(13, 92, 77, 0.12);
  --font: 'Segoe UI', 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

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

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.logo img {
  width: auto;
  height: 48px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 6px;
}

.logo-text span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary);
  cursor: pointer;
  padding: 0.25rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.main-nav a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.cart-btn {
  position: relative;
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

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

.cart-count {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, #f0e9df 100%);
  padding: 2.5rem 1rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.hero p {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Category pills */
.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.cat-pill {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.cat-pill:hover,
.cat-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
  }
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

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

.product-card .img-wrap {
  aspect-ratio: 3/4;
  background: var(--primary-light);
  overflow: hidden;
  position: relative;
}

.product-card .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 2.5rem;
  opacity: 0.4;
}

.product-card .body {
  padding: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card .name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--text);
  line-height: 1.3;
}

.product-card .price {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: auto;
}

.product-card .btn {
  margin-top: 0.6rem;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

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

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

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-block { width: 100%; }

/* Product detail */
.product-detail {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .product-detail {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

.detail-img {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--primary-light);
  aspect-ratio: 3/4;
}

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

.detail-info h1 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.detail-info .price {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.option-group {
  margin-bottom: 1rem;
}

.option-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.option-btn {
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.option-btn:hover,
.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.option-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.color-swatch.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qty-control button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  font-size: 1.1rem;
  cursor: pointer;
}

.qty-control input {
  width: 50px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  font-size: 1rem;
}

/* Cart drawer */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 380px);
  height: 100%;
  background: var(--card);
  z-index: 210;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h2 {
  font-size: 1.15rem;
  color: var(--primary-dark);
}

.cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.cart-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.cart-item img {
  width: 64px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--primary-light);
}

.cart-item-info {
  flex: 1;
}

.cart-item-info .name {
  font-weight: 600;
  font-size: 0.9rem;
}

.cart-item-info .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cart-item-info .price {
  color: var(--primary);
  font-weight: 600;
  margin-top: 0.2rem;
}

.cart-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.empty-cart {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* Checkout form */
.checkout-form {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

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

.notice-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 0.85rem 1rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--primary-dark);
}

/* Footer */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 2rem 1rem;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--accent);
}

/* Admin styles */
.admin-body {
  display: flex;
  min-height: 100vh;
  background: #f0f2f5;
}

.admin-sidebar {
  width: 240px;
  background: var(--primary-dark);
  color: white;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.admin-sidebar .brand {
  padding: 1.25rem;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
  transition: all 0.15s;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.admin-main {
  flex: 1;
  overflow-x: auto;
}

.admin-topbar {
  background: white;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-content {
  padding: 1.5rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.table-wrap {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data th {
  background: var(--primary-light);
  font-weight: 600;
  color: var(--primary-dark);
  white-space: nowrap;
}

table.data tr:hover td {
  background: #fafafa;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-contacted { background: #dbeafe; color: #1e40af; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-shipped { background: #e0e7ff; color: #3730a3; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-light), #f0e9df);
  padding: 1rem;
}

.login-box {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-hover);
}

.login-box h1 {
  text-align: center;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.login-box .sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .admin-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 300;
    transition: left 0.25s;
  }
  .admin-sidebar.open { left: 0; }
  .admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 290;
  }
  .admin-overlay.open { display: block; }
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Language switcher */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.lang-switch a {
  color: var(--text-muted);
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
}
.lang-switch a.active,
.lang-switch a:hover {
  color: var(--primary);
  background: var(--primary-light);
}
.lang-switch span {
  color: var(--border);
}

/* Product gallery */
.detail-gallery { display: flex; flex-direction: column; gap: 0.75rem; }
.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.thumb-btn {
  width: 64px;
  height: 80px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
}
.thumb-btn.active,
.thumb-btn:hover {
  border-color: var(--primary);
}
.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Color with name label */
.color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.color-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.color-option:hover,
.color-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.color-option .color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.color-option .color-name {
  font-weight: 500;
}
.req { color: var(--danger); }

#btnAddCart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Social */
.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.social-chip:hover { opacity: 0.85; }
.social-section .social-card iframe { max-width: 100%; }


/* Home: no big title bars */
.home-search {
  padding: 1rem 1rem 0.5rem;
  display: flex;
  justify-content: center;
}
.home-search .search-bar {
  max-width: 420px;
  width: 100%;
  display: flex;
  gap: 0.4rem;
}
.home-search .search-bar input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
}

/* Two columns: social left + products right */
.home-layout {
  display: block;
  padding-top: 1rem;
  padding-bottom: 2rem;
}
.home-layout.has-social {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 1.25rem;
  align-items: start;
}
.home-social {
  position: sticky;
  top: 70px;
}
.home-social .social-heading {
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin-bottom: 0.85rem;
  text-align: left;
}
.home-social .social-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.85rem;
  text-align: center;
}
.home-social .social-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.65rem;
}
.home-social .social-link-btn {
  margin-top: 0.65rem;
}
.home-products .cat-pills {
  margin-bottom: 1rem;
}

/* Color chips on product cards */
.card-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0 0.2rem;
}
.card-color {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: #f8f6f2;
  border-radius: 999px;
  padding: 0.15rem 0.45rem 0.15rem 0.2rem;
  max-width: 100%;
}
.card-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.card-color-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

@media (max-width: 900px) {
  .home-layout.has-social {
    grid-template-columns: 1fr;
  }
  .home-social {
    position: static;
    order: -1; /* social still on top on mobile */
  }
}

/* Hide old hero title bars if any leftover class used */
.hero h1, .hero p {
  display: none !important;
}
.hero {
  padding: 0.5rem 1rem 0 !important;
  background: transparent !important;
}

/* Pre-order badge */
.badge-preorder {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.25rem;
  letter-spacing: 0.02em;
}
