/* ============================================================
   compare.css - Стили для системы сравнения экскурсий
   Версия: 1.0
   ============================================================ */

/* ============================================================
   1. ИКОНКА В ШАПКЕ
   ============================================================ */

#openCompareBtn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    color: #0f2c3d;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 8px;
    position: relative;
    user-select: none;
}

#openCompareBtn:hover {
    transform: scale(1.15);
    color: #1f6392;
    background: rgba(31, 99, 146, 0.1);
}

.compare-counter {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    animation: compareCounterPulse 1s ease-in-out infinite;
}

.compare-counter.visible {
    display: flex;
}

@keyframes compareCounterPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ============================================================
   2. МОДАЛЬНОЕ ОКНО СРАВНЕНИЯ
   ============================================================ */

#compareModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: compareFadeIn 0.25s ease;
}

#compareModal.active {
    display: flex;
}

@keyframes compareFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#compareModal .modal-content {
    max-width: 950px;
    width: 100%;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    animation: compareSlideUp 0.3s ease;
}

@keyframes compareSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Заголовок модалки */
#compareModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

#compareModal .modal-header h3 {
    margin: 0;
    color: #0f2c3d;
    font-size: 1.2rem;
}

#compareModal .modal-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Кнопки */
.btn-clear-compare {
    padding: 8px 20px;
    background: #fee2e2;
    color: #dc3545;
    border: 1px solid #fecaca;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-clear-compare:hover {
    background: #fecaca;
    border-color: #fca5a5;
}

.btn-close-compare {
    padding: 8px 20px;
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-close-compare:hover {
    background: #cbd5e1;
}

/* ============================================================
   3. ТАБЛИЦА СРАВНЕНИЯ
   ============================================================ */

.compare-table-wrapper {
    overflow-x: auto;
    margin: 0 -4px;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px;
}

/* Заголовки столбцов */
.compare-table thead th {
    padding: 12px 16px;
    text-align: center;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    vertical-align: top;
}

.compare-table thead th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f8fafc;
}

/* Ячейки */
.compare-table tbody td {
    padding: 10px 16px;
    text-align: center;
    color: #0f2c3d;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.compare-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: #475569;
    position: sticky;
    left: 0;
    z-index: 1;
    background: white;
}

.compare-table tbody tr:hover td {
    background: #f8fafc;
}

.compare-table tbody tr:hover td:first-child {
    background: #f8fafc;
}

/* Заголовок экскурсии в шапке */
.compare-excursion-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.compare-excursion-header .excursion-name {
    font-weight: 700;
    font-size: 0.9rem;
    word-break: break-word;
    line-height: 1.3;
}

.compare-excursion-header .excursion-type-badge {
    font-size: 0.6rem;
    background: #fef3c7;
    color: #d97706;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.compare-excursion-header .remove-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.compare-excursion-header .remove-btn:hover {
    color: #dc3545;
    background: #fee2e2;
}

/* Ссылка "Читать полностью" */
.compare-read-more {
    color: #1f6392;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.compare-read-more:hover {
    color: #0e4a6e;
}

/* Пустое состояние */
.compare-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.compare-empty .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.compare-empty .empty-title {
    font-size: 1.1rem;
    margin: 0;
}

.compare-empty .empty-sub {
    font-size: 0.9rem;
    margin: 8px 0 0;
    color: #cbd5e1;
}

.compare-empty .empty-hint {
    font-size: 0.8rem;
    margin: 4px 0 0;
    color: #cbd5e1;
}

/* Подвал модалки */
.compare-footer {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.compare-footer .info-text {
    color: #94a3b8;
    font-size: 0.85rem;
}

.compare-footer .info-text strong {
    color: #475569;
}

.compare-footer .hint-text {
    color: #94a3b8;
    font-size: 0.75rem;
}

/* ============================================================
   4. КНОПКА СРАВНЕНИЯ НА КАРТОЧКЕ
   ============================================================ */

.excursion-compare-btn {
    position: absolute;
    top: 56px;
    left: 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.excursion-compare-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.7);
}

.excursion-compare-btn.active {
    background: rgba(34, 197, 94, 0.7);
    color: #22c55e;
}

.excursion-compare-btn.active:hover {
    background: rgba(34, 197, 94, 0.85);
}

/* ============================================================
   5. МОДАЛЬНОЕ ОКНО ПОЛНОГО ОПИСАНИЯ
   ============================================================ */

#compareDescriptionModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: compareFadeIn 0.25s ease;
}

#compareDescriptionModal.active {
    display: flex;
}

#compareDescriptionModal .modal-content {
    max-width: 550px;
    width: 100%;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: compareSlideUp 0.3s ease;
}

#compareDescriptionModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#compareDescriptionModal .modal-header h3 {
    margin: 0;
    color: #0f2c3d;
    font-size: 1.1rem;
}

#compareDescriptionModal .modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    padding: 0 8px;
    transition: color 0.2s;
}

#compareDescriptionModal .modal-close-btn:hover {
    color: #1f6392;
}

#compareDescContent {
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    color: #1f3a5f;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
    padding-right: 8px;
}

#compareDescContent::-webkit-scrollbar {
    width: 6px;
}

#compareDescContent::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#compareDescContent::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#compareDescContent::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.compare-modal-footer {
    margin-top: 20px;
    text-align: right;
}

.compare-modal-footer .btn-close {
    padding: 8px 24px;
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.compare-modal-footer .btn-close:hover {
    background: #cbd5e1;
}

/* ============================================================
   6. АДАПТИВ
   ============================================================ */

@media (max-width: 768px) {
    #compareModal .modal-content {
        padding: 16px;
        margin: 10px;
        max-width: 100%;
    }
    
    .compare-table {
        font-size: 0.8rem;
        min-width: 400px;
    }
    
    .compare-table thead th,
    .compare-table tbody td {
        padding: 8px 10px;
    }
    
    .compare-table thead th:first-child,
    .compare-table tbody td:first-child {
        min-width: 80px;
    }
    
    #compareModal .modal-header h3 {
        font-size: 1rem;
    }
    
    .btn-clear-compare,
    .btn-close-compare {
        font-size: 0.75rem;
        padding: 6px 14px;
    }
    
    .compare-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    #compareModal .modal-content {
        padding: 12px;
        margin: 8px;
    }
    
    .compare-table {
        font-size: 0.7rem;
        min-width: 300px;
    }
    
    .compare-table thead th,
    .compare-table tbody td {
        padding: 6px 8px;
    }
    
    .compare-table thead th:first-child,
    .compare-table tbody td:first-child {
        min-width: 60px;
    }
    
    #compareModal .modal-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    #compareModal .modal-header-actions {
        justify-content: flex-end;
    }
    
    .compare-excursion-header .excursion-name {
        font-size: 0.75rem;
    }
    
    .excursion-compare-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
        top: 50px;
        left: 8px;
    }
    
    #compareDescriptionModal .modal-content {
        padding: 16px;
        margin: 10px;
    }
}

/* ============================================================
   7. ТОСТ-УВЕДОМЛЕНИЯ ДЛЯ СРАВНЕНИЯ
   ============================================================ */

.compare-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f2c3d;
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
}

.compare-toast.visible {
    opacity: 1;
}

/* ============================================================
   8. УТИЛИТЫ
   ============================================================ */

/* Скрытие элементов */
.compare-hidden {
    display: none !important;
}

/* Блокировка скролла при открытых модалках */
body.compare-modal-open {
    overflow: hidden;
}

/* Скрываем старую кнопку очистки */
#clearCompareBtn {
    display: none !important;
}