/* ---------- Сброс и базовые настройки ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: #f2f4f7;
  color: #1f2a3a;
  line-height: 1.5;
}

/* ---------- Верхний блок (заголовок) ---------- */
.page-header {
  background-color: #1e3a5f;
  color: #ffffff;
  text-align: center;
  padding: 30px 20px;
}

.page-header h1 {
  font-size: 44px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  @media (max-width: 590px) {
    font-size: 24px;
  }
}
/*--------------Кнопки мобильных фильтра и меню------------------*/
.mobile-filter {
  display: none;
  .filter-btn-container {
    all: unset;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    border: 1px solid #1e3a5f;
    border-radius: 4px;
    cursor: pointer;
    img {
      width: 30px;
      height: 30px;
    }
  }
  .menu-btn-container {
    all: unset;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    border: 1px solid #1e3a5f;
    border-radius: 4px;
    cursor: pointer;
    img {
      width: 30px;
      height: 30px;
    }
  }
  @media (max-width: 590px) {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: fit-content;
    height: 50px;
  }
}
/* ---------- Горизонтальное меню ---------- */
.top-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 40px;
  padding: 16px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #d9e0e8;
  @media (max-width: 590px) {
    justify-content: flex-start;
  }
}

.top-nav .top_nav_item {
  all: unset;
  color: #1e3a5f;
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
  @media (max-width: 590px) {
    display: none;
  }
}

.top-nav .top_nav_item:hover {
  background-color: #1e3a5f;
  color: #ffffff;
}
.top-nav .selected {
  background-color: #1e3a5f;
  color: #ffffff;
}

/* ---------- Общий контейнер ---------- */
.layout {
  display: flex;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px 40px;
  @media (max-width: 590px) {
    padding: 24px 20px 40px;
  }
}

/* ---------- Вертикальное меню слева ---------- */
.side-menu {
  flex: 0 0 200px;
  background-color: #ffffff;
  border-radius: 10px;
  padding: 18px 14px;
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  align-self: flex-start;
  @media (max-width: 590px) {
    display: none;
  }
}

.side-menu h2 {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #1e3a5f;
  padding-bottom: 8px;
}

.side-menu ul {
  list-style: none;
}

.side-menu li {
  padding: 3px 12px;
  margin-bottom: 2px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  color: #33455c;
  cursor: pointer;
  transition:
    background-color 0.18s,
    color 0.18s;
}

.side-menu li .filter_item {
  all: unset;
  font-size: 15px;
  font-weight: 500;
  color: #33455c;
  cursor: pointer;
  line-height: 1.2;
  width: 100%;
}

.side-menu li:hover {
  background-color: #1e3a5f;
  .filter_item {
    color: #ffffff;
  }
}
.side-menu .selected {
  background-color: #1e3a5f;
  .filter_item {
    color: #ffffff;
  }
}
.reset-filter-part {
  all: unset;
  width: 100%;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #c3a035;
  border-radius: 6px;
  cursor: pointer;

  .filter_item {
    all: unset;
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    line-height: 1.2;
    width: 100%;
  }
}

.filter_items {
  width: 100%;

  span {
    font-size: 12px;
  }
}

.menu-part {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: flex-start;
  .items {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: flex-start;
    max-height: 250px;
    overflow-y: scroll;
  }
}

/* ---------- Центральная область — плитка ---------- */
.content {
  flex: 1;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  min-height: 400px;
  @media (max-width: 1000px) {
    grid-template-columns: repeat(2, 1fr);
  }
  @media (max-width: 750px) {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* ---------- Карточка масла ---------- */
.card {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 18px 18px 20px;
  box-shadow: 0 2px 6px rgba(30, 58, 95, 0.08);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(30, 58, 95, 0.16);
}

/* Картинка */
.card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f5f7fa;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Бейдж вязкости */
.card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: #1e3a5f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 1;
}

/* Бренд */
.card-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #5a6b80;
}

/* Название (линейка) */
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: #14283f;
  line-height: 1.3;
}

/* Мета: состав + объём */
.card-type {
  font-size: 13px;
  color: #5a6b80;
}

/* Допуски */
.card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.card-specs span {
  font-size: 11px;
  font-weight: 600;
  color: #1e3a5f;
  background: #eaf0f7;
  border-radius: 4px;
  padding: 3px 7px;
}

/* Цена */
.card-price {
  margin-top: auto;
  font-size: 19px;
  font-weight: 700;
  color: #1e3a5f;
  padding-top: 12px;
  border-top: 1px solid #e4e9f0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-price .unit {
  font-size: 13px;
  font-weight: 500;
  color: #5a6b80;
}

/* Кнопка */
.card-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  background: #1e3a5f;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  transition: background-color 0.18s;
}

.card-btn:hover {
  background: #2b5182;
}

/* Маркировка рекламы */
.card-ads {
  font-size: 10px;
  line-height: 1.35;
  color: #97a3b4;
  margin-top: 4px;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: contents; /* карточка остаётся grid/flex-контейнером */
}
/* Paging */
.paging_container {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: fit-content;
  margin: 10px;
}

.paging {
  width: 300px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.paging_item {
  all: unset;
  width: 35px;
  height: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  border: 1px solid #1e3a5f;
  border-radius: 4px;
  cursor: pointer;
}
.paging_item:disabled {
  cursor: not-allowed;
  color: rgb(200, 200, 200);
  border: 1px solid rgb(200, 200, 200);
}

/* ---------- Модальное окно ---------- */

dialog:modal {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.dialog-content {
  width: 100%;
  background-color: #ffffff;
  border-radius: 10px;
  padding: 18px 14px;
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  align-self: flex-start;
  position: relative;
}
.dialog-content h2 {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #1e3a5f;
  padding-bottom: 8px;
}

.dialog-content ul {
  list-style: none;
}

.dialog-content li {
  padding: 3px 12px;
  margin-bottom: 2px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  color: #33455c;
  cursor: pointer;
  transition:
    background-color 0.18s,
    color 0.18s;
}

.dialog-content li .filter_item {
  all: unset;
  font-size: 15px;
  font-weight: 500;
  color: #33455c;
  cursor: pointer;
  line-height: 1.2;
  width: 100%;
}

.dialog-content li:hover {
  background-color: #1e3a5f;
  .filter_item {
    color: #ffffff;
  }
}
.dialog-content .selected {
  background-color: #1e3a5f;
  .filter_item {
    color: #ffffff;
  }
}
.close-modal-btn {
  all: unset;
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #1e3a5f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-menu-header {
  width: fit-content;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 20px;
}
