/* ==========================================================================
   Product Compare CSS - Manohar Ayurvedic Store
   ========================================================================== */

/* Fix header overlapping and z-index stacking context on compare page */
.header-part {
    z-index: 1000 !important;
}
.navbar-part {
    z-index: 999 !important;
}

/* 1. STICKY FLOATING DRAWER BAR */
.compare-sticky-bar-wrapper {
    position: fixed;
    bottom: -200px;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 2px solid rgba(40, 167, 69, 0.25);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08);
    z-index: 1050;
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 0;
    visibility: hidden;
    padding: 12px 0;
}

.compare-sticky-bar-wrapper.active {
    bottom: 20px;
    opacity: 1;
    visibility: visible;
    border-radius: 16px;
    max-width: 96%;
    left: 2%;
}

.compare-sticky-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.compare-bar-header h5 {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 2px 0;
}

.compare-bar-info-text {
    font-size: 11px;
    color: #28a745;
    font-weight: 600;
}

.compare-bar-items-list {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: thin;
}

.compare-bar-items-list::-webkit-scrollbar {
    height: 4px;
}

.compare-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    min-width: 180px;
    max-width: 220px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.compare-bar-img-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: visible;
    flex-shrink: 0;
    background: #f8f9fa;
    border: 1px solid #eee;
}

.compare-bar-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.compare-bar-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
    transition: all 0.2s ease;
}

.compare-bar-remove-btn:hover {
    transform: scale(1.15);
    background: #bd2130;
}

.compare-bar-info h6 {
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.compare-bar-price {
    font-size: 12px;
    font-weight: 700;
    color: #28a745;
}

.compare-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-clear-all-compare {
    background: none;
    border: none;
    color: #888;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-clear-all-compare:hover {
    color: #dc3545;
}

.btn-compare-now {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-weight: 700;
    font-size: 13px;
    border-radius: 10px;
    text-decoration: none !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
    transition: all 0.3s ease;
}

.btn-compare-now:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
    color: white;
}

/* Responsive adjustments for Drawer */
@media (max-width: 991px) {
    .compare-sticky-bar-wrapper.active {
        bottom: 68px; /* Lift above mobile nav menu */
        border-radius: 0;
        max-width: 100%;
        left: 0;
    }
}

@media (max-width: 767px) {
    .compare-sticky-bar-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .compare-bar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .compare-bar-actions {
        justify-content: space-between;
    }
    
    .btn-compare-now {
        flex-grow: 1;
        justify-content: center;
    }
}


/* 2. COMPARE MATRIX PAGE */
.compare-empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(40, 167, 69, 0.1);
}

.compare-empty-state .empty-icon {
    font-size: 64px;
    color: #28a745;
    margin-bottom: 20px;
    opacity: 0.8;
}

.compare-empty-state h3 {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.compare-empty-state p {
    color: #666;
    margin-bottom: 30px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.compare-top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Custom switch aesthetic */
.custom-switch .form-check-input {
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.custom-switch .form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.custom-switch .form-check-label {
    font-weight: 600;
    color: #2c3e50;
    padding-left: 10px;
    cursor: pointer;
    font-size: 15px;
}

.btn-clear-compare-list {
    background: none;
    border: 2px solid #dc3545;
    color: #dc3545;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-clear-compare-list:hover {
    background: #dc3545;
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

/* Table layout details */
.compare-table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.compare-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.compare-table th, .compare-table td {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

/* Sticky first column (Labels column) */
.compare-table .sticky-column {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 4; /* Keep it above table cells, but below header (z-index 1000) */
    border-right: 2px solid #e9ecef;
    min-width: 180px;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.03);
}

th.sticky-column {
    background: #f8f9fa !important;
    z-index: 5 !important; /* Slightly higher than td.sticky-column */
}

.spec-label-header {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
}

.spec-label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

/* Product header in table */
.product-column-header {
    min-width: 250px;
    background: #f8f9fa;
    position: relative;
    border-bottom: 2px solid #e9ecef;
}

.compare-product-header {
    padding: 15px 5px 5px 5px;
}

.btn-remove-compare {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #bbb;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-remove-compare:hover {
    color: #dc3545;
}

.compare-product-img {
    display: inline-block;
    width: 120px;
    height: 120px;
    margin-bottom: 12px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 10px;
    transition: transform 0.3s ease;
}

.compare-product-img:hover {
    transform: scale(1.05);
}

.compare-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.compare-product-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    min-height: 40px;
}

.compare-product-name a {
    color: #2c3e50;
    text-decoration: none !important;
}

.compare-product-name a:hover {
    color: #28a745;
}

.compare-product-rating {
    display: flex;
    justify-content: center;
    gap: 3px;
}

.compare-product-rating i {
    font-size: 14px;
    color: #ddd;
}

.compare-product-rating i.active {
    color: #ffc107;
}

/* Attribute Row elements */
.compare-product-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.compare-product-price del {
    font-size: 12px;
    color: #888;
}

.compare-product-price .price-discount {
    font-size: 18px;
    font-weight: 700;
    color: #28a745;
}

.compare-cat-val {
    font-weight: 600;
    color: #555;
}

/* Badges for stock */
.badge-success-custom {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-danger-custom {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Descriptions */
.compare-desc-wrap {
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}

.btn-toggle-desc-more {
    background: none;
    border: none;
    color: #28a745;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-toggle-desc-more:hover {
    text-decoration: underline;
}

/* Actions cell */
.compare-actions-cell {
    padding-top: 25px;
    padding-bottom: 25px;
}

/* 3. DIFFERENCE HIGHLIGHTING */
.compare-table.highlight-active tr.diff-row {
    background-color: rgba(255, 193, 7, 0.08) !important;
    transition: background-color 0.3s ease;
}

.compare-table.highlight-active tr.diff-row td.sticky-column {
    background-color: rgba(255, 248, 225, 1) !important;
    border-right: 2px solid #ffc107;
}

/* Media responsive table scroll shadow hint */
@media (max-width: 767px) {
    .compare-table th, .compare-table td {
        padding: 12px 14px;
    }
    .compare-product-img {
        width: 80px;
        height: 80px;
    }
}
