@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

/* Основные стили для страницы сравнения */
.personal-area.compare-page {
    display: flex;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.personal-area .tabs.left-menu {
    min-width: 250px;
}

.personal-area .tab-content {
    flex-grow: 1;
}

.content-top {
    margin-bottom: 20px;
}

/* Стили для пустой страницы сравнения */
.compare-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    margin: 20px 0;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.compare-empty-icon {
    font-size: 60px;
    color: #e0e0e0;
    margin-bottom: 20px;
}

.compare-empty h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.compare-empty p {
    color: #666;
    margin-bottom: 30px;
    font-size: 15px;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.compare-empty .btn-primary {
    background: #2196F3;
    color: white;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s ease;
    font-weight: 500;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.compare-empty .btn-primary:hover {
    background: #1E88E5;
}

/* Основной контейнер сравнения */
.compare-custom-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Заголовок сравнения */
.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #7594E1;
    flex-wrap: wrap;
    gap: 15px;
}

.compare-title {
    font-size: 24px;
    font-weight: bold;
    color: #4F6BB0;
    margin: 0;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.compare-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Переключатель отличий */
.differences-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

/* Переключатель группировки по категориям */
.categories-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #0066cc;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Счетчик товаров и кнопка очистки */
.products-count {
    background: #0066cc;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
}

.clear-compare-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.clear-compare-btn:hover {
    background: #cc0000;
}

/* Контейнер для табов категорий со стандартным скроллбаром */
.category-tabs-container {
    position: relative;
    margin-bottom: 20px;
}

.category-tabs-wrapper {
    position: relative;
}

.category-tabs-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 0;
    scroll-behavior: smooth;
    width: 100%;
}

/* СТАНДАРТНЫЙ СКРОЛЛБАР ДЛЯ ТАБОВ КАТЕГОРИЙ */
.category-tabs-scroll::-webkit-scrollbar {
    height: 8px;
}

.category-tabs-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.category-tabs-scroll::-webkit-scrollbar-thumb {
    background: #0066cc;
    border-radius: 4px;
}

.category-tabs-scroll::-webkit-scrollbar-thumb:hover {
    background: #0055aa;
}

/* Улучшенный скроллбар для Firefox */
.category-tabs-scroll {
    scrollbar-color: #0066cc #f1f1f1;
    scrollbar-width: thin;
}

.category-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    min-width: min-content;
}

.category-tab {
    background: #f8f9fa;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px;
    font-family: 'Ubuntu', Arial, sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tab:hover {
    background: #e9ecef;
    color: #333;
}

.category-tab.active {
    background: #007bff;
    color: white;
    border-bottom: 2px solid #007bff;
}

.tab-count {
    background: rgba(255,255,255,0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.category-tab.active .tab-count {
    background: rgba(255,255,255,0.5);
}

.category-content {
    display: none;
}

.category-content.active {
    display: block;
}

/* Контейнер товаров */
.compare-products-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    padding: 0 60px;
    width: 100%;
}

.compare-products-scroll {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 0;
    scroll-behavior: smooth;
    width: 100%;
    max-width: 100vw;
}

.compare-products-scroll::-webkit-scrollbar {
    height: 8px;
}

.compare-products-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.compare-products-scroll::-webkit-scrollbar-thumb {
    background: #0066cc;
    border-radius: 4px;
}

.compare-products-scroll::-webkit-scrollbar-thumb:hover {
    background: #0055aa;
}

/* Улучшенный скроллбар для Firefox */
.compare-products-scroll {
    scrollbar-color: #0066cc #f1f1f1;
    scrollbar-width: thin;
}

/* Стрелки прокрутки */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #0066cc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 20px;
    font-weight: bold;
    color: #0066cc;
}

.scroll-arrow:hover {
    background: #0066cc;
    color: white;
}

.scroll-arrow-left {
    left: 0;
}

.scroll-arrow-right {
    right: 0;
}

/* Карточка товара */
.compare-product-item {
    flex: 0 0 300px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    height: auto;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease-in-out;
}

.compare-product-item:hover {
    border-color: #0066cc;
    box-shadow: 0 4px 15px rgba(0,102,204,0.2);
    transform: translateY(-2px);
}

/* Кнопка удаления из сравнения */
.remove-from-compare {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.remove-from-compare:hover {
    background: #5a6268;
    transform: scale(1.1);
}

/* Изображения товара */
.product-image {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff;
    border-radius: 6px;
    margin-bottom: 15px;
}

.product-image img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.product-image img:hover {
    transform: scale(1.05);
}

.product-image div {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #f5f5f5;
    color: #999;
    border-radius: 4px;
}

/* Информация о товаре */
.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-info h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    text-align: center;
    height: 40px;
    overflow: hidden;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #4F6BB0;
    font-weight: bold;
}

.product-info h3 a {
    color: #4F6BB0;
    text-decoration: none;
}

.product-info h3 a:hover {
    text-decoration: underline;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #7594E1;
    margin-bottom: 15px;
    text-align: center;
}

/* Кнопка добавления в корзину */
.add-to-cart-btn {
    width: 100%;
    background: #4470C6;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    position: relative;
    font-family: 'Ubuntu', Arial, sans-serif !important;
    margin-bottom: 15px;
}

.add-to-cart-btn:hover {
    background: #3a5da8;
    transform: translateY(-2px);
}

.add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.add-to-cart-btn.in-cart {
    background: #4CAF50;
}

.add-to-cart-btn.in-cart:hover {
    background: #43A047;
}

/* Характеристики товара */
.product-characteristics {
    margin-top: 15px;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.characteristic-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    min-height: 40px;
}

.characteristic-name {
    font-size: 12px;
    color: #666;
    font-weight: bold;
    margin-bottom: 2px;
    line-height: 1.2;
    min-height: 13px;
    text-align: left;
}

.characteristic-value {
    font-size: 12px;
    color: #666;
    font-weight: 400;
    line-height: 1.3;
    min-height: 16px;
    word-wrap: break-word;
    text-align: left;
}

.characteristic-value.different {
    color: #ff4444 !important;
    font-weight: bold !important;
}

/* Уведомления */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    max-width: 300px;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.toast-notification-success {
    background: #28a745;
}

.toast-notification-error {
    background: #dc3545;
}

.toast-notification-info {
    background: #17a2b8;
}

.notification-message {
    font-size: 16px;
    line-height: 1.4;
}

/* Индикатор загрузки */
.compare-loading {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loading-categories {
    text-align: center;
    padding: 20px;
    color: #666;
    font-family: 'Ubuntu', Arial, sans-serif;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes checkmark {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Состояния загрузки */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Убираем outline при фокусе для всех элементов управления */
.compare-controls *:focus {
    outline: none !important;
    box-shadow: none !important;
}

.switch input:focus + .slider,
.clear-compare-btn:focus,
.products-count:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Адаптивность для мобильных */
@media (max-width: 1200px) {
    .compare-product-item {
        flex: 0 0 280px;
    }
}

@media (max-width: 768px) {
    .personal-area.compare-page {
        flex-direction: column;
    }
    
    .personal-area .tabs.left-menu {
        min-width: 100%;
        margin-bottom: 20px;
    }

    .compare-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .compare-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
    
    .differences-toggle,
    .categories-toggle {
        order: 1;
    }
    
    .products-count {
        order: 2;
        margin-top: 10px;
    }
    
    .clear-compare-btn {
        order: 3;
        margin-top: 10px;
    }

    .compare-products-container {
        padding: 0 20px;
    }

    .compare-product-item {
        flex: 0 0 260px;
    }

    .scroll-arrow {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .product-image {
        height: 180px;
    }

    .product-image img,
    .product-image div {
        height: 160px;
    }
    
    .scroll-arrow {
        display: none;
    }
    
    .compare-products-scroll {
        padding: 5px;
    }
    
    .toast-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    @keyframes slideIn {
        from { 
            transform: translateY(-100%); 
            opacity: 0; 
        }
        to { 
            transform: translateY(0); 
            opacity: 1; 
        }
    }
    
    @keyframes slideOut {
        from { 
            transform: translateY(0); 
            opacity: 1; 
        }
        to { 
            transform: translateY(-100%); 
            opacity: 0; 
        }
    }
}

@media (max-width: 480px) {
    .compare-custom-container {
        padding: 10px;
    }
    
    .compare-product-item {
        flex: 0 0 240px;
        padding: 15px;
    }
    
    .product-image img,
    .product-image div {
        height: 140px;
    }
    
    .compare-header h1 {
        display: none !important;
    }
    
    .characteristic-name {
        font-size: 11px;
    }

    .characteristic-value {
        font-size: 11px;
    }
}