:root {
  --primary: #635bff;
  --primary-dark: #0a2540;
  --accent: #00d4ff;
  --bg: #f6f9fc;
  --text: #425466;
  --text-dark: #0a2540;
  --border: #e6ebf1;
  --shadow-sm: 0 2px 5px -1px rgba(50,50,93,.25), 0 1px 3px -1px rgba(0,0,0,.3);
  --shadow-md: 0 7px 14px 0 rgba(60,66,87,.12), 0 3px 6px 0 rgba(0,0,0,.08);
  --shadow-lg: 0 15px 35px 0 rgba(60,66,87,.12), 0 5px 15px 0 rgba(0,0,0,.08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: inherit; text-decoration: none; transition: .2s; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.header { background: rgba(255,255,255,.9); backdrop-filter: blur(20px); position: sticky; top: 0; z-index: 1000; border-bottom: 1px solid var(--border); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; color: var(--text-dark); }
.brand:hover { color: var(--primary); }
.brand img { width: 32px; height: 32px; border-radius: 6px; }

.search { flex: 1; max-width: 600px; }
.search input { width: 100%; padding: 11px 18px; background: #fff; border: 1px solid var(--border); border-radius: 100px; font: inherit; font-size: 14px; box-shadow: var(--shadow-sm); transition: .2s; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,91,255,.1); }
.user-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: rgba(255,255,255,.9); border: 1px solid var(--border); font-size: 14px; color: var(--text-dark); box-shadow: var(--shadow-sm); }

.cart { position: relative; }
.cart-btn { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); padding: 9px 16px; border-radius: 100px; cursor: pointer; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); transition: .2s; position: relative; z-index: 1400; }
.cart-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.badge { background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 12px; }
.cart-panel { display: none; position: fixed; right: 24px; top: 88px; width: 380px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; z-index: 1300; }
.cart-backdrop { display: none; position: fixed; inset: 0; background: rgba(10,37,64,.35); backdrop-filter: blur(2px); z-index: 1200; }
#cart-toggle:checked ~ .cart-panel,
#cart-toggle:checked ~ .cart-backdrop { display: block; }
.cart-panel h3 { font-size: 18px; font-weight: 700; color: var(--text-dark); margin: 0 0 20px; }
.cart-items { max-height: 340px; overflow-y: auto; padding-right: 2px; }
.cart-empty {
  padding: 16px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}
.cart-item { display: flex; align-items: flex-start; gap: 16px; padding: 16px; background: #fafbfc; border-radius: var(--radius); margin-bottom: 12px; }
.cart-item img { width: 56px; height: 56px; background: #fff; padding: 8px; border-radius: 6px; border: 1px solid var(--border); }
.cart-item .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cart-item strong { display: block; font-size: 14px; font-weight: 600; color: var(--text-dark); }
.cart-item small { display: block; font-size: 13px; color: var(--text); }
.cart-qty { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; }
.cart-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-dark);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.cart-qty input {
  width: 52px;
  height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  font: inherit;
  font-size: 13px;
}
.cart-remove-btn {
  border: none;
  background: transparent;
  color: #c62828;
  font-size: 13px;
  padding: 0;
  width: fit-content;
  cursor: pointer;
}
.cart-remove-btn:hover { text-decoration: underline; }
.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 2px;
  color: var(--text-dark);
  font-size: 15px;
  font-weight: 600;
}
.cart-actions { display: flex; justify-content: center; gap: 12px; padding-top: 20px; border-top: 1px solid var(--border); margin-top: 12px; }

.catalog { display: grid; grid-template-columns: 280px 1fr; gap: 48px; padding: 40px 0; }
.sidebar { position: sticky; top: 100px; height: fit-content; }

.filter-section { margin-bottom: 32px; }
.filter-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #8898aa; margin-bottom: 16px; }
.filter-links { display: flex; flex-direction: column; gap: 4px; }
.filter-links a { font-size: 14px; padding: 8px 12px; margin: 0 -12px; color: var(--text); border-radius: 6px; transition: .2s; }
.filter-links a.active { color: var(--primary); font-weight: 600; background: rgba(99,91,255,.08); }
.filter-links a:hover { background: #fafbfc; }
.filter-group-alt { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--primary); }
.tip-box { background: #fff; padding: 18px; border-radius: var(--radius); border-left: 4px solid var(--accent); font-size: 13px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }

.hero { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-radius: var(--radius); padding: 72px 56px; margin-bottom: 56px; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); }
.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 42px; font-weight: 800; margin: 16px 0 20px; line-height: 1.2; letter-spacing: -.02em; }
.hero p { font-size: 19px; opacity: .95; max-width: 520px; line-height: 1.6; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.breadcrumb { font-size: 14px; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; flex-wrap: wrap; }
.breadcrumb .sep { margin: 0 10px; opacity: .4; }
.breadcrumb a:hover { color: var(--primary); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.catalog-empty {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
}
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); transition: .3s; overflow: hidden; }
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
.card .thumb { background: #f7fafc; aspect-ratio: 1.2/1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.card:hover .thumb img { transform: scale(1.08); }
.card .thumb img { transition: .4s; }
.card .body { padding: 24px; }
.card .title { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 12px; }
.card h2 { font-size: 17px; font-weight: 700; margin: 0; color: var(--text-dark); line-height: 1.3; }
.card h2 a:hover { color: var(--primary); }
.card p { font-size: 14px; color: var(--text); margin: 0 0 20px; line-height: 1.6; height: 44px; overflow: hidden; }
.card .actions { margin-top: 16px; }
.card .actions .button { width: 100%; }
.price { font-weight: 700; color: var(--text-dark); background: var(--bg); padding: 6px 12px; border-radius: 6px; font-size: 15px; white-space: nowrap; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }

.button { display: inline-flex; align-items: center; justify-content: center; padding: 11px 20px; border-radius: var(--radius); font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text-dark); transition: .2s; box-shadow: var(--shadow-sm); font-family: inherit; }
.button:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.button.primary { background: var(--primary); color: #fff; border: none; box-shadow: 0 4px 12px rgba(99,91,255,.3); }
.button.primary:hover { background: #5851ea; box-shadow: 0 6px 20px rgba(99,91,255,.4); }
.button.x-large { padding: 14px 24px; width: 100%; font-size: 16px; }

.product-detail-layout { display: grid; grid-template-columns: 1fr 440px; gap: 64px; margin-top: 40px; }
.product-visual { background: #fff; padding: 56px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.product-gallery { display: grid; gap: 16px; }
.gallery-stage { position: relative; display: grid; place-items: center; padding: 32px; background: #fafbfc; border-radius: var(--radius); min-height: 320px; }
.gallery-slide { opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .25s ease, transform .25s ease; position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.gallery-slide-active { opacity: 1; transform: none; position: relative; }
.gallery-slide img { width: 320px; max-width: 100%; }
#gallery-1:checked ~ .gallery-stage .slide-1,
#gallery-2:checked ~ .gallery-stage .slide-2,
#gallery-3:checked ~ .gallery-stage .slide-3 { opacity: 1; transform: none; position: relative; }
.gallery-thumbs { display: flex; gap: 12px; }
.gallery-thumbs .thumb { display: grid; place-items: center; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: .2s; }
.gallery-thumbs .thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.gallery-thumbs img { width: 64px; height: 64px; }
#gallery-1:checked ~ .gallery-thumbs label[for="gallery-1"],
#gallery-2:checked ~ .gallery-thumbs label[for="gallery-2"],
#gallery-3:checked ~ .gallery-thumbs label[for="gallery-3"] { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,91,255,.15); }
.product-long-desc h2 { font-size: 22px; font-weight: 700; color: var(--text-dark); margin-bottom: 16px; }
.product-long-desc p { line-height: 1.7; color: var(--text); margin-bottom: 20px; }
.feature-list { padding-left: 24px; margin-top: 20px; }
.feature-list li { margin-bottom: 12px; color: var(--text); line-height: 1.6; }
.feature-list li::marker { color: var(--primary); }

.product-checkout-panel { position: sticky; top: 100px; }
.sticky-content { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow-md); }
.product-header { margin-bottom: 24px; }
.product-header h1 { font-size: 32px; font-weight: 800; color: var(--text-dark); margin: 12px 0 16px; letter-spacing: -.02em; line-height: 1.2; }
.category-tag { color: var(--primary); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; background: rgba(99,91,255,.1); padding: 6px 12px; border-radius: 6px; display: inline-block; }
.sku-info { font-size: 13px; color: var(--text); }
.status-stock { color: #00d924; font-weight: 600; }
.price-block { font-size: 48px; font-weight: 800; color: var(--text-dark); margin: 28px 0; letter-spacing: -.02em; }
.price-block .currency { font-size: 24px; vertical-align: super; margin-right: 4px; font-weight: 700; }
.purchase-box { background: #fafbfc; border: 1px solid var(--border); padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.field-group { margin-bottom: 24px; }
.field-group label { display: block; font-size: 14px; font-weight: 600; color: var(--text-dark); margin-bottom: 10px; }
.qty-input-wrapper input { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 15px; transition: .2s; }
.qty-input-wrapper input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,91,255,.1); }
.purchase-actions { display: flex; flex-direction: column; gap: 12px; }
.trust-signals { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 28px; }
.signal-item { display: flex; gap: 16px; margin-bottom: 24px; font-size: 14px; padding: 16px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.signal-item .icon { font-size: 28px; line-height: 1; }
.signal-item strong { display: block; color: var(--text-dark); font-weight: 600; margin-bottom: 4px; }
.signal-item p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.5; }

.site-footer { margin-top: 100px; padding: 72px 0; border-top: 1px solid var(--border); background: #fff; }
.footer-grid { display: flex; justify-content: space-between; align-items: center; color: var(--text); font-size: 14px; }

.admin-main { padding: 36px 0 72px; }
.auth-main { padding: 56px 0 88px; }
.auth-shell { display: flex; justify-content: center; }
.auth-card {
  width: min(100%, 520px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-card h1 { margin: 0 0 12px; color: var(--text-dark); font-size: 30px; }
.auth-card p { margin: 0 0 10px; color: var(--text); }
.auth-form { display: grid; gap: 14px; margin-top: 18px; }
.auth-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.auth-status { min-height: 24px; font-size: 14px; font-weight: 600; margin-top: 12px; }
.auth-status.info { color: #0a5fd6; }
.auth-status.success { color: #117a1f; }
.auth-status.error { color: #c62828; }
.admin-status-wrap { margin-bottom: 28px; }
.admin-status-wrap h1 { margin: 0 0 8px; color: var(--text-dark); font-size: 30px; }
.admin-status-wrap p { margin: 0 0 16px; }
.admin-status { min-height: 24px; font-size: 14px; font-weight: 600; }
.admin-status.info { color: #0a5fd6; }
.admin-status.success { color: #117a1f; }
.admin-status.error { color: #c62828; }

.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.admin-card-head { margin-bottom: 16px; }
.admin-card-head h2 { margin: 0; color: var(--text-dark); font-size: 22px; }
.admin-form { margin-bottom: 16px; }
.admin-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.admin-grid.one { grid-template-columns: 1fr; }
.admin-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-field { display: grid; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-dark); }
.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
}
.admin-field textarea { resize: vertical; }
.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,91,255,.1);
}

.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; }
.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
.admin-table th { color: var(--text-dark); background: #f8fafc; }
.admin-table tr:last-child td { border-bottom: none; }
.action-cell { white-space: nowrap; display: flex; gap: 8px; }

.button.small { padding: 6px 12px; font-size: 13px; }
.button.danger {
  background: #fff2f2;
  color: #c62828;
  border-color: #f8c9c9;
}

.admin-filter-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 8px 0 12px;
  font-size: 14px;
}
.admin-filter-row label { display: flex; gap: 8px; align-items: center; }
.admin-filter-row select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.thumb-mini {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.admin-preview {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.admin-preview span { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.admin-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f7f9fc;
}

@media (max-width: 980px) {
  .topbar { gap: 12px; }
  .search { order: 3; max-width: none; width: 100%; }
  .user-nav { justify-content: flex-start; }
  .admin-grid.two,
  .admin-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .cart-panel {
    top: 78px;
    right: 12px;
    left: 12px;
    width: auto;
    padding: 18px;
  }
}
