* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #fafafa; color: #222; }
a { color: inherit; text-decoration: none; }
.container { width: min(1100px, 92%); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid #ececec; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.nav nav { display: flex; gap: 14px; }
.logo img { max-height: 72px; width: auto; display: block; }
.site-cart-link { position: relative; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #111; padding: 8px 14px; border-radius: 22px; font-weight: 700; }
.site-cart-link svg { width: 20px; height: 20px; }
.cart-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #111; color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.hero { background: linear-gradient(140deg, #f8e6ee, #f5f9ff); padding: 48px 0; }
.hero h1 { margin: 0 0 12px; font-size: clamp(28px, 4vw, 44px); }
.hero-slider { position: relative; padding: 0; min-height: 360px; overflow: hidden; border-bottom: 1px solid #ececec; }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .45s ease; background-size: cover; background-position: center; }
.hero-slide.is-active { opacity: 1; z-index: 1; }
.hero-overlay { min-height: 360px; display: flex; align-items: center; background: linear-gradient(120deg, rgba(16,24,40,.62), rgba(16,24,40,.28)); color: #fff; }
.hero-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.hero-dot { width: 10px; height: 10px; border-radius: 999px; border: 0; background: rgba(255,255,255,.45); cursor: pointer; }
.hero-dot.is-active { background: #fff; width: 20px; }
.btn { display: inline-block; background: #111; color: #fff; padding: 12px 20px; border-radius: 10px; border: 0; cursor: pointer; }
.section { padding: 34px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid #e8e8e8; border-radius: 14px; overflow: hidden; }
.card img { width: 100%; height: 200px; object-fit: cover; background: #f2f2f2; }
.card .body { padding: 12px; }
.price { font-weight: 700; }
.stories-slider { display: flex; gap: 18px; overflow-x: auto; padding: 8px 2px 12px; scrollbar-width: thin; }
.stories-slider {
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.stories-slider::-webkit-scrollbar { height: 8px; }
.stories-slider::-webkit-scrollbar-thumb { background: #cfd8e3; border-radius: 999px; }
.story-item { min-width: 126px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.story-ring { width: 120px; height: 120px; padding: 4px; border-radius: 999px; background: linear-gradient(135deg, #f97316, #ec4899, #8b5cf6); }
.story-ring img { width: 100%; height: 100%; border-radius: 999px; object-fit: cover; border: 2px solid #fff; background: #f1f5f9; }
.story-name { font-size: 13px; font-weight: 700; color: #334155; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.site-footer { margin-top: 40px; border-top: 1px solid #ececec; padding: 26px 0; background: #fff; }
.small { font-size: 13px; color: #666; }
.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.alert-success { background: #ebf9ef; color: #165c2f; }
.alert-error { background: #ffecec; color: #7b1e1e; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #ececec; }
th, td { text-align: right; padding: 10px; border-bottom: 1px solid #ececec; }
input, textarea, select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; }
label { display: block; margin-bottom: 8px; font-weight: 600; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }

/* Admin CRM layout */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; background: #f4f6fb; }
.admin-sidebar { background: #101828; color: #d6def5; padding: 24px 16px; display: flex; flex-direction: column; gap: 18px; }
.admin-sidebar-backdrop { display: none; }
.admin-brand { font-weight: 700; font-size: 20px; color: #fff; padding: 0 8px; }
.admin-menu { display: flex; flex-direction: column; gap: 6px; }
.admin-menu a { color: #d6def5; padding: 10px 12px; border-radius: 10px; }
.admin-menu a:hover { background: #1a2740; }
.admin-menu a.active { background: #253b61; color: #fff; }
.admin-logout { margin-top: auto; text-align: center; border: 1px solid #3c4f73; border-radius: 10px; padding: 10px; color: #fff; }
.admin-main { padding: 24px; min-width: 0; overflow-x: hidden; }
.admin-main-header { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.admin-main-header h2 { margin: 0; font-size: 24px; }
.admin-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid #d2d9e5;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  padding: 9px 8px;
}
.admin-menu-toggle span {
  display: block;
  height: 2px;
  background: #1f2937;
  margin: 5px 0;
  border-radius: 999px;
}
.admin-content { background: #fff; border: 1px solid #e6eaf0; border-radius: 14px; padding: 18px; min-width: 0; }
.admin-panel { background: #fbfcff; border: 1px solid #e7ebf2; border-radius: 12px; padding: 14px; margin-top: 14px; }
.admin-panel-title { margin: 0 0 10px; font-size: 16px; color: #24324a; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-actions { display: flex; justify-content: flex-start; margin: 10px 0; flex-wrap: wrap; gap: 8px; }
.pagination { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pagination a { border: 1px solid #d6dde7; border-radius: 8px; padding: 6px 10px; background: #fff; }
.pagination a.active { background: #253b61; color: #fff; border-color: #253b61; }
.row-actions { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.btn-sm { padding: 7px 12px; border-radius: 8px; font-size: 13px; }
.btn-danger { background: #7d1422; }
.btn-danger:hover { background: #69101c; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; }
.inline-check input[type="checkbox"] { width: auto; margin: 0; }
.color-control { display: flex; align-items: center; gap: 10px; }
.color-control input[type="color"] {
  width: 64px;
  min-width: 64px;
  height: 40px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid #cfd6e2;
  background: #fff;
  cursor: pointer;
}
.color-control .small { margin: 0; color: #475569; font-weight: 600; }
.table-clickable tbody tr { cursor: pointer; }
.table-clickable tbody tr:hover { background: #f8faff; }

/* Dashboard cards */
.dashboard-cards { margin-top: 8px; }
.dash-card { border: 0; border-radius: 16px; color: #fff; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14); }
.dash-card .body { padding: 18px; }
.dash-card h3 { margin: 0; font-size: 15px; font-weight: 600; opacity: .96; }
.dash-value { margin: 12px 0 0; font-size: 30px; font-weight: 800; letter-spacing: .3px; }
.dash-orders { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.dash-products { background: linear-gradient(135deg, #16a34a, #15803d); }
.dash-categories { background: linear-gradient(135deg, #d97706, #b45309); }
.dash-revenue { background: linear-gradient(135deg, #9333ea, #7e22ce); }

/* Orders modal */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal.is-open { display: flex; }
.modal-card { width: min(720px, 96vw); max-height: 86vh; overflow: auto; background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 16px; position: relative; }
.modal-close { position: absolute; left: 10px; top: 8px; border: 0; background: transparent; font-size: 24px; cursor: pointer; color: #334155; }

/* Product gallery (frontend product page) */
.product-gallery { position: relative; border-radius: 14px; overflow: hidden; background: #0f172a; }
.product-gallery-main { position: relative; width: 100%; padding-top: 70%; overflow: hidden; }
.product-gallery-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .35s ease; }
.product-gallery-slide.is-active { opacity: 1; }
.product-gallery-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.product-gallery-arrow.prev { right: 10px; }
.product-gallery-arrow.next { left: 10px; }
.product-gallery-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: #f8fafc;
  overflow-x: auto;
}
.product-gallery-thumb {
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
}
.product-gallery-thumb.is-active { border-color: #111827; }
.product-gallery-thumb img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
}
.products-loader-wrap {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.products-loader-wrap[hidden] { display: none !important; }
.products-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d1d5db;
  border-top-color: #111;
  border-radius: 999px;
  display: inline-block;
  animation: products-spin .8s linear infinite;
}
@keyframes products-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1024px) {
  .nav { flex-wrap: wrap; padding: 8px 0; }
  .nav nav { width: 100%; justify-content: space-between; }
  .grid-2 { grid-template-columns: 1fr; }
  .logo img { max-height: 56px; }
  .admin-shell { grid-template-columns: 1fr; position: relative; }
  .admin-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 85vw);
    height: 100vh;
    z-index: 80;
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -12px 0 28px rgba(15, 23, 42, 0.25);
  }
  .admin-menu-toggle { display: inline-block; }
  .admin-shell.menu-open .admin-sidebar { transform: translateX(0); }
  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.38);
    opacity: 0;
    pointer-events: none;
    z-index: 70;
    transition: opacity .2s ease;
  }
  .admin-shell.menu-open .admin-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .admin-main { padding: 12px; }
}
