/* ============ 3D-Store — дизайн v2 ============ */

:root {
  --bg: #0b0e14;
  --bg-soft: #0f131b;
  --panel: #141924;
  --panel-2: #1b2130;
  --border: #232b3d;
  --border-hi: #32405c;
  --text: #eef1f7;
  --muted: #8b94a7;
  --accent: #ff7a2f;
  --accent-2: #ffb15e;
  --accent-ink: #2b1503;
  --ok: #3ddc84;
  --warn: #ffc24b;
  --danger: #ff5c5e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px -12px rgba(0, 0, 0, .55);
  --glow: 0 0 0 1px rgba(255, 122, 47, .35), 0 8px 32px -8px rgba(255, 122, 47, .45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 122, 47, .13), transparent 60%),
    radial-gradient(700px 420px at -10% 20%, rgba(94, 130, 255, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- Шапка ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(11, 14, 20, .72);
  border-bottom: 1px solid rgba(35, 43, 61, .8);
}
header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 20px; letter-spacing: -.3px; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 19px;
  box-shadow: 0 6px 18px -6px rgba(255, 122, 47, .6);
}
.nav-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover { text-decoration: none; border-color: var(--border-hi); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: var(--accent-ink);
}
.btn.primary:hover { box-shadow: var(--glow); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: rgba(255, 92, 94, .4); color: #ff9394; }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Хиро ---------- */
.hero { padding: 64px 0 30px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  margin: 0 0 14px;
  letter-spacing: -1.2px;
  line-height: 1.12;
  font-weight: 800;
  background: linear-gradient(100deg, #fff 30%, var(--accent-2) 75%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); margin: 0; max-width: 620px; font-size: 16.5px; }
.badge-cod {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 20px; padding: 8px 16px; border-radius: 999px;
  background: rgba(61, 220, 132, .1); color: var(--ok);
  border: 1px solid rgba(61, 220, 132, .28);
  font-size: 13.5px; font-weight: 650;
}

/* ---------- Каталог ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  padding: 26px 0 72px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}
.card .thumb {
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(240px 130px at 65% 20%, rgba(255, 122, 47, .12), transparent 70%),
    linear-gradient(160deg, #1a2030, #10141d);
  display: grid; place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .thumb img { transform: scale(1.045); }
.card .thumb .placeholder { font-size: 52px; opacity: .3; filter: saturate(.6); }
.card .body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .body h3 { margin: 0; font-size: 17.5px; font-weight: 700; letter-spacing: -.2px; }
.card .desc {
  color: var(--muted); font-size: 13.5px; margin: 0; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .price { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.card .price small { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 4px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--muted); font-weight: 550;
}
.inactive-tag {
  font-size: 11px; color: var(--warn);
  border: 1px solid rgba(255, 194, 75, .45); border-radius: 999px; padding: 2px 9px;
  vertical-align: middle;
}

/* ---------- Модалки ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 7, 11, .72);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 18px;
}
.modal-backdrop.open { display: flex; animation: fadeIn .16s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  width: 100%; max-width: 540px; max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.modal.wide { max-width: 760px; }
.modal header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0;
  background: inherit;
}
.modal header h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.modal .content { padding: 22px 24px; }
.modal .actions {
  padding: 18px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}
.x {
  background: var(--panel-2); border: 1px solid var(--border);
  width: 34px; height: 34px; border-radius: 50%;
  color: var(--muted); font-size: 19px; cursor: pointer; line-height: 1;
  display: grid; place-items: center;
  transition: color .15s ease, border-color .15s ease;
}
.x:hover { color: var(--text); border-color: var(--border-hi); }

/* ---------- Формы ---------- */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 7px; font-weight: 650; text-transform: uppercase; letter-spacing: .5px; }
input, textarea, select {
  width: 100%;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 47, .18);
}
input::placeholder, textarea::placeholder { color: #5b6478; }
textarea { resize: vertical; min-height: 76px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }

.variant-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.variant-row input:first-child { flex: 2; }
.variant-row input:nth-child(2) { flex: 1; }

.msg-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg-ok { color: var(--ok); font-size: 13px; margin-top: 10px; }

.empty { text-align: center; color: var(--muted); padding: 70px 20px; font-size: 15px; }

/* ---------- Чат ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
  min-height: 280px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.bubble {
  max-width: 76%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 14.5px;
  word-wrap: break-word;
  line-height: 1.45;
}
.bubble .meta { display: block; font-size: 10.5px; opacity: .6; margin-top: 5px; }
.bubble.customer {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border-bottom-right-radius: 5px;
}
.bubble.owner {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}
/* В админке роли зеркалятся: владелец справа */
.chat.as-owner .bubble.owner {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); border: none;
  border-radius: 18px; border-bottom-right-radius: 5px;
}
.chat.as-owner .bubble.customer {
  align-self: flex-start;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text);
  border-radius: 18px; border-bottom-left-radius: 5px;
}
.chat-input {
  display: flex; gap: 10px; padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  border-radius: 0 0 var(--radius) var(--radius);
}
.chat-input input { flex: 1; }

/* ---------- Заказы ---------- */
.orders-list { display: flex; flex-direction: column; gap: 14px; padding: 12px 0 72px; }
.order-item {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center;
  transition: border-color .18s ease;
}
.order-item:hover { border-color: var(--border-hi); }
.order-item .info h4 { margin: 0 0 5px; font-size: 16px; letter-spacing: -.2px; }
.order-item .info .sub { color: var(--muted); font-size: 13.5px; }
.order-item .right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.status-pill {
  font-size: 11.5px; font-weight: 750; padding: 5px 12px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .5px;
}
.status-new       { background: rgba(255, 194, 75, .14); color: var(--warn); }
.status-confirmed { background: rgba(96, 165, 255, .14); color: #7cb5ff; }
.status-shipped   { background: rgba(167, 139, 250, .15); color: #b9a5ff; }
.status-done      { background: rgba(61, 220, 132, .13); color: var(--ok); }
.status-cancelled { background: rgba(255, 92, 94, .13); color: var(--danger); }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 22px 0; }
.tab {
  padding: 11px 18px; cursor: pointer; color: var(--muted); font-weight: 650;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Прочее ---------- */
.notice {
  background: rgba(255, 122, 47, .06);
  border: 1px solid rgba(255, 122, 47, .22);
  border-radius: var(--radius-sm);
  padding: 15px 18px; margin: 16px 0; font-size: 14px; color: #cdd3de;
}
.notice code {
  background: rgba(255, 255, 255, .07); padding: 2px 7px; border-radius: 6px;
  color: var(--accent-2); font-size: 13px;
}

.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 99px; border: 2px solid var(--bg); }

@media (max-width: 560px) {
  .hero { padding: 44px 0 20px; }
  .row { flex-direction: column; gap: 0; }
  .order-item { flex-direction: column; align-items: flex-start; }
  .modal .actions { flex-wrap: wrap; }
}
