:root {
  --color-bg: #f7f7f5;
  --color-surface: #ffffff;
  --color-text: #23262b;
  --color-text-muted: #61666f;
  --color-border: #e4e3df;
  --color-primary: #c8511b;
  --color-primary-dark: #a4400f;
  --color-accent: #1f2a3c;
  --radius: 10px;
  --shadow: 0 4px 16px rgba(20, 20, 20, 0.06);
  --shadow-hover: 0 10px 28px rgba(20, 20, 20, 0.12);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
}

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

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 48px 0; }
.section-title { font-size: 1.4rem; margin: 0 0 20px; }
.page-title { font-size: 2rem; margin: 8px 0 24px; }

/* Header */
.site-header, .admin-header {
  background: var(--color-accent);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-bar, .admin-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-mark {
  background: var(--color-primary);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.brand-logo {
  height: 42px;
  width: auto;
  border-radius: 8px;
  display: block;
}

.main-nav {
  display: flex;
  gap: 4px;
}

.main-nav a, .admin-nav a {
  color: rgba(255, 255, 255, 0.8);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.95rem;
}

.nav-badge {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: #fff;
  display: block;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-accent), #33445e);
  color: #fff;
  padding: 72px 0;
}

.hero-photo {
  background-image:
    linear-gradient(100deg, rgba(12, 20, 34, 0.85) 0%, rgba(24, 46, 78, 0.68) 42%, rgba(58, 122, 194, 0.38) 100%),
    url('/images/hero-discs.jpeg');
  background-size: cover;
  background-position: center;
  min-height: 420px;
  display: flex;
  align-items: center;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 48px;
}
.hero-text { flex: 1 1 480px; max-width: 560px; }
.hero h1 { font-size: 2.4rem; margin: 0 0 16px; line-height: 1.2; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6); }
.hero-sub { color: #fff; font-size: 1.05rem; margin: 0 0 28px; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}

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

.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.btn-secondary { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { background: var(--color-bg); color: var(--color-text); }

.btn-danger { background: #b3261e; color: #fff; }
.btn-danger:hover { background: #8f1e17; color: #fff; }

.btn-small { padding: 7px 14px; font-size: 0.85rem; }

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.chip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--color-text);
}

.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--color-text);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

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

.product-card-image {
  aspect-ratio: 1 / 1;
  background: #f0efec;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 14px 16px 18px; }
.product-card-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  font-weight: 700;
}
.product-card-body h3 { margin: 6px 0 6px; font-size: 1.05rem; }
.product-card-body p { margin: 0; color: var(--color-text-muted); font-size: 0.9rem; }

.empty-state { color: var(--color-text-muted); padding: 24px 0; }

/* Product detail */
.breadcrumb { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 420px) 1fr;
  gap: 40px;
}

.product-gallery-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-gallery-main img { width: 100%; height: 100%; object-fit: contain; }

.product-gallery-thumbs { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.product-gallery-thumb { margin: 0; width: 72px; }
.product-gallery-thumb img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--color-border);
}
.product-gallery-thumb figcaption {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
}

.product-info h1 { margin: 8px 0 12px; font-size: 1.7rem; }
.product-lead { font-size: 1.05rem; color: var(--color-text-muted); }
.product-description { white-space: pre-line; margin-top: 16px; }

.quality-badge { width: 110px; height: auto; margin-top: 20px; display: block; }

.spec-block { margin-top: 40px; max-width: 640px; }
.spec-block h2 { font-size: 1.2rem; margin-bottom: 14px; }

.specs-table, .compat-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.specs-table th, .specs-table td,
.compat-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 0.92rem;
}

.specs-table tr:last-child th, .specs-table tr:last-child td,
.compat-table tr:last-child td { border-bottom: none; }

.specs-table th { color: var(--color-text-muted); font-weight: 600; width: 40%; }

.spec-block-wide { max-width: none; }
.specs-table-grid { width: auto; min-width: 100%; }
.specs-table-grid th { width: auto; white-space: nowrap; text-align: left; }
.specs-table-grid td { white-space: nowrap; }

.diamonds { display: flex; gap: 4px; align-items: center; }
.diamond-icon { width: 20px; height: 20px; flex-shrink: 0; }
.diamond-icon .diamond-fill { fill: #dcdcd6; }
.diamond-icon.filled .diamond-fill { fill: #d81e1e; }
.diamond-icon .diamond-facets { stroke: rgba(255, 255, 255, 0.6); stroke-width: 0.7; stroke-linejoin: round; }

/* Prose pages */
.prose { max-width: 720px; }
.prose p { margin: 0 0 16px; }
.prose ul { margin: 0 0 16px; padding-left: 20px; }
.prose-content { white-space: pre-line; }

.contact-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
}

.link-arrow { font-weight: 600; }
.about-teaser p { max-width: 640px; color: var(--color-text-muted); }

/* Footer */
.site-footer {
  background: var(--color-accent);
  color: rgba(255, 255, 255, 0.75);
  padding: 24px 0;
  margin-top: 40px;
  font-size: 0.85rem;
}

.footer-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.site-footer a { color: #fff; }

/* Admin */
.admin-body { background: var(--color-bg); }
.admin-nav { display: flex; align-items: center; gap: 4px; }
.inline-form { display: inline; }

.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-accent);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-hover);
  z-index: 20;
}
.nav-dropdown-menu a { display: block; white-space: nowrap; }
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.link-button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.95rem;
  border-radius: 6px;
}
.link-button:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.link-danger { color: var(--color-primary) !important; }

.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  padding: 20px;
}

.admin-login-card {
  background: var(--color-surface);
  padding: 36px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-hover);
}

.admin-login-logo { display: block; height: 72px; width: auto; margin: 0 auto 12px; border-radius: 12px; }
.admin-login-card h1 { margin: 0 0 4px; font-size: 1.4rem; text-align: center; }
.admin-login-sub { color: var(--color-text-muted); margin: 0 0 20px; font-size: 0.9rem; text-align: center; }
.admin-login-card label { display: block; margin-bottom: 14px; font-size: 0.9rem; font-weight: 600; }
.admin-login-card input { width: 100%; margin-top: 6px; }
.admin-login-card .btn { width: 100%; margin-top: 6px; }

.form-error {
  background: #fdecea;
  color: #a4271b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.form-success {
  background: #eaf6ec;
  color: #1e6b32;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  font-weight: 600;
}

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--color-border); text-align: left; font-size: 0.92rem; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table-thumb { width: 64px; }
.admin-table th:first-child, .admin-table td:first-child { width: 36px; }
.row-select-product, #selectAllProducts { width: 16px; height: 16px; cursor: pointer; accent-color: var(--color-primary); }

.admin-bulk-bar { margin-bottom: 12px; }
.admin-table-thumb img { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.admin-table-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.admin-table-actions .inline-form { display: flex; align-items: center; }
.admin-table-actions .link-button { padding: 0; font-size: 0.92rem; }

.featured-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.featured-toggle input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--color-primary); }

.category-new-form { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 28px; max-width: 480px; }
.category-new-form label { flex: 1; margin-bottom: 0; }
.category-new-form input { margin-top: 6px; }
.category-rename-form { display: flex; gap: 8px; align-items: center; }
.category-rename-form input { width: auto; flex: 1; min-width: 160px; }
.category-table td { vertical-align: middle; }
.hint { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 16px; }

input[type="text"], input[type="password"], input[type="email"], input[type="file"], select, textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: #fff;
  color: var(--color-text);
  width: 100%;
}

textarea { resize: vertical; }

.admin-form { max-width: 760px; }
.admin-form label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 18px; }
.admin-form label input, .admin-form label select, .admin-form label textarea { margin-top: 6px; }
.admin-form .hint { font-weight: 400; color: var(--color-text-muted); }
.required-mark { color: var(--color-primary); font-weight: 400; }

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

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }

.form-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}
.form-fieldset legend { font-weight: 700; padding: 0 6px; font-size: 0.9rem; }

.current-image-preview { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; }

.message-list { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.message-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.message-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.message-card-contacts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.88rem; color: var(--color-text-muted); margin-bottom: 10px; }
.message-card-body { margin: 0; white-space: pre-line; }

.repeatable-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.repeatable-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.gallery-row { grid-template-columns: auto 1fr auto; }
.gallery-row-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }

.remove-row-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--color-text-muted);
}
.remove-row-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }

.form-actions { display: flex; gap: 12px; align-items: center; }

/* Responsive */
@media (max-width: 760px) {
  .main-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--color-accent);
    flex-direction: column;
    padding: 8px;
    display: none;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .product-detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hero-inner { flex-direction: column; text-align: center; }
  .hero-text { max-width: 100%; }
  .hero-photo {
    background-image:
      linear-gradient(rgba(12, 20, 34, 0.8), rgba(24, 46, 78, 0.8)),
      url('/images/hero-discs.jpeg');
  }
  .hero h1 { font-size: 1.9rem; }
  .admin-nav { flex-wrap: wrap; justify-content: center; }
  .category-new-form { flex-direction: column; align-items: stretch; max-width: 100%; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Confirm modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-hover);
}

.modal-text { margin: 0 0 20px; font-size: 0.95rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }
