/**
 * Product Search Component Styles
 * 
 * Centralized styles for the product search and select component
 * 
 * @author Peter Bamuhigire
 * @date November 3, 2025
 */

/* Search Results Container */
.product-search-results {
    position: absolute;
    z-index: 1050;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 0.25rem;
    display: none;
}

.product-search-results::-webkit-scrollbar {
    width: 8px;
}

.product-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.product-search-results::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.product-search-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Product Result Item */
.product-search-result {
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 0.875rem 1rem;
    transition: all 0.15s ease-in-out;
}

.product-search-result:first-child {
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
}

.product-search-result:last-child {
    border-bottom-left-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
    border-bottom: 0;
}

.product-search-result:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    transform: translateX(4px);
}

.product-search-result:active {
    background-color: #e9ecef;
}

/* Product Info */
.product-search-result .fw-bold {
    font-size: 0.9375rem;
    color: #212529;
    margin-bottom: 0.25rem;
}

.product-search-result small {
    font-size: 0.8125rem;
}

.product-search-result .text-muted {
    color: #6c757d !important;
}

/* Badges */
.product-search-result .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
    font-weight: 600;
}

.product-search-result .badge.bg-success {
    background-color: #2fb344 !important;
}

.product-search-result .badge.bg-danger {
    background-color: #d63939 !important;
}

.product-search-result .badge.bg-warning {
    background-color: #f59f00 !important;
}

.product-search-result .badge.bg-info {
    background-color: #4299e1 !important;
    color: #fff !important;
}

/* Search Input Container */
.product-search-container {
    position: relative;
}

/* Touch-friendly POS defaults (applies only where .pos-touch is present) */
.pos-touch .form-control,
.pos-touch .form-select,
.pos-touch .btn {
    min-height: 44px;
}

.pos-touch .btn.add-to-cart {
    min-width: 48px;
    min-height: 48px;
}

.pos-touch .btn#btnEmptyCart {
    min-height: 40px;
}

.pos-touch .item-quantity {
    min-height: 44px;
    width: 84px !important;
}

.product-search-input {
    padding-right: 2.5rem;
}

.product-search-input:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 0.25rem rgba(66, 153, 225, 0.25);
}

.product-search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

/* Loading State */
.product-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.product-search-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.5rem;
}

/* Empty State */
.product-search-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.product-search-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    opacity: 0.5;
}

/* Batch Selection Modal Enhancements */
.swal2-popup .form-select:focus,
.swal2-popup .form-control:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 0.25rem rgba(66, 153, 225, 0.25);
}

.swal2-popup .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
}

.swal2-popup .form-text {
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-search-results {
        max-height: 300px;
    }

    .product-search-result {
        padding: 0.75rem;
    }

    .product-search-result .fw-bold {
        font-size: 0.875rem;
    }

    .product-search-result small {
        font-size: 0.75rem;
    }

    .product-search-result .badge {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .product-search-result {
        padding: 0.9rem 1rem;
    }

    .product-search-result .fw-bold {
        font-size: 1rem;
    }

    .product-search-result small {
        font-size: 0.85rem;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .product-search-results {
        background: #1a1d20;
        border-color: #2d3338;
    }

    .product-search-result:hover {
        background-color: #232629;
    }

    .product-search-result:active {
        background-color: #2a2e32;
    }

    .product-search-result .fw-bold {
        color: #f8f9fa;
    }

    .product-search-icon {
        color: #adb5bd;
    }
}

/* Print Styles */
@media print {
    .product-search-results {
        display: none !important;
    }
}
