/* ========================================
   PharmaSearch Spotlight - Estilos
   Sistema de búsqueda avanzada tipo Spotlight
   ======================================== */

/* Overlay principal */
.spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10025;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 20px 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.spotlight-overlay.show {
    opacity: 1;
}

/* Modal principal */
.spotlight-modal {
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-50px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.spotlight-overlay.show .spotlight-modal {
    transform: translateY(0);
    opacity: 1;
}

/* Header con input de búsqueda */
.spotlight-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 15px;
}

.spotlight-search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.spotlight-search-icon {
    position: absolute;
    left: 15px;
    color: #6c757d;
    font-size: 18px;
    pointer-events: none;
}

.spotlight-input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.spotlight-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.spotlight-results-count {
    position: absolute;
    right: 15px;
    font-size: 13px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.spotlight-close-btn {
    background: #f8f9fa;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    flex-shrink: 0;
}

.spotlight-close-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Área de resultados */
.spotlight-results {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 300px;
    max-height: 50vh;
}

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

.spotlight-results::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 10px;
}

.spotlight-results::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 10px;
}

.spotlight-results::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Estados vacío, loading, no results */
.spotlight-empty-state,
.spotlight-loading,
.spotlight-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

/* Secciones de resultados */
.spotlight-section {
    margin-bottom: 25px;
}

.spotlight-section:last-child {
    margin-bottom: 0;
}

.spotlight-section-header {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.spotlight-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Items de resultado */
.spotlight-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.spotlight-result-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.spotlight-result-item.active {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

.spotlight-result-item.active * {
    color: white !important;
}

.spotlight-result-item.active .spotlight-result-icon {
    opacity: 1;
}

/* Imagen del producto */
.spotlight-result-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spotlight-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Icon badge para categorías */
.spotlight-result-icon-badge {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bs-primary) 0%, #0056b3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
}

/* Contenido del resultado */
.spotlight-result-content {
    flex: 1;
    min-width: 0;
}

.spotlight-result-title {
    font-weight: 600;
    font-size: 15px;
    color: #212529;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spotlight-result-item.active .spotlight-result-title {
    color: white;
}

.spotlight-result-title mark {
    background: #ffeaa7;
    color: #212529;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
}

.spotlight-result-item.active .spotlight-result-title mark {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.spotlight-result-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #6c757d;
    flex-wrap: wrap;
}

.spotlight-result-meta > span {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.spotlight-result-item.active .spotlight-result-meta,
.spotlight-result-item.active .spotlight-result-meta * {
    color: rgba(255, 255, 255, 0.9);
}

/* Icono de navegación */
.spotlight-result-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.spotlight-result-item:hover .spotlight-result-icon {
    opacity: 1;
}

/* Ver todos los resultados */
.spotlight-view-all {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

/* Footer con filtros */
.spotlight-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 15px 15px;
}

.spotlight-filters {
    margin-bottom: 15px;
}

.spotlight-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.spotlight-categories-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.spotlight-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    margin: 0;
}

.spotlight-checkbox-label:hover {
    border-color: var(--bs-primary);
    background: #f0f7ff;
}

.spotlight-checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.spotlight-checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: var(--bs-primary);
}

/* Keyboard shortcuts */
.spotlight-shortcuts {
    padding-top: 12px;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.spotlight-shortcuts kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    line-height: 1;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .spotlight-overlay {
        padding: 20px 10px 10px;
    }

    .spotlight-modal {
        max-height: 90vh;
        border-radius: 12px;
    }

    .spotlight-header {
        padding: 15px;
    }

    .spotlight-input {
        font-size: 14px;
        padding: 10px 40px 10px 40px;
    }

    .spotlight-results {
        padding: 15px;
        max-height: 45vh;
    }

    .spotlight-result-item {
        padding: 10px;
        gap: 12px;
    }

    .spotlight-result-image {
        width: 50px;
        height: 50px;
    }

    .spotlight-result-icon-badge {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    .spotlight-result-title {
        font-size: 14px;
    }

    .spotlight-result-meta {
        font-size: 12px;
        gap: 10px;
    }

    .spotlight-categories-checkboxes {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .spotlight-checkbox-label {
        padding: 6px 10px;
        font-size: 13px;
    }

    .spotlight-shortcuts {
        font-size: 11px;
    }

    .spotlight-shortcuts kbd {
        padding: 2px 6px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .spotlight-categories-checkboxes {
        grid-template-columns: 1fr;
    }

    .spotlight-result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .spotlight-shortcuts span {
        display: none;
    }
}

/* Animaciones */
@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Loading spinner personalizado */
.spotlight-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Precio destacado */
.spotlight-result-price .price-value {
    font-weight: 600;
    color: var(--bs-success);
}

.spotlight-result-item.active .spotlight-result-price .price-value {
    color: white;
}

/* Stock bajo */
.spotlight-result-stock.low-stock .stock-value {
    color: var(--bs-warning);
    font-weight: 600;
}

.spotlight-result-item.active .spotlight-result-stock.low-stock .stock-value {
    color: white;
}
