/**
 * Product Comparison UI Styles
 *
 * Styles for floating comparison bar and related UI elements
 * @version 1.0
 * @since 2025-02-07
 */

/* ======================================
   Floating Compare Bar
   ====================================== */

.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 12px 0;
    transform: translateY(100%);
    transition: transform 0.4s ease-in-out;
}

.compare-bar[style*="display: block"] {
    transform: translateY(0);
}

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

/* ======================================
   Compare Products List
   ====================================== */

.compare-products {
    display: flex;
    gap: 12px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    padding: 4px 0;
}

.compare-products::-webkit-scrollbar {
    height: 4px;
}

.compare-products::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.compare-products::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.compare-products::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ======================================
   Product Item in Compare Bar
   ====================================== */

.compare-product-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
    max-width: 100px;
}

.compare-product-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.btn-remove-compare {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.btn-remove-compare:hover {
    background: #ff3838;
    transform: scale(1.1);
}

.compare-product-name {
    color: white;
    text-align: center;
    font-size: 11px;
    line-height: 1.2;
    max-height: 2.4em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ======================================
   Compare Actions
   ====================================== */

.compare-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.compare-actions .btn {
    font-size: 14px;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.compare-actions #btnCompare {
    background: white;
    color: #667eea;
    border: none;
}

.compare-actions #btnCompare:hover:not(:disabled) {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.compare-actions #btnCompare:disabled {
    background: rgba(255, 255, 255, 0.5);
    color: rgba(102, 126, 234, 0.5);
    cursor: not-allowed;
}

.compare-actions #btnClearCompare {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.compare-actions #btnClearCompare:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ======================================
   Compare Checkbox in Product Card
   ====================================== */

.product-card .form-check-input.compare-checkbox {
    cursor: pointer;
    border-color: #667eea;
    transition: all 0.2s;
}

.product-card .form-check-input.compare-checkbox:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.product-card .form-check-input.compare-checkbox:hover {
    border-color: #764ba2;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

.product-card .form-check-label {
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #495057;
    font-weight: 500;
}

/* ======================================
   Toast Notifications
   ====================================== */

.toast-container .toast .toast-header {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

.toast-container .toast .toast-header.bg-success {
    background-color: #28a745 !important;
}

.toast-container .toast .toast-header.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.toast-container .toast .toast-header.bg-info {
    background-color: #17a2b8 !important;
}

.toast-container .toast .toast-header.bg-danger {
    background-color: #dc3545 !important;
}

.toast-container .toast .toast-body {
    padding: 12px;
    font-size: 14px;
}

/* ======================================
   Responsive Design
   ====================================== */

@media (max-width: 768px) {
    .compare-bar {
        padding: 10px 0;
    }

    .compare-bar-content {
        flex-direction: column;
        gap: 12px;
    }

    .compare-products {
        width: 100%;
        justify-content: flex-start;
    }

    .compare-product-item {
        min-width: 70px;
        max-width: 80px;
    }

    .compare-product-thumb {
        width: 50px;
        height: 50px;
    }

    .compare-product-name {
        font-size: 10px;
    }

    .compare-actions {
        width: 100%;
        justify-content: center;
    }

    .compare-actions .btn {
        flex: 1;
        font-size: 13px;
        padding: 8px 16px;
    }
}

@media (max-width: 576px) {
    .compare-product-item {
        min-width: 60px;
        max-width: 70px;
    }

    .compare-product-thumb {
        width: 45px;
        height: 45px;
    }

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

    .btn-remove-compare {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
}

/* ======================================
   Print Hide
   ====================================== */

@media print {
    .compare-bar {
        display: none !important;
    }
}
