/* ═══════════════════════════════════════════════════════
   TechHub — Магазин техники
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #14022a;
  --surface: #021e06;
  --surface2: #101973;
  --surface3: #262846;
  --border: #2e3152;
  --text: #e8eaf0;
  --text-dim: #9395b2;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --green: #00cec9;
  --green-dark: #00b894;
  --orange: #fdcb6e;
  --red: #ff6b6b;
  --pink: #fd79a8;
  --gradient: linear-gradient(135deg, #6c5ce7, #00cec9);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
  --font: 'SN Pro', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Header ──────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 2.9rem;
  white-space: nowrap;
}

.header__logo-icon {
  font-size: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.header__logo-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.header__nav::-webkit-scrollbar { display: none; }

.nav-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 20px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #fff; }

.cart-toggle {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.cart-toggle:hover { background: var(--surface3); transform: scale(1.05); }

.cart-count {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.cart-count.empty { background: var(--surface3); color: var(--text-dim); }

/* ── Banner ──────────────────────────────────────────── */
.banner {
  position: relative;
  max-width: 1400px;
  margin: 24px auto;
  padding: 60px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-left: 24px;
  margin-right: 24px;
}

.banner__content { position: relative; z-index: 2; }

.banner__badge {
  display: inline-block;
  background: rgba(108, 92, 231, 0.2);
  color: var(--accent-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.banner__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.banner__subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-bottom: 24px;
  max-width: 520px;
  line-height: 1.6;
}

.banner__cta {
  background: var(--gradient);
  border: none;
  color: #fff;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.banner__cta:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108, 92, 231, 0.4); }

.banner__deco {
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.banner__circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.08;
}

.banner__circle.c1 {
  width: 400px; height: 400px;
  background: var(--accent);
  top: -100px; right: -100px;
  animation: float 6s ease-in-out infinite;
}

.banner__circle.c2 {
  width: 250px; height: 250px;
  background: var(--green);
  bottom: -80px; right: 200px;
  animation: float 8s ease-in-out infinite reverse;
}

.banner__circle.c3 {
  width: 180px; height: 180px;
  background: var(--pink);
  top: 30px; right: 300px;
  animation: float 5s ease-in-out infinite 1s;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* ── Seller Card ─────────────────────────────────────── */
.seller-card {
  max-width: 1400px;
  margin: 0 auto 24px;
  margin-left: 24px;
  margin-right: 24px;
  padding: 20px 28px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.12), rgba(0, 206, 201, 0.08));
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.seller-card__avatar {
  width: 56px; height: 56px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.seller-card__info { flex: 1; min-width: 200px; }

.seller-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.seller-card__bio {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.seller-card__btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.seller-card__btn:hover { background: #5b4bd5; transform: translateY(-1px); }

/* ── Products ────────────────────────────────────────── */
.products {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.products__header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.products__header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.products__count {
  color: var(--text-dim);
  font-size: 0.9rem;
}

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

/* ── Product Card ────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  cursor: default;
  animation: fadeInUp 0.4s ease backwards;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(108, 92, 231, 0.15);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.product-card__image {
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface2);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-card__category {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.product-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.product-card__desc {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
  flex: 1;
  margin-bottom: 16px;
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-card__price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
}

.product-card__add {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.product-card__add:hover { background: #5b4bd5; transform: scale(1.1); }
.product-card__add:active { transform: scale(0.95); }

.product-card__stock {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.product-card__stock strong { color: var(--green); }

/* ── Cart Sidebar ────────────────────────────────────── */
.cart-sidebar {
  position: fixed;
  top: 0; right: -440px;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.open { right: 0; }

.cart-sidebar__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-sidebar__header h3 { font-size: 1.15rem; font-weight: 700; }

.cart-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cart-close:hover { background: var(--surface3); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  animation: fadeInUp 0.3s ease;
}

.cart-item__img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface3);
  flex-shrink: 0;
}

.cart-item__info { flex: 1; }

.cart-item__name { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.cart-item__price { font-size: 0.85rem; color: var(--green); font-weight: 700; }

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item__qty button {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface3);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.cart-item__qty button:hover { background: var(--accent); color: #fff; }

.cart-item__qty span {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.cart-item__remove {
  background: none;
  border: none;
  color: var(--red);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.2s;
}

.cart-item__remove:hover { transform: scale(1.2); }

.cart-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

.cart-empty__icon { font-size: 3rem; margin-bottom: 12px; }

.cart-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.cart-total span:last-child { color: var(--green); }

.cart-order-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cart-order-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(108, 92, 231, 0.4); }

/* ── Overlay ─────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.overlay.active { opacity: 1; pointer-events: all; }

/* ── Chat Widget ─────────────────────────────────────── */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0) translateY(40px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
}

.chat-widget.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 14px 16px;
  background: var(--gradient);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header__left { display: flex; align-items: center; gap: 10px; }

.chat-header__avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-header__name { font-weight: 700; font-size: 0.95rem; }

.chat-header__status {
  font-size: 0.72rem;
  opacity: 0.9;
}

.chat-minimize {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-minimize:hover { background: rgba(255,255,255,0.3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeInUp 0.25s ease;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg .typing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  margin: 0 2px;
  animation: typingBounce 1.4s infinite;
}

.chat-msg .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-msg .typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--accent); }

.chat-input::placeholder { color: var(--text-dim); }

.chat-send {
  width: 42px; height: 42px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send:hover { background: #5b4bd5; transform: scale(1.05); }

/* ── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .banner { padding: 36px 24px; margin-left: 12px; margin-right: 12px; }
  .seller-card { margin-left: 12px; margin-right: 12px; flex-direction: column; text-align: center; }
  .products { padding: 0 12px 48px; }
  .products__grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
  .chat-widget { bottom: 12px; right: 12px; width: calc(100vw - 24px); height: calc(100vh - 100px); }
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
