/**
 * KB Product Compare - Frontend CSS
 */

/* ===========================================
   COMPARE BUTTON (Listing & Product Page)
   =========================================== */

.kbpc-compare-button-container {
    margin: 10px 0;
}

.kbpc-compare-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kbpc-compare-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.kbpc-compare-btn.kbpc-in-list {
    opacity: 0.8;
}

.kbpc-compare-btn.kbpc-in-list .kbpc-icon-add {
    display: none;
}

.kbpc-compare-btn.kbpc-in-list .kbpc-icon-check {
    display: inline-flex !important;
}

.kbpc-compare-btn .material-icons {
    font-size: 18px;
}

.kbpc-compare-btn.kbpc-product-page {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
}

.kbpc-compare-btn.kbpc-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ===========================================
   COMPARISON WIDGET (Floating Sidebar)
   =========================================== */

#kbpc-compare-widget {
    position: fixed;
    right: -280px;
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    background: #fff;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: right 0.3s ease;
}

#kbpc-compare-widget.kbpc-widget-open {
    right: 0;
}

.kbpc-widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: linear-gradient(135deg, #23343E 0%, #1a262e 100%);
    color: #fff;
    border-radius: 8px 0 0 0;
    cursor: pointer;
    position: relative;
}

.kbpc-widget-header .material-icons {
    font-size: 20px;
}

.kbpc-widget-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.kbpc-widget-count {
    background: #2fb5d2;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.kbpc-widget-arrow {
    transition: transform 0.3s ease;
}

#kbpc-compare-widget.kbpc-widget-open .kbpc-widget-arrow {
    transform: rotate(180deg);
}

.kbpc-widget-body {
    max-height: 60vh;
    overflow-y: auto;
}

.kbpc-widget-products {
    padding: 10px;
}

.kbpc-widget-product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    position: relative;
}

.kbpc-widget-product-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.kbpc-widget-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.kbpc-widget-product-info {
    flex: 1;
    min-width: 0;
}

.kbpc-widget-product-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kbpc-widget-product-name:hover {
    color: #2fb5d2;
}

.kbpc-widget-product-price {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #2fb5d2;
    margin-top: 2px;
}

.kbpc-widget-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.kbpc-widget-product:hover .kbpc-widget-remove {
    opacity: 1;
}

.kbpc-widget-remove .material-icons {
    font-size: 14px;
}

.kbpc-widget-empty-message {
    text-align: center;
    padding: 30px 20px;
    color: #999;
}

.kbpc-widget-empty-message .material-icons {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 10px;
}

.kbpc-widget-empty-message p {
    margin: 0 0 5px;
    font-size: 14px;
}

.kbpc-widget-empty-message small {
    font-size: 12px;
}

.kbpc-widget-actions {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kbpc-btn-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: linear-gradient(135deg, #2fb5d2 0%, #1e88a8 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.kbpc-btn-compare:hover {
    background: linear-gradient(135deg, #1e88a8 0%, #156b87 100%);
    color: #fff;
    text-decoration: none;
}

.kbpc-btn-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.kbpc-btn-clear:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.kbpc-widget-info {
    padding: 8px 10px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 0 0 0 8px;
    color: #999;
}

/* ===========================================
   COMPARISON PAGE
   =========================================== */

.kbpc-compare-page {
    max-width: 100%;
    overflow-x: auto;
}

/* Empty state */
.kbpc-empty-comparison {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.kbpc-empty-icon {
    margin-bottom: 20px;
}

.kbpc-empty-icon .material-icons {
    font-size: 72px;
    color: #ddd;
}

.kbpc-empty-comparison h2 {
    margin: 0 0 10px;
    font-size: 24px;
    color: #333;
}

.kbpc-empty-comparison p {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

/* Comparison header */
.kbpc-compare-header {
    background: #fff;
    border-radius: 8px 8px 0 0;
    margin-bottom: 2px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.kbpc-header-row {
    display: flex;
}

.kbpc-header-label {
    width: 180px;
    min-width: 180px;
    padding: 20px;
    background: #23343E;
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.kbpc-header-product {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 1px solid #fff;
}

.kbpc-product-card {
    position: relative;
    text-align: center;
}

.kbpc-remove-product {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}

.kbpc-remove-product:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.kbpc-product-image {
    display: block;
    margin: 0 auto 10px;
    max-width: 120px;
}

.kbpc-product-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.kbpc-product-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    margin-bottom: 5px;
}

.kbpc-product-name:hover {
    color: #2fb5d2;
}

.kbpc-combination-name {
    font-size: 12px;
    color: #666;
}

/* Comparison table */
.kbpc-compare-table {
    background: #fff;
    border-radius: 0 0 8px 8px;
}

.kbpc-compare-row {
    display: flex;
    border-bottom: 1px solid #eee;
}

.kbpc-compare-row:last-child {
    border-bottom: none;
}

.kbpc-compare-row:nth-child(even) {
    background: #fafbfc;
}

.kbpc-row-label {
    width: 180px;
    min-width: 180px;
    padding: 15px 20px;
    background: #f5f6f7;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
}

.kbpc-row-value {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    border-left: 1px solid #eee;
    font-size: 14px;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.kbpc-no-value {
    color: #ccc;
}

.kbpc-price {
    font-weight: 700;
    color: #2fb5d2;
    font-size: 16px;
}

.kbpc-discount-price del {
    color: #999;
    font-size: 12px;
    margin-left: 8px;
}

.kbpc-availability {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.kbpc-availability-in-stock {
    background: #d4edda;
    color: #155724;
}

.kbpc-availability-available-for-order {
    background: #fff3cd;
    color: #856404;
}

.kbpc-availability-out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.kbpc-description {
    text-align: left;
    font-size: 13px;
    line-height: 1.5;
}

/* Section header (features) */
.kbpc-compare-section-header {
    display: flex;
    padding: 12px 20px;
    background: #23343E;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.kbpc-feature-row .kbpc-row-label {
    font-weight: 500;
}

/* Actions row */
.kbpc-actions-row {
    background: #f8f9fa !important;
}

.kbpc-action-cell {
    flex-direction: column;
    gap: 8px;
}

.kbpc-add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.kbpc-add-to-cart-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.kbpc-view-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s;
}

.kbpc-view-product-btn:hover {
    border-color: #2fb5d2;
    color: #2fb5d2;
    text-decoration: none;
}

/* Footer */
.kbpc-compare-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.kbpc-clear-comparison {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.kbpc-clear-comparison:hover {
    background: #e74c3c;
    color: #fff;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 991px) {
    .kbpc-header-label,
    .kbpc-row-label {
        width: 140px;
        min-width: 140px;
        padding: 12px 15px;
        font-size: 12px;
    }

    .kbpc-header-product,
    .kbpc-row-value {
        min-width: 160px;
        padding: 12px;
    }

    .kbpc-product-image {
        max-width: 80px;
    }
}

@media (max-width: 767px) {
    #kbpc-compare-widget {
        width: 100%;
        right: -100%;
        top: auto;
        bottom: 0;
        transform: none;
        border-radius: 8px 8px 0 0;
        max-height: 70vh;
    }

    #kbpc-compare-widget.kbpc-widget-open {
        right: 0;
    }

    .kbpc-widget-header {
        border-radius: 8px 8px 0 0;
    }

    .kbpc-widget-arrow {
        transform: rotate(90deg);
    }

    #kbpc-compare-widget.kbpc-widget-open .kbpc-widget-arrow {
        transform: rotate(-90deg);
    }

    .kbpc-widget-info {
        border-radius: 0;
    }

    .kbpc-compare-footer {
        flex-direction: column;
        gap: 15px;
    }

    .kbpc-compare-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .kbpc-compare-btn.kbpc-product-page {
        font-size: 13px;
        padding: 10px 15px;
    }
}

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */

.kbpc-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kbpc-toast.kbpc-toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.kbpc-toast.kbpc-toast-success {
    background: #27ae60;
}

.kbpc-toast.kbpc-toast-error {
    background: #e74c3c;
}

.kbpc-toast.kbpc-toast-warning {
    background: #f39c12;
}

.kbpc-toast .material-icons {
    font-size: 20px;
}
