/* ==========================================================================
   BASE STYLES
   ========================================================================== */
:root {
  --primary-color: #007bff;
  --primary-dark: #0056b3;
  --text-color: #333;
  --text-light: #666;
  --bg-light: #f8f9fa;
  --border-color: #e9ecef;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: var(--text-color);
  line-height: 1.6;
  background-color: #fff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.section-title {
  font-size: 32px;
  font-weight: 600;
  margin: 60px 0 40px;
  text-align: center;
  color: var(--text-color);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 16px;
}

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

.btn--primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn--secondary {
  background: var(--bg-light);
  color: var(--text-color);
  border-color: #ddd;
}

.btn--secondary:hover {
  background: #e9ecef;
  border-color: #ccc;
}

.btn--fullwidth {
  width: 100%;
  box-sizing: border-box;
}


/* ==========================================================================
   HEADER
   ========================================================================== */
.header {
  background: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header__top-bar {
  background-color: var(--bg-light);
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border-color);
}

.top-bar__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar__left a, .top-bar__right a, .top-bar__right span {
  margin-right: 20px;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.3s ease;
}
.top-bar__left a:hover, .top-bar__right a:hover {
  color: var(--primary-color);
}

.header__main {
  position: relative;
  padding: 15px 0;
}

.header__main-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.logo img {
  max-width: 180px;
  height: auto;
  display: block;
}

.nav__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 45px;
}

.nav__item > a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  padding: 20px 0;
  display: inline-block;
  position: relative;
  text-transform: uppercase;
}

.nav__item > a::after {
  content: '';
  position: absolute;
  bottom: 15px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav__item > a:hover::after, .nav__item.active > a::after {
  transform: scaleX(1);
}

.header__contacts {
  display: flex;
  align-items: center;
  gap: 20px;
}

.phone {
  color: var(--text-color);
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
}

/* ==========================================================================
   MOBILE MENU TOGGLE
   ========================================================================== */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.mobile-menu-toggle:hover {
  color: var(--primary-color);
}

.mobile-menu-toggle .hamburger {
  display: flex;
  flex-direction: column;
  width: 25px;
  height: 20px;
  justify-content: space-between;
}

.mobile-menu-toggle .hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
    order: 2;
  }
  
  .nav {
    display: none;
  }
  
  .nav.active {
    display: block;
  }
}

@media (max-width: 480px) {
  .header__main-content {
    justify-content: space-between;
  }
  
  .header__contacts {
    order: 4;
    width: 100%;
    margin-top: 15px;
  }
}

/* MEGAMENU */
.nav__item--has-megamenu {
  position: static;
}

.megamenu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #ffffff;
  box-shadow: 0 15px 40px rgba(0,0,0,0.12);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  display: block !important;
  max-height: 0;
  overflow: hidden;
}

/* Ensure megamenu doesn't affect document flow when hidden */
.nav__item--has-megamenu:not(:hover) .megamenu:not(.megamenu--active) {
  position: absolute;
  top: -9999px;
  left: -9999px;
}

.megamenu--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  max-height: 500px;
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
}

.megamenu .container {
  padding-top: 25px;
  padding-bottom: 25px;
}

.megamenu__content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 35px;
  width: 100%;
}

.megamenu__column {
  padding-right: 35px;
  border-right: 1px solid var(--border-color);
}
.megamenu__column:last-child {
  border-right: none;
  padding-right: 0;
}

.megamenu__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
}

.megamenu__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.megamenu__list li { margin-bottom: 14px; }
.megamenu__list a {
  color: #333;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.2s ease, transform 0.2s ease;
  display: block;
}
.megamenu__list a:hover {
  color: var(--primary-color);
  transform: translateX(5px);
}

.megamenu__promo-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.3s ease;
  margin-bottom: 15px;
}
.megamenu__promo-item:hover { background-color: var(--bg-light); }
.megamenu__promo-item img { width: 48px; height: 48px; }
.promo-item__text { display: flex; flex-direction: column; }
.promo-item__title { font-size: 16px; font-weight: 600; color: var(--text-color); }
.promo-item__desc { font-size: 14px; color: var(--text-light); }


/* ==========================================================================
   HOME PAGE
   ========================================================================== */
.slider {
  position: relative;
  overflow: hidden;
  height: 500px;
}
.slider__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slider__content {
  position: absolute;
  bottom: 50px;
  left: 50px;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.9);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  color: #333;
  backdrop-filter: blur(5px);
}
.slider__title {
  font-size: 28px;
  margin: 0 0 15px 0;
  color: #222;
  font-weight: 600;
}

.categories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}
.category {
  background-color: #fff;
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
}
.category:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}
.category h3 { margin: 15px 0 10px; font-size: 20px; }
.category p { color: var(--text-light); margin: 0; }
.category__img { border-radius: 6px; width: 100%; }

.advantages__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}
.advantage { text-align: center; padding: 20px; }
.advantage__icon { margin-bottom: 15px; }
.advantage__icon img { height: 48px; width: 48px; }
.advantage__title { font-size: 20px; font-weight: 600; margin: 0 0 10px 0; }
.advantage__text { color: var(--text-light); font-size: 15px; }

.popular-products {
  padding: 60px 0;
  background-color: var(--bg-light);
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 30px;
}
.section-footer { text-align: center; margin-top: 40px; }

.brands {
  padding: 60px 0;
}
.brands-slider .swiper-slide {
  display: flex;
  justify-content: center;
  align-items: center;
  filter: grayscale(100%);
  opacity: 0.6;
  transition: all 0.3s ease;
}
.brands-slider .swiper-slide:hover {
  filter: grayscale(0%);
  opacity: 1;
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS
   ========================================================================== */

/* Ленивая загрузка изображений */
.product-image, .main-image, .thumbnail {
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.product-image.loading, .main-image.loading, .thumbnail.loading {
  opacity: 0.6;
  filter: blur(5px);
}

.product-image.loaded, .main-image.loaded, .thumbnail.loaded {
  opacity: 1;
  filter: none;
}

.product-image.error, .main-image.error, .thumbnail.error {
  opacity: 0.5;
  background: #f8f8f8;
  position: relative;
}

.product-image.error::after, .main-image.error::after, .thumbnail.error::after {
  content: '❌ Ошибка загрузки';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #999;
  text-align: center;
}

/* Оптимизация шрифтов */
@font-face {
  font-family: 'Roboto';
  font-display: swap;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'),
       url('/static/fonts/Roboto-VariableFont_wdth,wght.woff2') format('woff2');
}

/* Критический CSS для быстрого первого рендера */
.header {
  will-change: transform;
}

.product-card {
  will-change: transform;
  contain: layout style paint;
}

/* Оптимизация анимаций */
.btn, .product-card, .breadcrumb-item {
  transform: translateZ(0); /* Включает аппаратное ускорение */
}

/* Предотвращение layout shift */
.product-image, .main-image {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
  height: auto;
}

.thumbnail {
  aspect-ratio: 1/1;
  object-fit: cover;
}

/* Оптимизация для мобильных устройств */
@media (max-width: 768px) {
  .product-card {
    contain: layout style;
  }
  
  /* Уменьшение качества анимаций на мобильных */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ==========================================================================
   ADDITIONAL MOBILE BREAKPOINTS
   ========================================================================== */

/* Очень маленькие экраны (старые смартфоны) */
@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }
  
  .header__main {
    padding: 10px 0;
  }
  
  .logo img {
    max-width: 120px;
  }
  
  .phone {
    font-size: 16px;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  .section-title {
    font-size: 24px;
    margin: 30px 0 20px;
  }
  
  .product-title {
    font-size: 18px;
  }
  
  .price-main {
    font-size: 20px;
  }
  
  .modal__content {
    padding: 20px;
    margin: 10px;
  }
}

/* Средние планшеты */
@media (min-width: 769px) and (max-width: 1024px) {
  .catalog-layout {
    grid-template-columns: 250px 1fr;
    gap: 30px;
  }
  
  .catalog-sidebar {
    padding: 20px;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  
  .product-detail-layout {
    grid-template-columns: 400px 1fr;
    gap: 40px;
  }
}

/* Большие планшеты и маленькие ноутбуки */
@media (min-width: 1025px) and (max-width: 1199px) {
  .container {
    max-width: 1024px;
  }
  
  .catalog-layout {
    grid-template-columns: 280px 1fr;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */
.breadcrumbs {
  margin: 25px 0;
  padding: 15px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  border: 1px solid #e6e9ec;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  backdrop-filter: blur(5px);
}

.breadcrumb-item {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 6px 12px;
  border-radius: 6px;
  position: relative;
}

.breadcrumb-item:hover {
  background: rgba(0, 123, 255, 0.1);
  color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.breadcrumb-separator {
  margin: 0 10px;
  color: #6c757d;
  font-weight: 600;
  opacity: 0.7;
}

.breadcrumb-current {
  color: var(--text-color);
  font-weight: 600;
  background: rgba(0, 123, 255, 0.08);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 123, 255, 0.2);
}

/* ==========================================================================
   CATALOG & PRODUCT CARD IMPROVEMENTS
   ========================================================================== */
.catalog-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  margin-top: 40px;
}
.catalog-sidebar { 
  position: sticky; 
  top: 120px; 
  height: fit-content;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 25px;
}

/* Filter Sections */
.filter-section {
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-bottom: 30px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 25px;
}
.filter-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Improved Filters Container */
.filters-container {
  background: transparent;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
}

.filters-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filters-reset {
  background: none;
  border: 1px solid #ddd;
  color: var(--text-light);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filters-reset:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Filter Groups */
.filter-group {
  margin-bottom: 25px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 12px;
  font-size: 16px;
}

.filter-icon {
  font-size: 18px;
}

/* Improved Filter Options */
.filter-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border: 1px solid transparent;
}

.filter-checkbox:hover {
  background-color: var(--bg-light);
  border-color: #e0e0e0;
}

.filter-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  margin: 0;
}

.checkbox-label {
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.4;
}

/* Search Input Improvements */
.search-input-wrapper {
  position: relative;
}

.filter-input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  text-decoration: none;
  color: var(--text-color);
  border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:hover {
  background-color: var(--bg-light);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.filter-section {
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-bottom: 30px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 25px;
  border: 1px solid var(--border-color);
}
.filter-section__title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}
.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding: 15px 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}
.view-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.view-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.view-btn svg { display: block; fill: currentColor; }

.products-grid.view-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.product-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f0f0f0;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
  border-color: var(--primary-color);
}

.product-image-container {
  position: relative;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 260px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ff4757;
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  z-index: 2;
}

.featured-badge {
  background: #ff4757;
}

.product-brand-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--text-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

.product-info {
  padding: 20px;
}

.product-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  line-height: 1.4;
  color: var(--text-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-description {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  margin-bottom: 15px;
}

.price-main {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
}

.price-unit {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 400;
  margin-left: 4px;
}

.price-range, .price-from {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.price-request {
  font-size: 16px;
  color: var(--text-light);
  font-style: italic;
}

.product-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 20px;
}

.btn--small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}

.btn--outline {
  background: transparent;
  border: 1px solid #e0e0e0;
  color: var(--text-color);
}

.btn--outline:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.product-card.view-list-item {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 25px;
  align-items: center;
}
.product-card.view-list-item .product-card__image { height: 100%; }
.product-card.view-list-item .product-card__img { height: 100%; border-radius: 8px; }
.product-card.view-list-item .product-card__info { padding: 0; }
.product-card.view-list-item .product-description { display: block; color: var(--text-light); margin: 10px 0; }
.product-card.view-list-item .product-card__buy-actions { padding: 0 20px; }

/* ==========================================================================
   PRODUCT DETAIL PAGE IMPROVEMENTS
   ========================================================================== */
.product-detail-layout {
  display: grid;
  grid-template-columns: 500px 1fr;
  gap: 50px;
  margin-top: 30px;
  align-items: start;
}

/* Image Gallery Improvements */
.product-gallery {
  position: sticky;
  top: 120px;
}

.main-image-container {
  position: relative;
  margin-bottom: 15px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.main-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}

.fullscreen-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.fullscreen-btn:hover {
  background: rgba(255,255,255,1);
  transform: scale(1.05);
}

.thumbnail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
  max-width: 100%;
}

.thumbnail {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.thumbnail:hover {
  border-color: var(--primary-color);
  opacity: 0.8;
}

.thumbnail.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--primary-color);
}

/* Product Info Section */
.product-info {
  padding: 0;
}

.product-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 15px 0;
  line-height: 1.3;
  color: var(--text-color);
}

.product-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.brand-logo {
  height: 35px;
  width: auto;
  max-width: 120px;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
}

.product-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
}

.product-sku {
  font-size: 14px;
  color: var(--text-color);
}

.product-category {
  font-size: 14px;
  color: var(--text-light);
}

.product-category a {
  color: var(--primary-color);
  text-decoration: none;
}

.product-short-description {
  margin-bottom: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid var(--primary-color);
}

.product-short-description p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
}

.price-section {
  margin-bottom: 25px;
  padding: 20px;
  background: #fff;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
}

.price-main {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
}

.price-unit {
  font-size: 16px;
  color: var(--text-light);
  font-weight: 400;
  margin-left: 8px;
}

.product-attributes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}

.attribute-tag {
  background: var(--bg-light);
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e0e0e0;
}

/* CTA Section */
.cta-section {
  margin-bottom: 30px;
}

.cta-main {
  width: 100%;
  margin-bottom: 15px;
  padding: 15px 25px;
  font-size: 18px;
  font-weight: 600;
}

.cta-additional {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cta-icon {
  margin-right: 8px;
  font-size: 16px;
}

.trust-elements {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  padding: 20px;
  background: var(--bg-light);
  border-radius: 10px;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
  flex-direction: column;
}

.trust-item img {
  width: 32px;
  height: 32px;
}

.trust-item span {
  font-size: 12px;
  color: var(--text-color);
  font-weight: 500;
  line-height: 1.3;
}

/* Product Tabs Improvements */
.product-tabs {
  margin-top: 50px;
}

.tab-headers {
  display: flex;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 30px;
  gap: 5px;
}

.tab-header-btn {
  background: transparent;
  border: none;
  padding: 15px 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-light);
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
}

.tab-header-btn:hover {
  background: var(--bg-light);
  color: var(--text-color);
}

.tab-header-btn.active {
  background: #fff;
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

.tab-icon {
  font-size: 18px;
}

.tab-content {
  display: none;
  padding: 30px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tab-content.active {
  display: block;
}

.content-section h3 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 25px 0;
  color: var(--text-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 10px;
  display: inline-block;
}

/* Specifications Table */
.specs-table-container {
  margin-bottom: 30px;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.specs-table tr {
  border-bottom: 1px solid #f0f0f0;
}

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

.specs-table tr:nth-child(even) {
  background-color: #f8f9fa;
}

.spec-name {
  padding: 15px 20px;
  font-weight: 600;
  color: var(--text-color);
  background-color: rgba(0, 123, 255, 0.05);
  width: 40%;
  vertical-align: top;
}

.spec-value {
  padding: 15px 20px;
  color: var(--text-color);
  vertical-align: top;
}

/* General Specifications */
.general-specs {
  margin-top: 25px;
}

.general-specs h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 15px 0;
  color: var(--text-color);
}

/* Installation and Care */
.installation-info h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 25px 0 10px 0;
  color: var(--text-color);
}

.installation-info p {
  color: var(--text-color);
  line-height: 1.6;
  margin-bottom: 15px;
}

.care-list {
  list-style: none;
  padding: 0;
}

.care-list li {
  padding: 8px 0;
  color: var(--text-color);
  position: relative;
  padding-left: 25px;
}

.care-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

/* Benefits List */
.benefits-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.benefits-list li {
  padding: 12px 15px;
  background: var(--bg-light);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 14px;
  border-left: 4px solid var(--primary-color);
}

/* Applications Section */
.applications-section {
  margin-top: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid var(--primary-color);
}

.applications-section h4 {
  margin: 0 0 10px 0;
  color: var(--text-color);
}

/* Lightbox Styling */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2001;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2001;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-prev, .lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  font-size: 24px;
  padding: 15px 20px;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.lightbox-prev:hover, .lightbox-next:hover {
  background: rgba(255,255,255,0.3);
}

/* Modal Improvements */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal.show {
  display: flex;
}

.modal__content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal__close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.modal__close:hover {
  color: #333;
}

.tab-header-btn {
  background: transparent;
  border: none;
  padding: 15px 20px;
  font-size: 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tab-header-btn.active {
  border-bottom-color: var(--primary-color);
  color: var(--primary-color);
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.specs-grid table {
  width: 100%;
  border-collapse: collapse;
}
.specs-grid th, .specs-grid td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.specs-grid tr:last-child th, .specs-grid tr:last-child td { border-bottom: none; }
.specs-grid th { color: var(--text-light); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  background: #2c3e50;
  color: #fff;
  padding: 60px 0 30px;
  margin-top: 60px;
}
.footer__content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}
.footer__col h3 {
  color: #fff;
  font-size: 20px;
  margin-bottom: 20px;
  font-weight: 600;
}
.footer__col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer__col li {
  margin-bottom: 12px;
}
.footer__col a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}
.footer__col a:hover {
  color: #fff;
}
.footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 30px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   RELATED PRODUCTS IMPROVEMENTS
   ========================================================================== */
.related-products {
  margin-top: 60px;
  padding: 40px 30px;
  background: #f8f9fa;
  border-radius: 12px;
}

.related-products h3 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 30px 0;
  text-align: center;
  color: var(--text-color);
}

.related-products .products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}

.related-products .product-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.related-products .product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.related-products .product-link {
  text-decoration: none;
  display: block;
}

.related-products .product-card__img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
  display: block;
  aspect-ratio: 1/1;
}

.related-products .product-card__info {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.related-products .product-card__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-color);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-products .product-brand {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.related-products .product-card__price {
  margin-top: auto;
}

.related-products .price-main {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
}

.related-products .price-unit {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
  margin-top: 2px;
  display: block;
}

.related-products .price-request {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 500;
  font-style: italic;
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
.modal.show {
  display: flex;
}
.modal__content {
  background: #fff;
  padding: 35px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
  max-width: 450px;
  width: 90%;
  box-sizing: border-box;
}
.modal__close {
  position: absolute;
  top: 15px;
  right: 15px;
  border: none;
  background: none;
  font-size: 28px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  color: #aaa;
  transition: color 0.2s ease;
}
.modal__close:hover {
  color: #333;
}
.modal__content h2 {
  margin-top: 0;
  margin-bottom: 25px;
  text-align: center;
}
.modal .form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.modal .form input {
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  width: 100%;
  box-sizing: border-box;
}
.modal .form button {
  margin-top: 10px;
}

/* NEW MODAL STYLES */
.messenger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.messenger-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.messenger-item:hover {
  background-color: var(--bg-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.messenger-item img {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}

.messenger-item span {
  font-weight: 500;
}

/* ==========================================================================
   MODAL EMERGENCY FIXES - FINAL VERSION v2024123111
   ========================================================================== */

/* Force modal to display when triggered */
.modal[data-visible="true"] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 9999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
}

/* Emergency modal display override */
#order.modal {
  z-index: 99999;
}

#order.modal.show {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Force modal content to be visible */
#order .modal__content {
  background: white !important;
  padding: 30px !important;
  border-radius: 12px !important;
  max-width: 500px !important;
  width: 100% !important;
  position: relative !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  z-index: 100000 !important;
}

/* Ensure close button is visible */
#order .modal__close {
  position: absolute !important;
  top: 15px !important;
  right: 20px !important;
  background: none !important;
  border: none !important;
  font-size: 24px !important;
  cursor: pointer !important;
  z-index: 100001 !important;
  color: #666 !important;
}

#order .modal__close:hover {
  color: #000 !important;
}

/* Emergency CSS to force display */
.emergency-modal-force {
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  background: rgba(0, 0, 0, 0.8) !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ==========================================================================
   MOBILE ADAPTATION
   ========================================================================== */
@media (max-width: 768px) {
  /* Header Improvements */
  .header__top-bar {
    display: none; /* Hide top bar on mobile */
  }
  
  .header__main-content { 
    flex-wrap: wrap; 
    gap: 15px;
  }
  
  .logo img {
    max-width: 150px;
  }
  
  /* Mobile Navigation */
  .nav { 
    order: 3; 
    width: 100%; 
    text-align: center; 
  }
  
  .nav__list { 
    flex-direction: column; 
    gap: 0;
    background: var(--bg-light);
    border-radius: 8px;
    padding: 10px 0;
    margin-top: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }
  
  .nav__item > a { 
    width: 100%; 
    text-align: left; 
    padding: 15px 20px; 
    border-bottom: 1px solid #eee;
    font-size: 16px;
  }
  
  .nav__item:last-child > a {
    border-bottom: none;
  }
  
  .nav__item > a::after { 
    display: none; 
  }
  
  /* Mobile Contacts */
  .header__contacts { 
    flex-direction: row;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .phone {
    font-size: 16px;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 14px;
  }
  
  .nav__item--has-megamenu { position: static; }
  .megamenu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 10px 0 10px 20px;
    background-color: var(--bg-light);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    display: block; /* Override display:none for transition */
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }
  .nav__item--has-megamenu.active .megamenu {
    max-height: 1000px;
  }
  .megamenu__content { grid-template-columns: 1fr; gap: 20px; }
  .megamenu__column { border-right: none; padding-right: 0; }

  /* Mobile Catalog Layout */
  .catalog-layout { 
    grid-template-columns: 1fr; 
    gap: 20px;
  }
  .catalog-sidebar { 
    position: static; 
    margin-bottom: 20px;
    padding: 20px;
  }
  
  /* Mobile Product Cards */
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
  
  /* Mobile Product Detail */
  .product-detail-layout { 
    grid-template-columns: 1fr; 
    gap: 30px;
  }
  
  .product-gallery {
    position: static;
  }
  
  .main-image {
    height: 300px;
  }
  
  .thumbnail-gallery {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .product-title {
    font-size: 24px;
  }
  
  .price-main {
    font-size: 28px;
  }
  
  .cta-additional {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .trust-elements {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .trust-item {
    flex-direction: row;
    text-align: left;
  }
  
  /* Mobile Tabs */
  .tab-headers {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .tab-header-btn {
    flex: 1;
    min-width: calc(50% - 2.5px);
    padding: 12px 15px;
    font-size: 14px;
  }
  
  .tab-content {
    padding: 20px;
  }
  
  /* Mobile Filter Improvements */
  .filter-group {
    margin-bottom: 20px;
  }
  
  .filter-options {
    max-height: 150px;
    overflow-y: auto;
  }
}

/* NEW CATALOG STYLES */
.filter-categories {
  list-style: none;
  padding: 0;
  margin: 0;
}
.filter-categories li {
  margin-bottom: 5px;
}
.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s ease;
  border-radius: 6px;
}
.category-item:hover {
  background-color: var(--bg-light);
}
.has-children > .category-item::after {
  content: '›';
  font-size: 20px;
  transition: transform 0.3s ease;
}
.has-children.active > .category-item::after {
  transform: rotate(90deg);
}
.subcategories {
  list-style: none;
  padding-left: 20px;
  margin: 5px 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.has-children.active .subcategories {
  max-height: 500px; /* Or a large enough value */
}
.subcategories a {
  color: var(--text-light);
  text-decoration: none;
  padding: 5px 8px;
  display: block;
  border-radius: 4px;
}
.subcategories a:hover {
  background-color: var(--bg-light);
  color: var(--primary-color);
}

.price-slider {
  position: relative;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  margin: 30px 0;
}
.price-slider__track {
  position: absolute;
  height: 100%;
  background: var(--primary-color);
  border-radius: 2px;
  left: 10%; /* default */
  right: 30%; /* default */
}
.price-slider__input {
  position: absolute;
  width: 100%;
  height: 4px;
  top: -2px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.price-slider__input::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.price-slider__values {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  color: var(--text-light);
}

.checkbox-group {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 10px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}
.checkbox input {
  display: none;
}
.checkbox span {
  position: relative;
  padding-left: 28px;
}
.checkbox span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1px;
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.checkbox span::after {
  content: '✓';
  position: absolute;
  left: 4px;
  top: 0;
  font-size: 16px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.checkbox input:checked + span::before {
  background: var(--primary-color);
  border-color: var(--primary-color);
}
.checkbox input:checked + span::after {
  opacity: 1;
}

.custom-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background-color: #fff;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right .7em top 50%;
  background-size: .65em auto;
  padding-right: 2.5em;
}

/* ==========================================================================
   MODAL STYLES
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal__content {
  background: #fff;
  padding: 35px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
  max-width: 450px;
  width: 90%;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.modal.show .modal__content {
  transform: translateY(0);
}

.modal__close {
  position: absolute;
  top: 15px;
  right: 15px;
  border: none;
  background: none;
  font-size: 28px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  color: #aaa;
  transition: color 0.2s ease;
}

.modal__close:hover {
  color: #333;
}

.modal__content h2 {
  margin-top: 0;
  margin-bottom: 25px;
  text-align: center;
  color: var(--text-color);
}

.modal .form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal .form input {
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.modal .form input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.modal .form button {
  margin-top: 10px;
}

.messenger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.messenger-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.messenger-item:hover {
  background-color: var(--bg-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.messenger-item img {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}

.messenger-item span {
  font-weight: 500;
}