/**
 * VIVAIA POS - Quick Product Select Component Styles
 * Version: 1.0.1
 * Standardized styling for the quick product select component used across multiple pages
 * FORCED LIGHT MODE - no dark mode support
 */

/* ===== STANDARDIZED QUICK PRODUCT SELECT COMPONENT ===== */
.quick-product-select-container {
    margin-bottom: 1.5rem;
    background-color: white !important;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    width: 100% !important;
    box-sizing: border-box;
}

.quick-product-search {
    position: relative;
    margin-bottom: 1rem;
    width: 100% !important;
}

.quick-product-search input {
    width: 100% !important;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    background-color: white !important;
    color: #111827 !important;
    box-sizing: border-box;
}

.quick-product-search input:focus {
    outline: none;
    border-color: #804c1a !important;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.quick-product-search input::placeholder {
    color: #9ca3af !important;
}

/* Clear search button */
#stock-in-quick-clear-search,
#transfer-quick-clear-search,
#check-quick-clear-search,
.quick-product-search .clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

#stock-in-quick-clear-search:hover,
#transfer-quick-clear-search:hover,
#check-quick-clear-search:hover,
.quick-product-search .clear-search:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}

/* Search dropdown */
.quick-product-search .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 600px; /* Increased from 300px to show more results for series with many variants */
    overflow-y: auto;
    z-index: 20;
    background-color: white !important;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
}

.quick-product-search .dropdown.hidden {
    display: none;
}

.quick-product-search .dropdown-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
    color: #111827 !important;
}

.quick-product-search .dropdown-item:last-child {
    border-bottom: none;
}

.quick-product-search .dropdown-item:hover {
    background-color: #f9fafb;
}

.quick-product-search .dropdown-item.selected {
    background-color: #804c1a;
    color: white !important;
}

/* Quick Product Select Dropdowns */
.quick-product-select-dropdowns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    width: 100% !important;
}

.quick-product-select-dropdowns select {
    width: 100% !important;
    min-width: 0; /* Allow shrinking */
    padding: 0.75rem;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: white !important;
    color: #111827 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Fix for text clipping */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    box-sizing: border-box;
}

.quick-product-select-dropdowns select:focus {
    outline: none;
    border-color: #804c1a !important;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.quick-product-select-dropdowns select:disabled {
    background-color: #f3f4f6 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Fix for dropdown option text clipping */
.quick-product-select-dropdowns select option {
    padding: 0.5rem;
    white-space: normal;
    word-wrap: break-word;
    min-height: 1.5em;
    line-height: 1.5;
    font-size: 0.875rem;
    background-color: white !important;
    color: #111827 !important;
}

/* Responsive adjustments for dropdowns */
@media (max-width: 768px) {
    .quick-product-select-dropdowns {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .quick-product-select-container {
        padding: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .quick-product-select-dropdowns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .quick-product-select-dropdowns {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Loading spinner */
.quick-product-search .spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #804c1a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility Improvements */
.quick-product-select-dropdowns select:focus-visible {
    outline: 2px solid #804c1a;
    outline-offset: 2px;
}

.quick-product-search input:focus-visible {
    outline: 2px solid #804c1a;
    outline-offset: 2px;
}

/* Force light mode for all quick product select elements */
@media (prefers-color-scheme: dark) {
    .quick-product-select-container {
        background-color: white !important;
        color: #111827 !important;
    }
    
    .quick-product-search input {
        background-color: white !important;
        color: #111827 !important;
        border-color: #d1d5db !important;
    }
    
    .quick-product-search input::placeholder {
        color: #9ca3af !important;
    }
    
    .quick-product-search .dropdown {
        background-color: white !important;
        color: #111827 !important;
    }
    
    .quick-product-search .dropdown-item {
        background-color: white !important;
        color: #111827 !important;
    }
    
    .quick-product-search .dropdown-item:hover {
        background-color: #f9fafb !important;
    }
    
    .quick-product-select-dropdowns select {
        background-color: white !important;
        color: #111827 !important;
        border-color: #d1d5db !important;
    }
    
    .quick-product-select-dropdowns select option {
        background-color: white !important;
        color: #111827 !important;
    }
}

@media (prefers-contrast: high) {
    .quick-product-select-dropdowns select {
        border-width: 2px;
    }
    
    .quick-product-search input {
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .quick-product-select-dropdowns select,
    .quick-product-search input {
        transition: none;
    }
    
    .quick-product-search .spinner {
        animation: none;
    }
}

/* Quick Product Select Styles */

/* Searchable Dropdown Styles */
.searchable-dropdown-container {
    position: relative;
    width: 100%;
}

.searchable-dropdown-input {
    position: relative;
    display: flex;
    align-items: center;
}

.searchable-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    color: #1f2937;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.searchable-input:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.searchable-dropdown-arrow {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease;
}

.searchable-dropdown-arrow:hover {
    color: #804c1a;
}

.searchable-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
}

.searchable-dropdown-options.hidden {
    display: none;
}

.searchable-dropdown-list {
    padding: 0.25rem 0;
}

.searchable-option {
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #1f2937;
    transition: background-color 0.2s ease;
}

.searchable-option:hover {
    background-color: #f3f4f6;
}

.searchable-option.selected {
    background-color: #804c1a;
    color: #ffffff;
}

/* Existing Quick Product Select Styles */
.quick-product-select {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quick-product-select .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.quick-product-select .grid > div {
    display: flex;
    flex-direction: column;
}

.quick-product-select .grid > div label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.quick-product-select .grid > div select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    color: #1f2937;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-product-select .grid > div select:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.quick-product-select .grid > div select:not(:disabled) {
    cursor: pointer;
}

.quick-product-select .grid > div select:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .quick-product-select .grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .searchable-dropdown-options {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .quick-product-select {
        padding: 0.75rem;
    }
    
    .quick-product-select .grid {
        gap: 0.5rem;
    }
    
    .searchable-input {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .searchable-option {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
} 