/**
 * Mobile First - Быстрые победы
 * Phase 1: Base font, touch targets, viewport optimization
 */

/* 1. Базовый шрифт 16px */
html {
  font-size: 16px;
}

body {
  font-size: 0.85rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 2. Touch targets минимум 48px (только мобильные) */
@media (max-width: 768px) {
  button, 
  .btn,
  .nav-link,
  .pagination > li > a,
  .pagination > li > span {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* 3. Улучшение читаемости */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1rem;
}

/* 4. Мобильная типографика */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.125rem; }
  
  body {
    font-size: 1rem;
  }
}

/* 5. Улучшение навигации */
.navbar-nav > li > a {
  padding: 12px 16px;
}

.dropdown-menu > li > a {
  padding: 12px 20px;
}

/* 6. Формы */
.form-control {
  min-height: 48px;
  font-size: 1rem;
}

/* 7. Чекбоксы и радио */
input[type="checkbox"],
input[type="radio"] {
  min-width: 20px;
  min-height: 20px;
}

/* 8. Улучшение ссылок */
a {
  touch-action: manipulation;
}

/* 8a. Кнопки формы заявки на мобильных */
@media (max-width: 768px) {
  #price-request-form .buttons .btn {
    width: 100%;
    margin-bottom: 10px;
    min-height: 48px;
    font-size: 14px;
    padding: 12px 16px;
    text-align: center;
    white-space: normal;
    word-break: break-word;
  }
  #price-request-form .buttons .btn:last-child {
    margin-bottom: 0;
  }
  #price-request-form .buttons .row > div {
    margin-bottom: 10px;
  }
  #price-request-form .buttons .row > div:last-child {
    margin-bottom: 0;
  }
}

/* 8b. Компактные поля ввода запчастей */
#price-request-form .panel-body .compact-item {
  margin-bottom: 2px !important;
  position: relative;
}
#price-request-form .panel-body .compact-item .input-group {
  display: flex !important;
  width: 100%;
  position: relative;
}
#price-request-form .panel-body .compact-item .form-control {
  padding: 1px 10px !important;
  font-size: 14px !important;
  flex: 1 1 auto !important;
  width: auto !important;
  position: relative;
  z-index: 1;
}
#price-request-form .panel-body .compact-item .input-group-btn {
  position: relative !important;
  display: flex !important;
  width: auto !important;
  white-space: nowrap;
  vertical-align: middle;
}
#price-request-form .panel-body .compact-item .input-group-btn .btn {
  min-height: 36px !important;
  height: 36px !important;
  padding: 1px 12px !important;
  margin-left: -1px !important;
  position: relative !important;
  z-index: 2;
  border-radius: 0 4px 4px 0 !important;
  font-size: 12px;
  line-height: 1;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* Скрыть кнопку удаления когда поле одно */
#price-request-form .panel-body .compact-item:first-child:last-child .input-group-btn .btn.remove-part {
  display: none !important;
}

/* 9. Отступы для мобильных */
@media (max-width: 768px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .product-layout {
    margin-bottom: 16px;
  }
  
  /* Исправление для страницы новостей */
  .showcase-list .product-layout {
    width: 100% !important;
    min-height: auto !important;
    float: none;
    padding: 0;
  }
}

/* 10. Пагинация — и на десктопе и на мобильных */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pagination > li {
  display: inline-flex;
  margin: 0;
}

.pagination > li > a,
.pagination > li > span {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #495057;
  text-decoration: none;
}

.pagination > li.active > a,
.pagination > li.active > span {
  background: #FFC107;
  border-color: #FFC107;
  color: #212529;
  font-weight: 600;
}

.pagination > li > a:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
}

/* На мобильных — ещё меньше */
@media (max-width: 576px) {
  .pagination > li > a,
  .pagination > li > span {
    min-width: 32px;
    min-height: 32px;
    padding: 4px 6px;
    font-size: 12px;
  }
}

/* Мобильные — длинная кнопка на всю строку */
.showcase-list .caption .btn-sm {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
}

/* На десктопе — кнопка слева, не на всю строку */
@media (min-width: 769px) {
  .showcase-list .product-thumb .button-group {
    justify-content: flex-start;
    padding: 8px 16px;
  }
  
  .showcase-list .product-thumb .button-group button {
    min-width: auto;
    padding: 6px 16px;
    font-size: 0.875rem;
  }
  
  .showcase-list .caption .btn-sm {
    display: inline-block;
    width: auto;
    min-width: auto;
    padding: 8px 20px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 10px;
    text-align: center;
    line-height: 1.5;
  }
}

/* Хлебные крошки в новостях */
.container .breadcrumb {
  background: none;
  padding: 6px 0;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.875rem;
}

.container .breadcrumb li {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.container .breadcrumb li + li:before {
  content: none;
  padding: 0 8px;
  color: #adb5bd;
}

.container .breadcrumb a {
  color: #6c757d;
  text-decoration: none;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.container .breadcrumb a:hover {
  color: #FFC107;
}

.container .breadcrumb li:last-child {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

@media (max-width: 576px) {
  .container .breadcrumb a {
    max-width: 100px;
    font-size: 0.8125rem;
  }
}

/* Отступы для заголовков секций */
.products-grid + h3,
.products-grid + a h3,
#content h3 {
  margin-top: 30px;
  margin-bottom: 20px;
  padding-top: 10px;
}

/* Отступы между секциями */
.products-grid {
  margin-bottom: 20px;
}

.products-grid + .row {
  margin-top: 32px;
}

/* Отступы между таблицами на странице товара */
#content .table-responsive {
  margin-bottom: 24px;
}

#content .table {
  margin-bottom: 0;
}


/* Отступ для всех блоков .col-sm-8 внутри #content (модули) */
#content > .col-sm-8 {
  margin-top: 10px;
}

#content > .col-sm-8 + .col-sm-8 {
  margin-top: 10px;
}

/* Поиск — классический способ */
#search {
  position: relative;
  border: 1px solid #FFC107;
  border-radius: 8px;
  overflow: hidden;
}

#search input[type="text"].form-control {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding-right: 50px !important;
  height: 48px;
}

.alloy-input-module_input__controls__2ff1q {
  position: absolute !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 48px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  padding: 0 !important;
}

.alloy-input-module_input__controls__2ff1q .btn.alloy-input-module_input__control__3soGY {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100% !important;
  width: 100% !important;
  min-height: auto !important;
  border: none !important;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

/* Убрать рамку у внешнего контейнера */
.alloy-input-module_alloy-form-group__18Zej {
  border: none !important;
}

/* 11. Предотвращение случайных нажатий */
button,
.btn {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
/* MOD: Desktop/Mobile visibility */
.desktop-only {
  display: block;
}
.mobile-product-card {
  display: none;
}
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-product-card {
    display: block !important;
  }
}
@media (min-width: 769px) {
  .mobile-product-card {
    display: none !important;
  }
}

/* MOD: Убрать лишние рамки у мобильной карточки */
@media (max-width: 768px) {
  .mobile-product-card,
  .mobile-product-card * {
    border: none !important;
  }
  .mobile-product-card > div:first-child {
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
  }
}

/* MOD: Скрыть desktop-only на мобильной с высокой специфичностью */
@media (max-width: 768px) {
  div.desktop-only,
  p.desktop-only,
  h1.desktop-only,
  h2.desktop-only,
  ul.desktop-only,
  .rating.desktop-only {
    display: none !important;
  }
}

/* MOD: Максимальная специфичность для скрытия desktop-only */
@media (max-width: 768px) {
  html body .desktop-only,
  html body div.desktop-only,
  html body .rating.desktop-only {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* MOD: Скрыть ВСЕ блоки отзывов кроме мобильной карточки */
@media (max-width: 768px) {
  #product .rating:not(.mobile-product-card .rating) {
    display: none !important;
  }
}

/* MOD: Уменьшить высоту карточек featured_product на мобильной версии */
@media (max-width: 768px) {
  .product-thumb {
    min-height: auto !important;
    padding: 8px !important;
  }
  .product-thumb .caption h4 {
    font-size: 15px !important;
    margin-bottom: 5px !important;
  }
  .product-thumb .caption p {
    font-size: 14px !important;
    margin-bottom: 0 !important;
  }
}

/* MOD: Отзывы в мобильной карточке в одну строку */
@media (max-width: 768px) {
  .mobile-product-card p[style*="white-space: nowrap"] {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }
  .mobile-product-card p[style*="white-space: nowrap"] .fa-stack {
    display: inline-block !important;
    width: 0.9em !important;
    height: 0.9em !important;
    line-height: 0.9em !important;
  }
  .mobile-product-card p[style*="white-space: nowrap"] a {
    display: inline !important;
    white-space: nowrap !important;
  }
}


/* MOD: Стилизация страницы корзины */
#checkout-cart .btn_cart {
  border-radius: 8px !important;
  padding: 10px 15px !important;
  font-size: 14px !important;
  border: none !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
}
#checkout-cart .btn_cart.btn-primary {
  background-color: #337ab7 !important;
  color: #fff !important;
}
#checkout-cart .btn_cart.btn-primary:hover {
  background-color: #286090 !important;
}
#checkout-cart .btn_cart.btn-danger {
  background-color: #d9534f !important;
  color: #fff !important;
}
#checkout-cart .btn_cart.btn-danger:hover {
  background-color: #c9302c !important;
}

/* Кнопки Продолжить покупки и Оформление заказа */
#checkout-cart .pull-left .btn,
#checkout-cart .pull-right .btn {
  border-radius: 8px !important;
  padding: 12px 24px !important;
  font-size: 14px !important;
  text-transform: uppercase !important;
  border: none !important;
  background-color: #337ab7 !important;
  color: #fff !important;
  transition: all 0.3s ease !important;
}
#checkout-cart .pull-left .btn:hover,
#checkout-cart .pull-right .btn:hover {
  background-color: #286090 !important;
}

/* Таблица корзины */
#checkout-cart .table.table-bordered {
  border: 1px solid #ddd !important;
}
#checkout-cart .table.table-bordered td,
#checkout-cart .table.table-bordered th {
  border: 1px solid #ddd !important;
}
#checkout-cart .table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}
#checkout-cart .table thead th {
  background-color: #f5f5f5 !important;
  font-weight: 600 !important;
  padding: 12px !important;
  border-bottom: 2px solid #ddd !important;
}
#checkout-cart .table tbody td {
  padding: 12px !important;
  vertical-align: middle !important;
}
#checkout-cart .table tbody tr:hover {
  background-color: #f9f9f9 !important;
}

/* Мобильная версия корзины */
@media (max-width: 768px) {
  #checkout-cart .table-responsive {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  #checkout-cart .table.table-bordered {
    border: none !important;
    background: transparent !important;
  }
  #checkout-cart .table thead {
    display: none !important;
  }
  #checkout-cart .table tbody tr {
    display: block !important;
    margin-bottom: 15px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    padding: 10px !important;
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  }
  #checkout-cart .table tbody td {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    padding: 8px 0 !important;
    border: none !important;
    border-bottom: 1px solid #eee !important;
  }
  #checkout-cart .table tbody td:last-child {
    border-bottom: none !important;
  }
  #checkout-cart .table tbody td:before {
    display: none !important;
  }
  #checkout-cart .input-group {
    max-width: 100% !important;
  }
  #checkout-cart .pull-left,
  #checkout-cart .pull-right {
    float: none !important;
    width: 100% !important;
    margin-bottom: 10px !important;
  }
  #checkout-cart .pull-left .btn,
  #checkout-cart .pull-right .btn {
    width: 100% !important;
    display: block !important;
  }
}

/* MOD: Кнопки корзины желтые */
#checkout-cart .pull-left .btn,
#checkout-cart .pull-right .btn,
#checkout-cart .btn_cart.btn-primary {
  background-color: #f0ad4e !important;
  color: #000 !important;
  border: none !important;
}
#checkout-cart .pull-left .btn:hover,
#checkout-cart .pull-right .btn:hover,
#checkout-cart .btn_cart.btn-primary:hover {
  background-color: #ec971f !important;
}

/* Мобилка: боковые отступы, кнопка поменьше */
@media (max-width: 768px) {
  .article-item {
    padding-left: 15px;
    padding-right: 15px;
  }
  .article-item .product-thumb {
    padding: 15px;
  }
  .news-btn-wrap .btn {
    min-height: 32px !important;
    min-width: auto !important;
    padding: 4px 12px !important;
    font-size: 12px !important;
  }
}

/* === Blog / News fixes === */

/* Десктоп: текст в кнопке по центру по высоте */
.news-btn-wrap .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Мобилка */
@media (max-width: 768px) {
  .news-btn-wrap .btn {
    min-height: 32px !important;
    min-width: auto !important;
    padding: 4px 14px !important;
    font-size: 12px !important;
  }
}

/* === Больше текста в карточках новостей на мобильной === */
@media (max-width: 768px) {
  .product-thumb .caption p {
    -webkit-line-clamp: 8;
    font-size: 14px;
    line-height: 1.6;
  }
}