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

:root {
  --bg: #eef2f6;

  --card: #ffffff;
  --card-border: #d7dee8;

  --text: #253044;
  --text-light: #697586;

  --primary: #5f7ea3;
  --primary-hover: #4f6d90;

  --danger: #cf6b6b;

  --input-bg: #f9fbfd;
  --input-border: #cfd7e3;

  --shadow: 0 4px 18px rgba(27, 39, 51, 0.06);

  --radius: 4px;
}

body {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;

  background: var(--bg);
  color: var(--text);
  min-width: 320px;
}

h1 {
  padding: 28px 28px 0;
  font-size: 44px;
  font-weight: 700;
  color: #2c3648;
}

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

.wrapper {
  display: flex;
  gap: 24px;
  padding: 24px 28px 28px;
  align-items: flex-start;
  max-width: 1140px;
  margin: 0 auto;
}

/* ========================================
   SIDEBAR
======================================== */

.sidebar {
  width: 360px;
  flex-shrink: 0;

  position: sticky;
  top: 20px;

  display: flex;
  flex-direction: column;
  gap: 20px;

  z-index: 20;
}

.filters,
.canvas-container {
  background: var(--card);

  border: 1px solid var(--card-border);

  border-radius: var(--radius);

  overflow: hidden;

  box-shadow: var(--shadow);
}

/* ========================================
   FILTERS
======================================== */

.filters {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 300px;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.filter {
  min-width: 0;
}

.filterName {
  margin-bottom: 10px;

  font-size: 14px;
  font-weight: 600;

  color: #445066;
}

select {
  width: 100%;
  height: 44px;

  padding: 0 14px;

  border-radius: var(--radius);

  border: 1px solid var(--input-border);

  background: var(--input-bg);

  font-size: 14px;
  color: var(--text);

  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

select:hover {
  border-color: #b5c1d0;
}

select:focus {
  outline: none;

  border-color: var(--primary);

  box-shadow: 0 0 0 3px rgba(95, 126, 163, 0.12);

  background: #fff;
}

/* ========================================
   RANGE
======================================== */

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

.range-value {
  min-width: 32px;

  font-size: 14px;
  font-weight: 700;

  color: var(--primary);
}

.range span:last-child {
  font-size: 14px;
  color: var(--text-light);
}

input[type='range'] {
  flex: 1;
  height: 4px;

  appearance: none;

  border-radius: 999px;

  background: #d6dee8;

  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;

  width: 16px;
  height: 16px;

  border-radius: 50%;

  background: var(--primary);

  border: 2px solid white;

  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

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

.reset-btn {
  width: 100%;
  height: 46px;

  border: none;

  border-radius: var(--radius);

  background: var(--danger);

  color: white;

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;

  transition:
    background 0.2s,
    transform 0.2s;
}

.reset-btn:hover {
  background: #bf5f5f;
}

.reset-btn:active {
  transform: scale(0.99);
}

/* ========================================
   CANVAS
======================================== */

.canvas-container {
  position: relative;
  z-index: 5;
}

#canvas {
  display: block;
  width: 100%;
  background: #fff;
}

/* ========================================
   PRODUCTS
======================================== */

.products {
  flex: 1;
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 20px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 16px;

  position: relative;
  z-index: 1;
}

/* ========================================
   PRODUCT CARD
======================================== */

.product-card {
  display: grid;

  grid-template-columns:
    112px
    minmax(0, 1fr)
    250px;

  gap: 18px;

  align-items: start;

  background: var(--card);

  border: 1px solid var(--card-border);

  border-radius: var(--radius);

  padding: 18px;

  box-shadow: var(--shadow);

  transition:
    border-color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

.product-card:hover {
  border-color: #bec9d8;

  transform: translateY(-1px);

  box-shadow: 0 8px 20px rgba(27, 39, 51, 0.08);
}

/* ========================================
   IMAGE
======================================== */

.product-card__image {
  width: 112px;
  height: 112px;

  flex-shrink: 0;

  border-radius: var(--radius);

  border: 1px solid #d8e0ea;

  background: #f7f9fc;

  overflow: hidden;

  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.product-card__image img {
  width: 100%;
  height: 100%;

  object-fit: contain;

  padding: 10px;
}

.product-card__image--empty {
  font-size: 14px;
  color: #92a0b4;

  align-items: center;
}

/* ========================================
   INFO
======================================== */

.product-card__content {
  min-width: 0;
}

.product-card__title {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;

  margin-bottom: 10px;

  color: #2b3444;
}

.product-card__meta {
  margin-bottom: 10px;

  font-size: 15px;
  line-height: 1.55;

  color: var(--text-light);
}

.product-card__params {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-param {
  padding: 6px 10px;

  border-radius: var(--radius);

  background: #eef3f8;

  border: 1px solid #d8e1eb;

  font-size: 13px;
  color: #526073;
}

/* ========================================
   RIGHT SIDE
======================================== */

.product-card__side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card__price {
  padding: 14px;

  border-radius: var(--radius);

  background: #f5f8fb;

  border: 1px solid #d7e0ea;
}

.product-card__price-label {
  margin-bottom: 6px;

  font-size: 13px;
  color: #738197;
}

.product-card__price-value {
  font-size: 18px;
  font-weight: 700;

  color: #2f3a4a;
}

.product-card__total {
  margin-top: 8px;

  font-size: 32px;
  font-weight: 800;

  color: #273245;
}

/* ========================================
   COUNTER
======================================== */

.product-card__controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-counter {
  display: grid;
  grid-template-columns: 56px 1fr 56px;

  overflow: hidden;

  border-radius: var(--radius);

  border: 1px solid #ccd6e2;

  background: white;
}

.product-counter__btn {
  height: 44px;

  border: none;

  background: #eef3f8;

  color: #445066;

  font-size: 24px;
  font-weight: 500;

  cursor: pointer;

  transition: background 0.2s;
}

.product-counter__btn:hover {
  background: #dde7f0;
}

.product-counter__value {
  display: flex;
  align-items: center;
  justify-content: center;

  border-left: 1px solid #d5dde8;
  border-right: 1px solid #d5dde8;

  font-size: 16px;
  font-weight: 700;

  color: #2f3a4a;
}

/* ========================================
   CART BUTTON
======================================== */

.product-card__btn {
  width: 100%;
  height: 46px;

  border: none;

  border-radius: var(--radius);

  background: var(--primary);

  color: white;

  font-size: 15px;
  font-weight: 600;

  cursor: pointer;

  transition:
    background 0.2s,
    transform 0.2s;
}

.product-card__btn:hover {
  background: var(--primary-hover);
}

.product-card__btn:active {
  transform: scale(0.99);
}

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

.no-products {
  padding: 60px 24px;

  border-radius: var(--radius);

  border: 1px dashed #bcc7d5;

  background: #fff;

  text-align: center;

  color: var(--text-light);

  font-size: 16px;
}

/* ========================================
   SCROLLBAR
======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #c7d0dc;
  border-radius: 999px;
}

/* ========================================
   LARGE TABLETS
======================================== */

@media (max-width: 1200px) {
  .product-card {
    grid-template-columns:
      90px
      minmax(0, 1fr)
      210px;

    gap: 14px;
  }

  .product-card__image {
    width: 90px;
    height: 90px;
  }

  .product-card__title {
    font-size: 22px;
  }

  .product-card__meta {
    font-size: 14px;
  }

  .product-card__price {
    padding: 12px;
  }

  .product-card__total {
    font-size: 26px;
  }

  .product-counter {
    grid-template-columns: 48px 1fr 48px;
  }
}

/* ========================================
   MEDIUM SCREENS
======================================== */

@media (max-width: 992px) {
  h1 {
    font-size: 34px;
    padding: 24px 20px 0;
  }

  .wrapper {
    flex-direction: column;
    padding: 20px;
    width: 100%;
  }

  .sidebar,
  .products,
  .filters,
  .canvas-container,
  .list {
    width: 100%;
    max-width: 100%;
  }

  .sidebar {
    position: static;
  }

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

  .filter--full {
    grid-column: 1 / -1;
  }

  .product-card {
    width: 100%;

    grid-template-columns: 88px minmax(0, 1fr);

    grid-template-areas:
      'image content'
      'image side';

    gap: 16px;
  }

  .product-card__image {
    grid-area: image;

    width: 88px;
    height: 88px;
  }

  .product-card__content {
    grid-area: content;
    min-width: 0;
  }

  .product-card__side {
    grid-area: side;

    width: 100%;
    min-width: 0;
  }

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

  .product-card__total {
    margin-top: 0;

    font-size: 24px;

    white-space: nowrap;
  }
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 640px) {
  h1 {
    font-size: 28px;
    padding: 20px 16px 0;
  }

  .wrapper {
    padding: 16px;
    gap: 16px;
  }

  .filters {
    padding: 16px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-columns: 1fr;

    grid-template-areas:
      'image'
      'content'
      'side';

    padding: 16px;
  }

  .product-card__image {
    width: 84px;
    height: 84px;
  }

  .product-card__title {
    font-size: 20px;
  }

  .product-card__meta {
    font-size: 13px;
  }

  .product-card__params {
    gap: 6px;
  }

  .product-param {
    font-size: 12px;
  }

  .product-card__price {
    display: block;
  }

  .product-card__total {
    margin-top: 6px;
    font-size: 26px;
  }

  .product-counter {
    grid-template-columns: 48px 1fr 48px;
  }
}
