/* ============================================================
   Кондитерская «АртЁм» — стили
   Палитра: тёплый беж + дуб
   ============================================================ */
:root {
  --cream:      #F7EFE2;   /* фон — топлёное молоко */
  --beige:      #EBDCC3;   /* карточки, панели */
  --oak:        #8A5A33;   /* дуб — акценты, кнопки */
  --oak-dark:   #6B4423;   /* тёмный дуб — hover */
  --choco:      #3B2A1A;   /* почти шоколад — текст */
  --caramel:    #C99457;   /* карамель — бейджи, детали */
  --paper:      #FDF8EF;   /* светлые поверхности */
  --ok:         #5E7B4C;
  --warn:       #A8552E;
  --radius:     14px;
  --shadow:     0 4px 18px rgba(59, 42, 26, .10);
  --font-display: 'M PLUS Rounded 1c', 'Nunito', sans-serif;
  --font-script:  'M PLUS Rounded 1c', 'Nunito', sans-serif;
  --font-body:    'Nunito', 'Segoe UI', sans-serif;
}

/* ---------- Тёмная тема ---------- */
body.theme-dark {
  --cream:    #241A11;   /* фон — тёмный шоколад */
  --beige:    #3A2C1E;   /* карточки-панели */
  --oak:      #D2A06A;   /* акценты светлеют */
  --oak-dark: #E4BC8C;
  --choco:    #F0E4D2;   /* текст — топлёное молоко */
  --caramel:  #C99457;
  --paper:    #2E2216;   /* поверхности */
  --ok:       #9FBE8A;
  --warn:     #E09A75;
  --shadow:   0 4px 18px rgba(0, 0, 0, .35);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--cream);
  background-image: url("pattern-light.svg");
  background-size: 240px 240px;
  color: var(--choco);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.theme-dark { background-image: url("pattern-dark.svg"); }
main.container { flex: 1 0 auto; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
a { color: var(--oak); text-decoration: none; }
a:hover { color: var(--oak-dark); }
:focus-visible { outline: 3px solid var(--caramel); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: .01em; }

/* ---------- Шапка ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--beige);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding-top: 10px; padding-bottom: 10px;
}
.nav-scroll {
  display: flex; align-items: center; gap: 14px;
  overflow-x: auto; overflow-y: hidden; min-width: 0;
  scrollbar-width: thin; padding-bottom: 2px;
}
.nav-scroll::-webkit-scrollbar { height: 4px; }
.nav-scroll::-webkit-scrollbar-thumb { background: var(--beige); border-radius: 4px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--choco); flex-shrink: 0; }
.logo-mark {
  width: 44px; height: 44px; flex-shrink: 0;
  background: var(--beige); border-radius: 50%; padding: 4px;
}
.logo-text {
  font-family: var(--font-script); font-size: 16px; line-height: 1.05;
  display: flex; flex-direction: column; color: var(--oak);
}
.logo-text b { font-family: var(--font-display); font-weight: 800; font-size: 21px; color: var(--choco); }

.nav { display: flex; align-items: center; gap: 14px; flex-wrap: nowrap; }
.nav a { font-weight: 600; font-size: 15px; white-space: nowrap; }
.user-chip {
  background: var(--beige); border-radius: 999px;
  padding: 4px 12px; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px;
}
.cart-link { position: relative; white-space: nowrap; }
.cart-badge {
  background: var(--warn); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 7px; margin-left: 4px;
}
.theme-toggle {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px;
  background: var(--beige); text-decoration: none; flex-shrink: 0;
}
.theme-toggle:hover { background: var(--caramel); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  border-radius: 999px; padding: 9px 18px;
  transition: background .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--oak); color: var(--paper); }
.btn-primary:hover { background: var(--oak-dark); color: var(--paper); }
.btn-ghost {
  background: transparent; color: var(--oak);
  border: 1.5px solid var(--oak);
}
.btn-ghost:hover { background: var(--oak); color: var(--paper); }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn-block { display: block; width: 100%; text-align: center; }

.btn-remove {
  background: none; border: none; cursor: pointer;
  color: var(--warn); font-size: 16px; padding: 6px;
}
.btn-remove:hover { color: #7c3a1d; }

/* ---------- Флеш-сообщения ---------- */
.flash {
  margin-top: 14px; padding: 11px 16px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
}
.flash-ok   { background: #E4ECDB; color: var(--ok); }
.flash-warn { background: #F3DFD2; color: var(--warn); }

/* ---------- Герой ---------- */
.hero {
  display: flex; align-items: center; gap: 30px;
  padding: 56px 0 40px;
}
.hero-text { flex: 1; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .14em;
  font-size: 12px; font-weight: 700; color: var(--caramel);
  margin-bottom: 10px;
}
.hero h1 { font-size: clamp(38px, 5.5vw, 62px); line-height: 1.08; }
.hero-sub { margin: 18px 0 26px; max-width: 480px; font-size: 17px; }
.hero-art {
  font-size: 130px; line-height: 1;
  background: var(--beige); border-radius: 50%;
  width: 230px; height: 230px; display: grid; place-items: center;
  box-shadow: var(--shadow);
  position: relative;
}
.hero-art::after {
  content: ''; position: absolute; inset: -14px;
  border: 3px dashed var(--caramel); border-radius: 50%;
  opacity: .5;
}

/* ---------- Секции и карточки ---------- */
.section { padding: 28px 0 14px; }
.section-title {
  font-size: 28px; margin-bottom: 20px; position: relative;
  padding-bottom: 12px;
}
/* аккуратная карамельная черта под заголовком */
.section-title::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 72px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--caramel), var(--oak));
}

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.grid-featured { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card {
  background: var(--paper); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--beige);
}
.card-featured { background: linear-gradient(160deg, var(--paper) 60%, var(--beige)); }
.card-emoji { font-size: 56px; margin-bottom: 10px; }
.card-img {
  width: calc(100% + 40px); margin: -20px -20px 12px;
  height: 170px; object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card h3 { font-size: 18px; margin-bottom: 4px; }
.card-cat { font-size: 13px; color: var(--caramel); font-weight: 700; }
.card-bottom { margin-top: auto; padding-top: 14px; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 21px; }
.price-lg { font-size: 32px; }

.badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
}
.badge-star { background: var(--caramel); color: var(--paper); position: static; display:inline-block; margin-bottom:6px; width:max-content;}
.card .badge-star { position: absolute; margin: 0; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1.5px solid var(--oak); border-radius: 999px;
  padding: 6px 14px; font-size: 14px; font-weight: 600; color: var(--oak);
}
.chip-active, .chip:hover { background: var(--oak); color: var(--paper); }

/* ---------- Карточка товара ---------- */
.back-link { display: inline-block; margin: 22px 0 6px; font-weight: 600; }
.product-page {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 36px;
  padding: 20px 0 50px;
}
.product-visual {
  background: var(--beige); border-radius: var(--radius);
  display: grid; place-items: center; min-height: 340px;
  box-shadow: var(--shadow);
}
.product-emoji { font-size: 150px; }
.product-img {
  width: 100%; height: 100%; min-height: 340px;
  object-fit: cover; border-radius: var(--radius); display: block;
}
.product-info h1 { font-size: 34px; margin-bottom: 8px; }
.product-desc { margin: 14px 0 20px; font-size: 16px; }
.product-buy {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--paper); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow); margin-bottom: 26px;
}
.sub-title { font-size: 20px; margin: 18px 0 10px; }
.kbju {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-width: 480px;
}
.kbju-cell {
  background: var(--paper); border: 1px solid var(--beige);
  border-radius: var(--radius); text-align: center; padding: 12px 6px;
}
.kbju-cell b { font-family: var(--font-display); font-size: 20px; display: block; }
.kbju-cell span { font-size: 12px; color: var(--oak); }
.composition { background: var(--paper); border-left: 4px solid var(--caramel);
  padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; }

/* ---------- Корзина ---------- */
.page-title { font-size: 32px; margin: 26px 0 18px; }
.cart-layout {
  display: grid; grid-template-columns: 1.8fr 1fr; gap: 24px;
  align-items: start; padding-bottom: 50px;
}
.cart-list { display: flex; flex-direction: column; gap: 10px; }
.cart-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow);
}
.cart-emoji { font-size: 30px; }
.cart-img {
  width: 48px; height: 48px; object-fit: cover; border-radius: 10px;
}
.cart-name { flex: 1; font-weight: 600; color: var(--choco); }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--oak); background: none; color: var(--oak);
  font-size: 16px; cursor: pointer;
}
.qty-btn:hover { background: var(--oak); color: var(--paper); }
.qty { min-width: 22px; text-align: center; font-weight: 700; }
.cart-line-total { font-family: var(--font-display); min-width: 80px; text-align: right; }

.cart-summary {
  background: var(--paper); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); position: sticky; top: 84px;
}
.cart-summary h2 { font-size: 22px; margin-bottom: 14px; }
.summary-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; font-size: 14px;
}
.summary-total {
  border-top: 2px dashed var(--beige); margin-top: 8px; padding-top: 12px;
  font-size: 18px; font-weight: 700; margin-bottom: 14px;
}

/* ---------- Формы ---------- */
.panel {
  background: var(--paper); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.panel-narrow { max-width: 520px; margin: 0 auto 50px; }
.auth-panel { margin-top: 40px; }
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  font-family: var(--font-body); font-size: 15px;
  border: 1.5px solid var(--beige); border-radius: 10px;
  padding: 10px 14px; background: var(--cream); color: var(--choco);
}
input:focus, textarea:focus, select:focus { border-color: var(--oak); outline: none; }
input[type=file] { font-family: var(--font-body); font-size: 14px; color: var(--choco); }
input[type=file]::file-selector-button {
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  border: 1.5px solid var(--oak); border-radius: 999px;
  padding: 7px 16px; margin-right: 12px; cursor: pointer;
  background: var(--beige); color: var(--oak);
}
input[type=file]::file-selector-button:hover { background: var(--oak); color: var(--paper); }

.radio-card {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--beige); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  background: var(--cream);
}
.radio-card:hover { border-color: var(--caramel); }
.radio-card input { margin-top: 4px; accent-color: var(--oak); }
.radio-card small { color: var(--oak); }

.hint {
  margin-top: 16px; font-size: 13px; text-align: center;
  background: var(--beige); border-radius: 10px; padding: 10px;
}
.center { text-align: center; margin-top: 12px; }
.muted { color: #8a7a66; font-size: 14px; }

/* ---------- Заказы ---------- */
.order-card {
  background: var(--paper); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.order-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.order-head h2 { font-size: 20px; }
.status {
  margin-left: auto; border-radius: 999px; padding: 4px 14px;
  font-size: 13px; font-weight: 700;
}
.status-new        { background: var(--beige); }
.status-confirmed  { background: #E8E0CE; }
.status-cooking    { background: #F0DFC2; color: var(--oak-dark); }
.status-delivering { background: #DCE6F0; color: #3d5876; }
.status-done       { background: #E4ECDB; color: var(--ok); }
.status-cancelled  { background: #F3DFD2; color: var(--warn); }

.progress { display: flex; margin: 18px 0 8px; }
.progress-step { flex: 1; text-align: center; position: relative; }
.progress-step .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--beige); display: inline-block; position: relative; z-index: 1;
}
.progress-step::before {
  content: ''; position: absolute; top: 6px; left: -50%; width: 100%;
  height: 3px; background: var(--beige);
}
.progress-step:first-child::before { display: none; }
.progress-step.is-done .dot { background: var(--oak); }
.progress-step.is-done::before { background: var(--oak); }
.step-label { display: block; font-size: 12px; margin-top: 4px; color: var(--oak); }

.order-items { margin: 12px 0 12px 18px; font-size: 14px; }
.order-meta {
  display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px;
  border-top: 1px dashed var(--beige); padding-top: 12px;
}
.order-total { margin-left: auto; }

.status-form {
  display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap;
}

/* ---------- Таблицы (панели персонала) ---------- */
.table {
  width: 100%; border-collapse: collapse; background: var(--paper);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  margin: 16px 0 50px;
}
.table th, .table td { padding: 12px 14px; text-align: left; font-size: 14px; }
.table thead { background: var(--beige); }
.table tbody tr { border-top: 1px solid var(--beige); }
.row-muted { opacity: .55; }
.table-img {
  width: 34px; height: 34px; object-fit: cover;
  border-radius: 8px; vertical-align: middle; margin-right: 4px;
}
.row-actions { display: flex; gap: 8px; align-items: center; }

.form-details { margin-bottom: 22px; }
.form-details summary {
  cursor: pointer; font-weight: 700; font-size: 16px; color: var(--oak);
}
.product-form { margin-top: 18px; }
.form-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px;
}
.form-grid .span2 { grid-column: span 2; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; grid-column: span 2; }
.check input { accent-color: var(--oak); }
.form-actions { margin-top: 16px; display: flex; gap: 12px; }

/* ---------- Пустые состояния ---------- */
.empty-state { text-align: center; padding: 60px 0 80px; }
.empty-emoji { font-size: 70px; margin-bottom: 14px; }
.empty-state p { margin-bottom: 18px; }

/* ---------- Подвал ---------- */
.site-footer {
  background: #2A1D10; color: #D9C6AB;
  padding: 30px 0; font-size: 14px; flex-shrink: 0;
}
.footer-inner {
  display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between;
}
.footer-brand { font-family: var(--font-script); font-weight: 800; font-size: 22px; color: #EBDCC3; }

/* ---------- Всплывающее уведомление ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--oak); color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; z-index: 50;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .hero { flex-direction: column-reverse; text-align: center; padding-top: 30px; }
  .hero-art { width: 160px; height: 160px; font-size: 90px; }
  .product-page, .cart-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .cart-summary { position: static; }
  .step-label { font-size: 10px; }
  .user-chip { display: none; }
  .logo-text { display: none; }
}
@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .check { grid-column: span 1; }
  .cart-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
