/* ============ K-FamShop — тема «Сказка» ============ */
@import url("https://fonts.googleapis.com/css2?family=Comfortaa:wght@500;700&family=Nunito:wght@400;600;700;800&display=swap");

:root {
  --accent: #7c3aed;      /* фиолетовый: кнопки, цены, акценты */
  --accent-dark: #6d28d9;
  --accent-soft: #ede9fe;
  --gold: #f6a821;        /* золото: итоги, звёзды */
  --gold-soft: #fdf3d8;
  --green: #16a34a;
  --red: #dc2626;
  --bg-top: #e9e2f7;      /* небо: светлая лаванда */
  --bg-bottom: #fff7ea;   /* переход в тёплый крем */
  --panel: #fffdf8;
  --border: #e3d9f5;
  --border-gold: #f3e2b3;
  --text: #43345c;
  --muted: #8d7fae;
}

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

body {
  font-family: "Nunito", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, #f1e9fb 40%, var(--bg-bottom) 100%) fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

h1, h2, h3, .logo, .cat-name, .btn, .stat-num, .p-name, th, summary {
  font-family: "Comfortaa", "Nunito", sans-serif;
}
h1 { color: var(--accent); margin-bottom: 16px; }
h2 { color: var(--accent-dark); margin: 14px 0 10px; }
h3 { margin: 12px 0 8px; }
a { color: var(--accent); }

/* ---------- Небо: облака и звёзды (строго позади контента) ---------- */
.sky {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
}
.cloud {
  position: absolute; width: 260px; height: 90px; border-radius: 90px;
  background: radial-gradient(circle at 30% 40%, #ffffff 0 60%, rgba(255,255,255,.75) 100%);
  opacity: .8; filter: blur(1px);
  animation: drift 38s linear infinite;
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.cloud::before { width: 110px; height: 110px; top: -50px; left: 40px; }
.cloud::after  { width: 80px;  height: 80px;  top: -34px; left: 120px; }
.c1 { top: 8%;  left: -260px; animation-duration: 44s; }
.c2 { top: 24%; left: -520px; animation-duration: 58s; opacity: .55; }
.c3 { top: 55%; left: -380px; animation-duration: 70s; opacity: .4; }
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 300px)); }
}
.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 3px at 6% 14%, #f6a821 90%, transparent),
    radial-gradient(circle 2px at 18% 32%, #f6a821 90%, transparent),
    radial-gradient(circle 2.5px at 32% 10%, #f6a821 90%, transparent),
    radial-gradient(circle 2px at 47% 26%, #f6a821 90%, transparent),
    radial-gradient(circle 3px at 63% 8%,  #f6a821 90%, transparent),
    radial-gradient(circle 2px at 78% 20%, #f6a821 90%, transparent),
    radial-gradient(circle 2.5px at 90% 34%, #f6a821 90%, transparent),
    radial-gradient(circle 2px at 12% 58%, #f6a821 90%, transparent),
    radial-gradient(circle 2.5px at 85% 62%, #f6a821 90%, transparent),
    radial-gradient(circle 2px at 55% 44%, #f6a821 90%, transparent);
  opacity: .5;
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: .65; } }
@media (prefers-reduced-motion: reduce) {
  .cloud, .stars { animation: none; }
}

/* ---------- Шапка ---------- */
header {
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav {
  max-width: 1100px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; position: relative;
}
.logo {
  font-size: 1.45rem; font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-decoration: none; letter-spacing: .5px;
  transition: transform .2s;
}
.logo:hover { transform: rotate(-2deg) scale(1.03); }
.logo-emoji { margin-left: 6px; }
.nav-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-links > a {
  color: #6b5a8e; text-decoration: none; font-weight: 700; position: relative;
}
.nav-links > a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 3px; width: 0;
  border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width .25s;
}
.nav-links > a:hover::after { width: 100%; }
.badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 12px; padding: 1px 7px; margin-left: 2px;
}
.burger-check { display: none; }
.burger { display: none; font-size: 26px; cursor: pointer; color: var(--accent); }

/* выпадающие меню */
.dropdown { position: relative; }
.dropdown summary {
  list-style: none; cursor: pointer; font-weight: 700; color: #6b5a8e;
  background: var(--accent-soft); padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--border); transition: background .2s;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown[open] summary { background: #ddd3f7; }
.dropdown .menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--panel); border: 2px solid var(--border); border-radius: 16px;
  padding: 8px; min-width: 200px; z-index: 60;
  box-shadow: 0 14px 30px rgba(67, 52, 92, .18);
  display: flex; flex-direction: column;
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dropdown .menu a {
  color: var(--text); text-decoration: none; padding: 8px 12px;
  border-radius: 10px; font-weight: 600;
}
.dropdown .menu a:hover { background: var(--accent-soft); }

main { flex: 1; max-width: 1100px; margin: 0 auto; padding: 26px 24px 48px; width: 100%; }
footer {
  text-align: center; padding: 22px; color: var(--muted);
  border-top: 2px dashed var(--border); background: rgba(255,253,248,.7);
}
footer a { color: var(--muted); }

/* ---------- Сообщения ---------- */
.flash {
  padding: 12px 18px; border-radius: 16px; margin: 0 0 10px;
  font-weight: 700; border: 2px solid; animation: pop .25s ease-out;
}
.flash-success { background: #e9f9ef; color: #166534; border-color: #b8e6c7; }
.flash-error { background: #fdecec; color: #b91c1c; border-color: #f5c2c2; }

/* ---------- Панели и формы ---------- */
.panel {
  background: var(--panel); border: 2px solid var(--border); border-radius: 20px;
  padding: 20px; margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(67, 52, 92, .07);
}
.page-content { white-space: pre-wrap; line-height: 1.7; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.inline-check { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-weight: 600; }
.inline-check input { width: auto; }
.form-panel { max-width: 560px; }

label { display: block; font-weight: 700; font-size: 14px; margin: 12px 0 4px; color: #6b5a8e; }
input, textarea, select {
  font-family: inherit; font-size: 15px; color: var(--text);
  background: #fff; border: 2px solid var(--border); border-radius: 12px;
  padding: 10px 12px; outline: none; width: 100%; max-width: 420px;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .14);
}
textarea { resize: vertical; }
.inline input, .inline select, .inline textarea, .row input, .row select { max-width: none; }
.icon-input { max-width: 70px; text-align: center; }
.num-input { max-width: 90px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block; color: #fff; padding: 10px 22px;
  border-radius: 999px; text-decoration: none; font-weight: 700; border: none;
  cursor: pointer; font-family: inherit; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 4px 0 var(--accent-dark);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn.green { background: linear-gradient(135deg, #22c55e, var(--green)); box-shadow: 0 4px 0 var(--green); }
.btn.gray {
  background: #f1ecfa; color: #6b5a8e; box-shadow: 0 3px 0 #ddd3f0;
}
.btn.gray:hover { background: #e7dff6; }
.btn.red { background: linear-gradient(135deg, #ef4444, var(--red)); box-shadow: 0 4px 0 var(--red); }
.btn.small { padding: 6px 14px; font-size: 13px; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.btn.big { padding: 13px 30px; font-size: 17px; }
.btn.ghost {
  background: transparent; color: var(--accent);
  border: 2px solid var(--accent); box-shadow: none;
}
.btn.ghost:hover { background: var(--accent-soft); }
.btn.heart {
  background: #fff; color: var(--accent); border: 2px solid var(--accent);
  box-shadow: none;
}
.btn.heart:hover { background: var(--accent-soft); animation: heartbeat .6s ease; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); } 30% { transform: scale(1.15); } 60% { transform: scale(1.05); }
}

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: #6b5a8e; padding: 10px 8px; border-bottom: 2px solid var(--border);
}
td { padding: 10px 8px; border-bottom: 1px solid #f1ecf9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td, tr:hover td { background: #faf7ff; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; vertical-align: middle; margin-right: 6px; }

/* ---------- Каталог ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 16px; }
.card {
  background: var(--panel); border: 2px solid var(--border); border-radius: 22px;
  padding: 14px; display: flex; flex-direction: column; gap: 6px;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 14px 28px rgba(67, 52, 92, .16); }
.card.out { opacity: .7; }
.p-photo { width: 100%; height: 170px; object-fit: cover; border-radius: 14px; }
.p-photo.big { height: 340px; }
.p-icon {
  font-size: 54px; text-align: center; background: var(--accent-soft);
  border-radius: 14px; padding: 18px 0; transition: transform .3s;
}
.card:hover .p-icon { transform: rotate(-6deg) scale(1.08); }
.p-cat { font-size: 12px; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: .6px; }
.p-name { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.p-desc { color: var(--muted); font-size: 14px; flex: 1; }
.p-price { font-weight: 700; font-size: 20px; color: var(--accent); }
.p-price.big { font-size: 26px; }
.stock-info { font-size: 13px; color: var(--green); font-weight: 700; }
.out-label {
  display: inline-block; background: #fdecec; color: var(--red);
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.total-row { font-size: 18px; margin: 8px 0; }

/* ---------- Категории ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; margin-top: 16px; }
.cat-tile {
  background: var(--panel); border: 2px solid var(--border); border-radius: 22px;
  padding: 22px 14px; text-align: center; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  transition: transform .2s, box-shadow .2s;
}
.cat-tile:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 14px 28px rgba(67, 52, 92, .16); }
.cat-icon { font-size: 44px; transition: transform .3s; }
.cat-tile:hover .cat-icon { transform: scale(1.2) rotate(-6deg); }
.cat-count { font-size: 13px; color: var(--muted); }

.catalog-layout { display: flex; gap: 24px; align-items: flex-start; }
.cat-side { min-width: 200px; background: var(--panel); border: 2px solid var(--border); border-radius: 20px; padding: 14px; }
.side-title { font-weight: 700; font-family: "Comfortaa"; color: var(--accent); margin-bottom: 8px; }
.side-link {
  display: block; padding: 7px 12px; border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 600;
  transition: transform .15s, background .2s;
}
.side-link:hover { background: var(--accent-soft); transform: translateX(4px); }
.side-link.active { background: var(--accent); color: #fff; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.search-form input[type="text"] { flex: 1; min-width: 160px; max-width: none; }
.pagination { color: var(--muted); margin-top: 14px; }

/* ---------- Товар и отзывы ---------- */
.product-page { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.product-view { flex: 1; min-width: 280px; }
.product-info { flex: 1.2; min-width: 280px; }
.p-desc-full { margin: 8px 0; }
.qty-cell { margin: 0; }
.review-item { border-bottom: 1px dashed var(--border); padding: 10px 0; }
.review-item:last-of-type { border-bottom: none; }

/* ---------- Статусы ---------- */
.status {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700;
}
.status-new { background: var(--gold-soft); color: #a16207; }
.status-assembled { background: #e0f2fe; color: #0369a1; }
.status-done { background: #e9f9ef; color: #166534; }
.status-cancelled { background: #fdecec; color: #b91c1c; }
.status-paid { background: #e9f9ef; color: #166534; }
.status-unpaid { background: var(--gold-soft); color: #a16207; }

/* ---------- Чат ---------- */
.chat-box { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; margin: 10px 0; }
.msg { max-width: 75%; padding: 10px 14px; font-size: 15px; animation: pop .2s ease-out; }
.msg-user { align-self: flex-end; background: var(--accent-soft); border-radius: 18px 18px 4px 18px; }
.msg-admin { align-self: flex-start; background: var(--gold-soft); border-radius: 18px 18px 18px 4px; }
.msg img, .msg video { max-width: 100%; border-radius: 12px; margin-top: 6px; }
.msg-time { font-size: 11px; margin-top: 4px; }
.chat-form input[type="text"] { flex: 1; min-width: 180px; }
.chat-form input[type="file"] { max-width: 220px; font-size: 13px; }

/* ---------- Админка ---------- */
details summary { cursor: pointer; font-weight: 700; color: var(--accent); margin: 8px 0; }
.panel h2 { margin-top: 0; }
.admin-tabs a {
  display: inline-block; margin: 0 6px 12px 0; padding: 7px 16px;
  border-radius: 999px; background: var(--accent-soft); color: #6b5a8e;
  text-decoration: none; font-weight: 700; font-size: 14px;
  border: 2px solid var(--border); transition: background .2s, transform .15s;
}
.admin-tabs a:hover { background: #ddd3f7; transform: translateY(-2px); }
.admin-tabs a.active-tab { background: var(--accent); color: #fff; border-color: var(--accent); }
.done-msg { opacity: .6; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card { text-align: center; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--accent); }
.chart { display: flex; align-items: flex-end; gap: 18px; height: 180px; padding-top: 10px; }
.chart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; flex: 1; height: 100%; }
.chart-bar {
  width: 100%; max-width: 64px; border-radius: 10px 10px 4px 4px; min-height: 4px;
  background: linear-gradient(180deg, var(--accent), #a78bfa);
}

/* ---------- Лендинг ---------- */
.lnd-hero {
  background: linear-gradient(135deg, #ede9fe 0%, #fdf3d8 100%);
  border: 2px solid var(--border); border-radius: 28px;
  padding: 48px 32px; margin-bottom: 26px; text-align: center;
  box-shadow: 0 10px 30px rgba(67, 52, 92, .1);
}
.lnd-hero h1 { font-size: 2.1rem; margin-bottom: 10px; }
.lnd-hero p { max-width: 560px; margin: 0 auto 18px; color: #5c4a80; font-size: 17px; }
.lnd-hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.lnd-trust { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lnd-trust span {
  background: #fff; border: 2px solid var(--border-gold); border-radius: 999px;
  padding: 6px 16px; font-weight: 700; font-size: 14px; color: #6b5a8e;
}
.lnd-section { margin: 34px 0; }
.lnd-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }
.lnd-step {
  background: var(--panel); border: 2px solid var(--border); border-radius: 20px;
  padding: 18px; display: flex; gap: 12px; align-items: flex-start;
}
.lnd-num {
  flex: 0 0 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
  font-family: "Comfortaa"; font-size: 18px;
}
.lnd-why { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.lnd-faq {
  background: var(--panel); border: 2px solid var(--border); border-radius: 16px;
  padding: 12px 18px; margin-bottom: 10px;
}
.lnd-faq summary { color: var(--text); font-weight: 700; }
.lnd-cta {
  text-align: center; padding: 36px 20px; border-radius: 28px;
  background: linear-gradient(135deg, var(--accent), #a78bfa 60%, var(--gold));
  color: #fff; margin: 34px 0;
}
.lnd-cta h2 { color: #fff; margin-bottom: 14px; }
.error-page { text-align: center; }
.cart-link { position: relative; }
.catalog-main { flex: 1; min-width: 0; }
.lnd-hero-inner { max-width: 720px; margin: 0 auto; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .burger { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(255, 253, 248, .98); border-bottom: 2px solid var(--border);
    padding: 16px 24px; flex-direction: column; align-items: flex-start; gap: 10px; z-index: 55;
  }
  .burger-check:checked ~ .nav-links { display: flex; }
  .dropdown .menu { position: static; box-shadow: none; border: none; padding: 4px 0 4px 12px; }
}
@media (max-width: 720px) {
  .catalog-layout, .product-page { flex-direction: column; }
  .cat-side { width: 100%; }
}
/* ==== Правки: новинки / промокоды / чаты ==== */

/* Подсказка под промокодом в корзине */
.promo-hint {
  font-size: 13px; font-weight: 600; margin-top: 8px;
}
.promo-hint.warn {
  color: #b26a00; background: #fff7e0;
  border: 1px dashed #f0d08a; border-radius: 10px;
  padding: 8px 12px;
}
.promo-hint.ok { color: var(--green, #2e7d32); }

/* Кнопка-звёздочка «в новинках» в таблице товаров */
.feat-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 18px; color: #c9b79f; padding: 4px 6px;
  transition: transform .15s, color .2s;
}
.feat-btn:hover { transform: scale(1.25); }
.feat-btn.on {
  color: var(--yellow);
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
}

/* Пометка про скрытые чаты в админке */
.chat-hidden-note {
  font-size: 13px; color: var(--muted); font-style: italic;
}
