/**
 * custom-compare.css
 * Matches site design language from custom-specs.css
 */

/* Add to Compare Button */
.cb-add-to-compare {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--cb-gradient-primary-btn);
    color: var(--cb-text-inverse);
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: var(--cb-font-weight-bold);
    cursor: pointer;
    transition: var(--cb-transition-smooth);
    text-decoration: none;
    margin-right: 15px;
    box-shadow: var(--cb-shadow-glow-primary);
    font-family: var(--cb-font-main);
}

.cb-add-to-compare:hover {
    transform: translateY(-2px);
    box-shadow: var(--cb-shadow-xl);
    filter: brightness(1.1);
}

.cb-add-to-compare.added {
    background: var(--cb-status-success-icon);
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
}

.cb-add-to-compare.added:hover {
    background: var(--cb-status-success-text);
    box-shadow: 0 10px 25px rgba(22, 163, 74, 0.4);
}


/* Floating Compare Bar */
#cb-compare-bar {
    position: fixed;
    bottom: -100px;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    padding: 15px 0;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-top: 3px solid var(--cb-color-primary);
}

#cb-compare-bar.active {
    bottom: 0;
}

.cb-bar-inner {
    max-width: var(--cb-container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.cb-bar-items {
    display: flex;
    gap: 20px;
}

.cb-bar-item {
    display: flex;
    align-items: center;
    background: var(--cb-bg-body);
    padding: 5px 10px;
    border-radius: 8px;
    position: relative;
    border: 1px solid var(--cb-border-light);
    min-width: 180px;
}

.cb-bar-img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 10px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-bar-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cb-bar-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cb-bar-item .remove-item {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.cb-bar-item:hover .remove-item {
    opacity: 1;
}

.cb-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cb-btn-compare {
    background: var(--cb-gradient-primary-btn);
    color: var(--cb-text-inverse);
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: var(--cb-font-weight-bold);
    text-decoration: none;
    transition: var(--cb-transition-smooth);
    box-shadow: var(--cb-shadow-glow-primary);
}

.cb-btn-compare:hover {
    transform: translateY(-2px);
    box-shadow: var(--cb-shadow-xl);
    color: var(--cb-text-inverse);
    filter: brightness(1.1);
}

.cb-btn-clear {
    background: transparent;
    border: none;
    color: #64748b;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.cb-btn-clear:hover {
    color: #1e293b;
}


/* Compare Page Styles - Matching Site Theme */
.cb-compare-page-container {
    max-width: 1280px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: var(--bp-font, 'Outfit', sans-serif);
    color: #1e293b;
}

.cb-compare-header-row {
    margin-bottom: 30px;
    text-align: center;
}

.cb-compare-header-row h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #1e293b;
}

.cb-compare-header-row p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
}

.cb-compare-table-wrapper {
    overflow-x: auto;
    border-radius: 20px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    background: #fff;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.cb-compare-table-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 20px 20px 0 0;
    opacity: 0.8;
}

table.cb-compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
    margin-top: 6px;
}

table.cb-compare-table th,
table.cb-compare-table td {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    border-right: none;
    /* Clean layout */
    border-left: none;
    vertical-align: top;
    transition: background-color 0.2s ease;
}

/* Product Header Column - Keep everything together */
table.cb-compare-table thead th:not(.label-col) {
    padding: 0;
    position: relative;
    vertical-align: top;
}

/* First Column Sticky */
table.cb-compare-table th.label-col,
table.cb-compare-table td.label-col {
    position: sticky;
    left: 0;
    background: #f8fafc;
    z-index: 10;
    width: 220px;
    min-width: 180px;
    font-weight: 600;
    color: #64748b;
    border-right: none;
    /* Removed hard border */
    box-shadow: 4px 0 24px -4px rgba(0, 0, 0, 0.06);
    /* Soft premium shadow */
    letter-spacing: 0.01em;
}

table.cb-compare-table tr:nth-child(even) td.label-col {
    background: #f8fafc;
}

table.cb-compare-table tr:hover td {
    background-color: #f1f5f9;
}

table.cb-compare-table tr:hover td.label-col {
    background-color: #f1f5f9;
}

/* Product Header Cells - Fixed Layout */
.cb-prod-header {
    text-align: center;
    text-align: center;
    position: relative;
    padding: 40px 20px 20px;
    /* More top padding for button space */
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.cb-prod-thumb {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    /* Removed border and shadow for cleaner look */
    border-radius: 16px;
    padding: 10px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.cb-prod-thumb:hover {
    transform: scale(1.02);
}

.cb-prod-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cb-prod-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #1e293b;
    display: block;
    text-decoration: none;
    transition: color 0.2s;
}

.cb-prod-title:hover {
    color: #6366f1;
}

.cb-prod-price {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #6366f1;
    margin-bottom: 15px;
    letter-spacing: -0.03em;
}

.cb-prod-buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--cb-gradient-primary-btn);
    color: var(--cb-text-inverse);
    border-radius: 50px;
    font-weight: var(--cb-font-weight-bold);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--cb-transition-smooth);
    box-shadow: var(--cb-shadow-glow-primary);
}

.cb-prod-buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--cb-shadow-xl);
    color: var(--cb-text-inverse);
    filter: brightness(1.1);
}

.cb-remove-col {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f8fafc;
    /* Very subtle grey background */
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: #94a3b8;
    /* Slate 400 */
    /* Lighter grey for subtle look */
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: normal;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-remove-col:hover {
    color: #ef4444;
    /* Red */
    background: #fee2e2;
    /* Very light red bg */
    transform: none;
}


/* Section Headers */
tr.section-header th {
    background: #f8fafc;
    color: #1e293b;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 14px 24px;
    border-bottom: 1px solid #e2e8f0;
}

/* Alternating Row Colors */
table.cb-compare-table tbody tr:nth-child(even):not(.section-header) td {
    background-color: #fafbfc;
}

table.cb-compare-table tbody tr:nth-child(even):not(.section-header) td.label-col {
    background: #f8fafc;
}

/* Value Cells */
table.cb-compare-table td:not(.label-col) {
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
    min-width: 280px;
    /* Ensure columns don't get too narrow */
}

/* Also apply to header cells that aren't the label column */
table.cb-compare-table th:not(.label-col) {
    min-width: 280px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .cb-add-to-compare span {
        display: none;
    }

    .cb-add-to-compare {
        padding: 10px 16px;
    }

    /* Floating Bar Mobile - Better Layout */
    #cb-compare-bar {
        padding: 10px 0;
    }

    .cb-bar-inner {
        flex-direction: column;
        gap: 12px;
        padding: 0 15px;
    }

    .cb-bar-items {
        overflow-x: auto;
        padding-bottom: 5px;
        width: 100%;
        max-width: 100%;
        display: flex;
        gap: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .cb-bar-item {
        min-width: 140px;
        flex-shrink: 0;
        padding: 8px;
    }

    .cb-bar-img {
        width: 35px;
        height: 35px;
    }

    .cb-bar-title {
        font-size: 0.75rem;
    }

    .cb-bar-actions {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .cb-btn-compare {
        flex: 1;
        text-align: center;
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .cb-btn-clear {
        font-size: 0.85rem;
    }

    /* Comparison Page Mobile */
    .cb-compare-page-container {
        padding: 0 10px;
    }

    .cb-compare-header-row h1 {
        font-size: 1.8rem;
    }

    .cb-compare-header-row p {
        font-size: 0.9rem;
    }

    .cb-compare-table-wrapper {
        border-radius: 12px;
    }

    table.cb-compare-table {
        min-width: 600px;
    }

    .cb-prod-header {
        padding: 15px 10px;
        min-height: 300px;
    }

    .cb-prod-thumb {
        width: 100px;
        height: 100px;
        margin-bottom: 15px;
        padding: 10px;
    }

    .cb-prod-title {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .cb-prod-price {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .cb-prod-buy-btn {
        padding: 8px 18px;
        font-size: 0.85rem;
    }

    .cb-remove-col {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: 6px;
        right: 6px;
    }

    table.cb-compare-table th.label-col,
    table.cb-compare-table td.label-col {
        width: 140px;
        min-width: 120px;
        font-size: 0.8rem;
        padding: 12px 16px;
    }

    table.cb-compare-table th:not(.label-col),
    table.cb-compare-table td:not(.label-col) {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    tr.section-header th {
        font-size: 0.7rem;
        padding: 10px 16px;
    }
}

@media (max-width: 600px) {
    .cb-compare-header-row h1 {
        font-size: 1.6rem;
    }

    .cb-compare-header-row p {
        font-size: 0.9rem;
        padding: 0 10px;
    }

    .cb-compare-table-wrapper {
        border-radius: 12px;
        box-shadow: none;
        /* Simplify on mobile */
        border: 1px solid #e2e8f0;
    }

    table.cb-compare-table {
        min-width: unset;
        width: 100%;
        /* Fill space if content is small */
        /* Cells with min-width will force scrolling if content is large */
        border-right: none;
    }

    .cb-prod-header {
        padding: 20px 10px 15px;
        min-height: auto;
        /* Reduce fixed height dependence */
    }

    .cb-prod-thumb {
        width: 90px;
        height: 90px;
        margin-bottom: 10px;
        padding: 5px;
    }

    .cb-prod-title {
        font-size: 0.95rem;
        min-height: 40px;
        /* Align titles row */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .cb-prod-price {
        font-size: 1.15rem;
        margin-bottom: 10px;
    }

    .cb-prod-buy-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .cb-bar-item {
        min-width: 140px;
    }

    .cb-btn-compare {
        padding: 10px 14px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Ensure label column sticks properly on small mobile */
    table.cb-compare-table th.label-col,
    table.cb-compare-table td.label-col {
        width: 120px;
        min-width: 120px;
        padding: 12px 10px;
        /* Reduced vertical padding */
        font-size: 0.75rem;
        border-right: 1px solid #e2e8f0;
        /* Visual separator */
        box-shadow: 2px 0 10px -2px rgba(0, 0, 0, 0.05);
        /* Proper shadow */
    }

    /* Product columns optimizations */
    table.cb-compare-table th:not(.label-col),
    table.cb-compare-table td:not(.label-col) {
        min-width: 140px;
        /* Safe minimum */
        width: auto;
        /* Allow expansion */
        max-width: none;
        /* Remove limit */
        padding: 12px 10px;
        font-size: 0.8rem;
    }

    .cb-prod-header {
        padding: 15px 5px 10px;
        /* Compact padding */
        min-height: auto;
    }

    .cb-prod-thumb {
        width: 80px;
        /* Smaller image */
        height: 80px;
        margin-bottom: 8px;
        padding: 0;
        /* Remove padding around image */
        background: transparent;
    }

    .cb-prod-title {
        font-size: 0.85rem;
        line-height: 1.3;
        min-height: 36px;
        /* Reduced fixed height */
        margin-bottom: 6px;
    }

    .cb-prod-price {
        font-size: 1rem;
        margin-bottom: 8px;
        font-weight: 700;
    }

    .cb-prod-buy-btn {
        padding: 6px 14px;
        /* Compact button */
        font-size: 0.75rem;
    }

    .cb-remove-col {
        width: 24px;
        height: 24px;
        font-size: 14px;
        top: 0;
        /* Align top right corner */
        right: 0;
        background: rgba(255, 255, 255, 0.9);
    }
}

/* Empty State Styles */
.cb-empty-state {
    text-align: center;
    padding: 80px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.cb-empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.cb-empty-icon svg {
    width: 56px;
    height: 56px;
    fill: #6366f1;
}

.cb-empty-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 15px 0;
    font-family: var(--bp-font, 'Outfit', sans-serif);
}

.cb-empty-description {
    font-size: 1.1rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 35px 0;
}

.cb-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: var(--cb-gradient-primary-btn);
    color: var(--cb-text-inverse);
    border-radius: 50px;
    font-weight: var(--cb-font-weight-bold);
    text-decoration: none;
    font-size: 1rem;
    transition: var(--cb-transition-smooth);
    box-shadow: var(--cb-shadow-glow-primary);
}

.cb-empty-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    color: #fff;
    filter: brightness(1.1);
}

/* Toast Notification Styles */
.cb-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--bp-font, 'Outfit', sans-serif);
    min-width: 300px;
}

.cb-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.cb-toast i {
    font-size: 1.5rem;
}

.cb-toast span {
    font-weight: 600;
    font-size: 0.95rem;
}

.cb-toast-success {
    border-left: 4px solid #16a34a;
}

.cb-toast-success i {
    color: #16a34a;
}

.cb-toast-warning {
    border-left: 4px solid #f59e0b;
}

.cb-toast-warning i {
    color: #f59e0b;
}

.cb-toast-error {
    border-left: 4px solid #dc2626;
}

.cb-toast-error i {
    color: #dc2626;
}

.cb-toast-info {
    border-left: 4px solid #3b82f6;
}

.cb-toast-info i {
    color: #3b82f6;
}

/* Confirmation Dialog Styles */
.cb-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cb-confirm-overlay.show {
    opacity: 1;
}

.cb-confirm-dialog {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--bp-font, 'Outfit', sans-serif);
}

.cb-confirm-overlay.show .cb-confirm-dialog {
    transform: scale(1);
}

.cb-confirm-dialog h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 15px 0;
}

.cb-confirm-dialog p {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 30px 0;
}

.cb-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.cb-btn-cancel,
.cb-btn-confirm {
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.cb-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.cb-btn-cancel:hover {
    background: #e2e8f0;
    color: #475569;
}

.cb-btn-confirm {
    background: var(--cb-gradient-primary-btn);
    color: var(--cb-text-inverse);
    box-shadow: var(--cb-shadow-glow-primary);
}

.cb-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    filter: brightness(1.1);
}

@media (max-width: 480px) {
    .cb-toast {
        right: 10px;
        left: 10px;
        min-width: auto;
    }

    .cb-confirm-dialog {
        padding: 30px 20px;
    }

    .cb-confirm-dialog h3 {
        font-size: 1.3rem;
    }

    .cb-confirm-actions {
        flex-direction: column;
    }

    .cb-btn-cancel,
    .cb-btn-confirm {
        width: 100%;
    }
}