/* =========
   RESET-ish
   ========= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  transition:
    background var(--transition-base),
    color var(--transition-base);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =========
   TYPOGRAPHY
   ========= */

.h1,
.h2,
.h3,
.h4,
.section-title,
.page-title {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--text);
  letter-spacing: -0.02em;
}

.h1,
.page-title {
  font-size: 48px;
  line-height: 56px;
  font-weight: 800;
}

.h2,
.section-title {
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
}

.h3 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
}

.h4 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
}

.text-lg {
  font-size: 18px;
  line-height: 28px;
}

.text-base {
  font-size: 16px;
  line-height: 24px;
}

.text-sm {
  font-size: 14px;
  line-height: 20px;
}

.text-xs {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.text-soft {
  color: var(--text-soft);
}

.text-muted {
  color: var(--text-muted);
}

.text-primary {
  color: var(--color-primary);
}

/* =========
   LAYOUT
   ========= */

.container-page,
.container-main,
.container-text {
  width: 100%;
  margin-inline: auto;
  padding-inline: 20px;
}

.container-page {
  max-width: var(--container-page);
}

.container-main {
  max-width: var(--container-main);
}

.container-text {
  max-width: var(--container-text);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
}

.section {
  padding-block: 32px;
}

.section-lg {
  padding-block: 64px;
}

.grid {
  display: grid;
  gap: 24px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* =========
   HEADER / NAV
   ========= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-main__link {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-soft);
  font-weight: 600;
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
}

.nav-main__link:hover,
.nav-main__link.is-active {
  color: var(--text);
  background: var(--surface);
}

/* =========
   BUTTONS
   ========= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #111827;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-icon {
  width: 46px;
  min-width: 46px;
  padding: 0;
}

/* =========
   INPUTS
   ========= */

.input-base,
.select-base,
.textarea-base {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.input-base,
.select-base {
  min-height: 48px;
  padding: 0 14px;
}

.textarea-base {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

.input-base::placeholder,
.textarea-base::placeholder {
  color: var(--text-muted);
}

.input-base:focus,
.select-base:focus,
.textarea-base:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.input-error {
  border-color: var(--color-danger);
}

.input-disabled,
.input-base:disabled,
.select-base:disabled,
.textarea-base:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.search-field {
  position: relative;
}

.search-field__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field .input-base {
  padding-left: 42px;
}

/* =========
   TOGGLES / CHECKBOX
   ========= */

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-soft);
}

.checkbox input {
  accent-color: var(--color-primary);
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--transition-fast);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition-fast);
}

.toggle.is-active {
  background: var(--color-primary);
}

.toggle.is-active::after {
  transform: translateX(20px);
}

/* =========
   BADGES
   ========= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge-primary {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  color: var(--color-primary);
  border: 1px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
}

.badge-success {
  background: color-mix(in srgb, var(--color-success) 16%, transparent);
  color: var(--color-success);
  border: 1px solid color-mix(in srgb, var(--color-success) 35%, transparent);
}

.badge-danger {
  background: color-mix(in srgb, var(--color-danger) 16%, transparent);
  color: var(--color-danger);
  border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
}

.badge-info {
  background: color-mix(in srgb, var(--color-info) 16%, transparent);
  color: var(--color-info);
  border: 1px solid color-mix(in srgb, var(--color-info) 35%, transparent);
}

.badge-warning {
  background: color-mix(in srgb, var(--color-warning) 16%, transparent);
  color: var(--color-warning);
  border: 1px solid color-mix(in srgb, var(--color-warning) 35%, transparent);
}

/* =========
   CARDS
   ========= */

.card-base {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.card-base:hover {
  background: var(--surface-2);
}

.card-padding {
  padding: 20px;
}

.card-product {
  overflow: hidden;
}

.card-product__image {
  aspect-ratio: 4 / 3;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.card-product__body {
  padding: 16px;
}

.card-product__title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 6px;
}

.card-product__meta {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 12px;
}

.card-product__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-product__price-current {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.card-product__price-old {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.card-deal,
.card-alert,
.card-premium,
.card-stat {
  padding: 20px;
}

/* =========
   HERO
   ========= */

.hero {
  padding-block: 48px 32px;
}

.hero__wrap {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: center;
}

.hero__content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__visual {
  min-height: 320px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 45%),
    linear-gradient(180deg, var(--surface), var(--bg-alt));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* =========
   TABS
   ========= */

.tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
}

.tabs__item {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--text-soft);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.tabs__item.is-active {
  background: var(--color-primary);
  color: #111827;
}

/* =========
   TABLES
   ========= */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.table-base {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table-base th,
.table-base td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table-base th {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  background: color-mix(in srgb, var(--surface) 80%, var(--bg) 20%);
}

.table-base tr:last-child td {
  border-bottom: none;
}

/* =========
   OFFER ROW
   ========= */

.offer-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.8fr 0.8fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.offer-row__shop {
  display: flex;
  align-items: center;
  gap: 12px;
}

.offer-row__price {
  font-weight: 800;
}

/* =========
   STATS STRIP
   ========= */

.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.stat-box {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.stat-box__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-box__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

/* =========
   MODAL
   ========= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  width: min(100%, 560px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 24px;
}

.modal__header,
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal__header {
  margin-bottom: 18px;
}

.modal__body {
  color: var(--text-soft);
}

.modal__footer {
  margin-top: 20px;
}

/* =========
   TOAST
   ========= */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: grid;
  gap: 12px;
}

.toast {
  min-width: 320px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-dropdown);
  color: var(--text);
}

.toast-success {
  border-color: color-mix(in srgb, var(--color-success) 40%, var(--border));
}

.toast-danger {
  border-color: color-mix(in srgb, var(--color-danger) 40%, var(--border));
}

.toast-info {
  border-color: color-mix(in srgb, var(--color-info) 40%, var(--border));
}

/* =========
   EMPTY STATE
   ========= */

.empty-state {
  padding: 40px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-state__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-heading);
}

.empty-state__text {
  margin: 0;
  color: var(--text-soft);
}

/* =========
   FOOTER
   ========= */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding-block: 32px;
  margin-top: 48px;
}

/* =========
   RESPONSIVE
   ========= */

@media (max-width: 1100px) {
  .hero__wrap,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }

  .stats-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .h1,
  .page-title {
    font-size: 36px;
    line-height: 44px;
  }

  .h2,
  .section-title {
    font-size: 28px;
    line-height: 36px;
  }

  .hero__wrap,
  .grid-3,
  .grid-4,
  .grid-2,
  .stats-strip {
    grid-template-columns: 1fr;
  }

  .site-header__inner {
    flex-wrap: wrap;
    padding-block: 12px;
  }

  .offer-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .table-base {
    min-width: 640px;
  }
}