/**
 * ==========================================================================
 * COMPARE PAGE — Premium SaaS Design (2025)
 * ==========================================================================
 * 
 * Style: Stripe/Linear/Framer inspired
 * Features: Comparison table, subtle gradients, glass morphism (no blur),
 *           premium shadows, clean typography, smooth animations
 * 
 * Structure:
 * 1. Layout Container
 * 2. Header with Actions
 * 3. Empty State
 * 4. Comparison Table
 * 5. Product Cards (in table header)
 * 6. Loading State
 * 7. Responsive
 */

/* ==========================================================================
   1. LAYOUT CONTAINER
   ========================================================================== */
.cmp-page {
    min-height: calc(100vh - 200px);
    padding: 48px 0 80px;
    background: linear-gradient(180deg, 
        #fafbfc 0%, 
        #f8f9fb 50%, 
        #f5f7fa 100%
    );
    position: relative;
}

.cmp-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: radial-gradient(circle at 50% 0%, 
        rgba(212, 168, 83, 0.03) 0%, 
        transparent 70%
    );
    pointer-events: none;
}

.cmp-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   2. HEADER WITH ACTIONS
   ========================================================================== */
.cmp-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.cmp-header__content {
    flex: 1;
}

.cmp-header__title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.cmp-header__title {
    font-family: var(--font-display, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0;
    line-height: 1.1;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cmp-header__count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.15) 0%, 
        rgba(212, 168, 83, 0.08) 100%
    );
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 12px;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.cmp-header__subtitle {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
    letter-spacing: -0.01em;
}

.cmp-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cmp-header__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.cmp-header__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cmp-header__btn--primary {
    color: #0f172a;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.9) 0%, 
        rgba(212, 168, 83, 1) 100%
    );
    box-shadow: 
        0 2px 8px rgba(212, 168, 83, 0.25),
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.cmp-header__btn--primary:hover {
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 1) 0%, 
        rgba(232, 195, 109, 1) 100%
    );
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-1px);
}

.cmp-header__btn--secondary {
    color: #64748b;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.cmp-header__btn--secondary:hover,
.cmp-header__btn--secondary.is-active {
    color: #d4a853;
    background: rgba(255, 255, 255, 1);
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 
        0 2px 8px rgba(212, 168, 83, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.cmp-header__btn--outline {
    color: #64748b;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.cmp-header__btn--outline:hover {
    color: #dc2626;
    background: rgba(255, 255, 255, 1);
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: 
        0 2px 8px rgba(220, 38, 38, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* ==========================================================================
   3. EMPTY STATE
   ========================================================================== */
.cmp-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 60px 24px;
}

.cmp-empty__card {
    max-width: 520px;
    text-align: center;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 255, 255, 0.7) 100%
    );
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.cmp-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.08) 0%, 
        rgba(212, 168, 83, 0.04) 100%
    );
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 20px;
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.cmp-empty__icon svg {
    width: 40px;
    height: 40px;
    color: #d4a853;
    stroke-width: 1.5;
}

.cmp-empty__title {
    font-family: var(--font-display, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.cmp-empty__text {
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 32px 0;
}

.cmp-empty__features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
    text-align: left;
}

.cmp-empty__feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.cmp-empty__feature:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cmp-empty__feature svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #d4a853;
    margin-top: 2px;
}

.cmp-empty__feature span {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    line-height: 1.5;
}

.cmp-empty__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.9) 0%, 
        rgba(212, 168, 83, 1) 100%
    );
    border-radius: 12px;
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cmp-empty__btn svg {
    width: 18px;
    height: 18px;
}

.cmp-empty__btn:hover {
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 1) 0%, 
        rgba(232, 195, 109, 1) 100%
    );
    box-shadow: 
        0 6px 20px rgba(212, 168, 83, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-2px);
}

/* ==========================================================================
   4. COMPARISON TABLE
   ========================================================================== */
.cmp-table-wrapper {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.9) 100%
    );
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.cmp-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cmp-table {
    width: auto;
    min-width: min-content;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

/* При малом количестве товаров - центрируем таблицу и ограничиваем ширину карточек */
.cmp-table--few-items {
    margin: 0 auto;
}

.cmp-table__col-label {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
}

.cmp-table__col-product {
    width: 280px;
    min-width: 280px;
    max-width: 320px;
}

.cmp-table__corner {
    background: transparent;
    padding: 16px;
}

/* Table header with product cards */
.cmp-table thead th {
    vertical-align: top;
    padding: 0 8px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, 
        rgba(250, 251, 252, 0.98) 0%, 
        rgba(248, 249, 251, 0.95) 100%
    );
}

.cmp-table thead th:first-child {
    padding-left: 0;
}

/* Spec rows */
.cmp-table tbody tr {
    transition: background 0.15s ease;
}

.cmp-table tbody tr:hover {
    background: rgba(248, 250, 252, 0.6);
}

.cmp-table tbody tr.cmp-table__row--diff {
    background: rgba(212, 168, 83, 0.02);
}

.cmp-table tbody tr.cmp-table__row--diff:hover {
    background: rgba(212, 168, 83, 0.04);
}

.cmp-table__label {
    text-align: left;
    padding: 16px 16px 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    vertical-align: middle;
}

.cmp-table__value {
    text-align: center;
    padding: 16px 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    vertical-align: middle;
}

.cmp-table tbody tr:last-child .cmp-table__label,
.cmp-table tbody tr:last-child .cmp-table__value {
    border-bottom: none;
}

/* ==========================================================================
   5. PRODUCT CARDS (in table header)
   ========================================================================== */
.cmp-product-card {
    position: relative;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(248, 250, 252, 0.9) 100%
    );
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.2s ease;
}

.cmp-product-card:hover {
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 
        0 8px 24px rgba(212, 168, 83, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    transform: translateY(-2px);
}

.cmp-product-card__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.cmp-product-card__remove svg {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.cmp-product-card__remove:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

.cmp-product-card__remove:hover svg {
    color: #dc2626;
}

.cmp-product-card__image {
    display: block;
    aspect-ratio: 1 / 1;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.cmp-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cmp-product-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cmp-product-card__brand {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    margin: 0;
}

.cmp-product-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: #1f2937;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cmp-product-card__title a {
    color: inherit;
    text-decoration: none;
}

.cmp-product-card__title a:hover {
    color: #374151;
}

.cmp-product-card__price {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 4px 0 0;
}

.cmp-product-card__old-price {
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    text-decoration: line-through;
    margin: -4px 0 0;
}

/* Personal Discount Price in Compare */
.cmp-product-card__price-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 0;
}

.cmp-product-card__price-block .cc-price--rc {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12px;
    color: #9ca3af;
}

.cmp-product-card__price-block .cc-price--rc-value {
    /* Не зачёркиваем РЦ - просто показываем для сравнения */
}

.cmp-product-card__price-block .cc-price--personal {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.cmp-product-card__price-block .cc-price--personal-label {
    font-size: 10px;
    font-weight: 600;
    color: #059669;
}

.cmp-product-card__price-block .cc-price--personal-value {
    font-size: 20px;
    font-weight: 700;
    color: #059669;
}

.cmp-product-card__price-block .cc-price--current,
.cmp-product-card__price-block .cc-price {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.cmp-product-card__price-block .cc-price--old {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: line-through;
}

.cmp-product-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.9) 0%, 
        rgba(212, 168, 83, 1) 100%
    );
    border-radius: 10px;
    box-shadow: 
        0 2px 6px rgba(212, 168, 83, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.2s ease;
}

.cmp-product-card__btn:hover {
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 1) 0%, 
        rgba(232, 195, 109, 1) 100%
    );
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-1px);
}

.cmp-product-card__btn--quote {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fbbf24;
}

.cmp-product-card__btn--quote:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    border-color: #f59e0b;
}

/* ==========================================================================
   6. LOADING STATE
   ========================================================================== */
.cmp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 24px;
}

.cmp-loading__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(212, 168, 83, 0.2);
    border-top-color: #d4a853;
    border-radius: 50%;
    animation: cmpSpin 0.8s linear infinite;
}

@keyframes cmpSpin {
    to { transform: rotate(360deg); }
}

.cmp-loading__text {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

/* Error state */
.cmp-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 24px;
    text-align: center;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(248, 250, 252, 0.6) 100%
    );
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.08);
}

.cmp-error svg {
    width: 48px;
    height: 48px;
    color: #dc2626;
}

.cmp-error p {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
    max-width: 400px;
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .cmp-table__col-label {
        width: 200px;
        min-width: 200px;
    }
    
    .cmp-table__col-product {
        width: 240px;
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .cmp-page {
        padding: 32px 0 60px;
    }
    
    .cmp-container {
        padding: 0 16px;
    }
    
    .cmp-header {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 32px;
        padding-bottom: 24px;
    }
    
    .cmp-header__title {
        font-size: 28px;
    }
    
    .cmp-header__count {
        min-width: 28px;
        height: 28px;
        font-size: 13px;
    }
    
    .cmp-header__actions {
        width: 100%;
    }
    
    .cmp-header__btn {
        flex: 1;
        justify-content: center;
        min-width: calc(50% - 6px);
    }
    
    .cmp-empty {
        min-height: 400px;
        padding: 40px 16px;
    }
    
    .cmp-empty__card {
        padding: 36px 24px;
    }
    
    .cmp-empty__icon {
        width: 64px;
        height: 64px;
        margin-bottom: 20px;
    }
    
    .cmp-empty__icon svg {
        width: 32px;
        height: 32px;
    }
    
    .cmp-empty__title {
        font-size: 24px;
    }
    
    .cmp-empty__text {
        font-size: 15px;
    }
    
    .cmp-table-wrapper {
        padding: 16px;
        border-radius: 16px;
    }
    
    .cmp-table__col-label {
        width: 160px;
        min-width: 160px;
    }
    
    .cmp-table__col-product {
        width: 200px;
        min-width: 200px;
    }
    
    .cmp-table__label {
        font-size: 13px;
        padding: 12px 12px 12px 0;
    }
    
    .cmp-table__value {
        font-size: 13px;
        padding: 12px 8px;
    }
}

@media (max-width: 480px) {
    .cmp-header__title {
        font-size: 24px;
    }
    
    .cmp-header__subtitle {
        font-size: 14px;
    }
    
    .cmp-header__btn {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .cmp-header__btn svg {
        width: 16px;
        height: 16px;
    }
    
    .cmp-empty__card {
        padding: 32px 20px;
        border-radius: 20px;
    }
    
    .cmp-empty__title {
        font-size: 22px;
    }
    
    .cmp-empty__text {
        font-size: 14px;
    }
    
    .cmp-empty__feature {
        padding: 12px;
    }
    
    .cmp-empty__feature span {
        font-size: 13px;
    }
    
    .cmp-table__col-label {
        width: 140px;
        min-width: 140px;
    }
    
    .cmp-table__col-product {
        width: 180px;
        min-width: 180px;
    }
}

/* ==========================================================================
   8. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .cmp-header__btn,
    .cmp-empty__btn,
    .cmp-empty__feature,
    .cmp-product-card,
    .cmp-product-card__btn,
    .cmp-product-card__remove {
        transition: none;
        animation: none;
    }
    
    .cmp-loading__spinner {
        animation: none;
        border-top-color: transparent;
    }
    
    .cmp-product-card:hover,
    .cmp-product-card__btn:hover {
        transform: none;
    }
}
