﻿@import url("https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700;800;900&display=swap");

:root {
  --ink: #020202;
  --muted: #333333;
  --paper: #ffffff;
  --line: #dfdfdf;
  --accent: #a48a7b;
  --accent-dark: #333333;
  --sage: #a48a7b;
  --charcoal: #1f1f1f;
  --white: #fff;
  --danger: #a62828;
  --surface: #fcfcfc;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: "Jost", Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(164, 138, 123, 0.13), rgba(255, 255, 255, 0.86) 44%),
    var(--surface);
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.login-card img {
  width: 150px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

.login-card h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h1 {
  letter-spacing: 0;
}

h2 {
  line-height: 1.04;
  letter-spacing: 0;
}

h3 {
  line-height: 1.18;
}

.login-card p,
.status-bar,
.product-meta,
label {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--white);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(164, 138, 123, 0.28);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

button,
.header-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  padding: 10px 14px;
  color: var(--white);
  background: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

button:hover,
.header-actions a:hover {
  background: var(--accent);
}

button.ghost {
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
}

.admin-shell {
  min-height: 100vh;
  background: var(--surface);
}

.dashboard {
  padding: clamp(18px, 4vw, 54px);
}

.admin-header,
.status-bar,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.06);
}

.admin-header p {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.admin-header h1 {
  margin-bottom: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0;
  padding: 12px 16px;
  color: var(--ink);
  font-weight: 700;
  background: rgba(164, 138, 123, 0.1);
}

.admin-grid {
  display: grid;
  grid-template-columns: 280px minmax(340px, 0.95fr) minmax(390px, 1.05fr);
  gap: 14px;
  align-items: start;
}

.category-page-grid {
  grid-template-columns: minmax(340px, 0.8fr) minmax(420px, 1.2fr);
}

.panel {
  padding: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.06);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.category-list,
.product-list {
  display: grid;
  gap: 8px;
}

.catalog-overview {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(300px, 0.8fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.05);
}

.section-label {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.overview-heading h2,
.category-section-head h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  align-items: end;
}

.overview-metrics div {
  min-width: 82px;
  padding: 2px 18px;
  border-left: 1px solid var(--line);
}

.overview-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-metrics strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
}

.category-quick-open {
  display: grid;
  gap: 7px;
}

.category-quick-open > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.category-quick-open button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.category-home {
  width: 100%;
}

.category-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.category-home-list {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.category-dashboard-card {
  min-width: 0;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.category-dashboard-card:hover {
  border-color: rgba(164, 138, 123, 0.75);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.09);
  transform: translateY(-2px);
}

.category-card-head {
  display: flex;
  gap: 13px;
  align-items: center;
}

.category-card-index {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  background: rgba(164, 138, 123, 0.09);
  font-size: 0.82rem;
  font-weight: 900;
}

.category-card-head p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.category-card-head h3 {
  margin: 0;
  font-size: 1.25rem;
}

.category-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.category-card-metrics span + span {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.category-card-metrics strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.category-card-subcategories {
  min-height: 42px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.category-card-open {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--white);
  background: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.category-card-open::after {
  content: "\2192";
  color: var(--accent);
  font-size: 1.1rem;
}

.category-card-open:hover {
  background: var(--accent-dark);
}

.category-product-menu {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
}

.category-product-menu summary {
  position: relative;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 38px 9px 12px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.category-product-menu summary::-webkit-details-marker {
  display: none;
}

.category-product-menu summary::after {
  content: "+";
  position: absolute;
  right: 13px;
  color: var(--accent);
  font-size: 1.15rem;
}

.category-product-menu[open] summary::after {
  content: "-";
}

.category-product-menu summary strong {
  color: var(--accent);
}

.category-product-options {
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.category-product-options a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.category-product-options a:last-child {
  border-bottom: 0;
}

.category-product-options a:hover {
  color: var(--accent-dark);
  background: rgba(164, 138, 123, 0.1);
}

.category-product-options small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

@media (min-width: 1121px) {
  .category-dashboard-card:last-child:nth-child(3n + 1) {
    grid-column: 2;
  }
}

.category-dropdown {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.category-dropdown summary {
  list-style: none;
  display: grid;
  gap: 4px;
  padding: 12px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.category-dropdown summary::-webkit-details-marker {
  display: none;
}

.category-dropdown summary::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 12px;
}

.category-dropdown summary {
  position: relative;
  padding-right: 34px;
}

.category-dropdown[open] summary::after {
  content: "-";
}

.category-dropdown.is-active summary {
  color: var(--white);
  background: var(--accent);
}

.category-dropdown small {
  color: inherit;
  opacity: 0.72;
}

.category-products {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.category-product {
  justify-content: flex-start;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
}

.category-product.is-active {
  color: var(--white);
  background: var(--ink);
}

.empty-list {
  margin: 4px 2px;
  color: var(--muted);
  font-size: 0.9rem;
}

.category-item,
.product-item {
  width: 100%;
  justify-content: flex-start;
  min-height: auto;
  padding: 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  text-align: left;
}

.category-item.is-active,
.product-item.is-active {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

.category-item small,
.product-item small {
  display: block;
  margin-top: 4px;
  opacity: 0.75;
}

.category-page-intro {
  margin: -2px 0 12px;
  color: var(--muted);
}

.category-page-intro-panel {
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  color: var(--muted);
  background: var(--white);
}

.category-page-intro-panel p {
  margin: 0;
}

.page-link {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
}

.page-link:hover {
  color: var(--accent-dark);
}

.filters,
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.editor-form,
.category-form {
  display: grid;
  gap: 13px;
}

.category-form {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: start;
}

.check-row input {
  width: auto;
}

.image-tools {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
}

.image-tools img {
  width: 130px;
  height: 100px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.gallery-help { margin: 0; color: var(--muted); }
.admin-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.admin-gallery-item { min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--white); }
.admin-gallery-item img { display: block; width: 100%; height: 125px; object-fit: cover; }
.admin-gallery-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px; }
.admin-gallery-controls span { flex-basis: 100%; color: var(--ink); font-weight: 700; }
.admin-gallery-controls button { min-width: 0; padding: 5px 8px; font-size: .78rem; }
.admin-gallery-controls button:disabled { opacity: .4; cursor: default; }
.gallery-empty { grid-column: 1 / -1; padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }

.form-message {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 1120px) {
  .admin-grid,
  .category-page-grid {
    grid-template-columns: 220px 1fr;
  }

  .category-page-grid {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    grid-column: 1 / -1;
  }

  .catalog-overview {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .overview-heading {
    grid-column: 1 / -1;
  }

  .category-home-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard {
    padding: 12px;
  }

  .admin-header,
  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-header h1 {
    font-size: 2rem;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions a,
  .header-actions button {
    flex: 1 1 130px;
    text-align: center;
  }

  .status-bar span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .admin-grid,
  .filters,
  .field-row,
  .image-tools {
    grid-template-columns: 1fr;
  }

  .catalog-overview {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    border-left-width: 1px;
    border-top: 5px solid var(--accent);
  }

  .overview-heading {
    grid-column: auto;
  }

  .overview-metrics div {
    min-width: 0;
    padding: 2px 10px;
  }

  .overview-metrics div:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .category-quick-open > div {
    grid-template-columns: 1fr;
  }

  .category-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .category-section-head button {
    width: 100%;
  }

  .category-home-list {
    grid-template-columns: 1fr;
  }

  .category-dashboard-card {
    min-height: 0;
  }

  .category-product-options a {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .image-tools img {
    width: 100%;
    height: 180px;
  }
}

