/* ==========================================
   VARIATIONS DROPDOWN - Estilos del Dropdown de Variaciones
   ========================================== */

/* Wrapper del dropdown de variaciones */
.product-variations-wrapper {
    position: relative;
    width: 100%;
}

/* Botón de variaciones (similar al botón normal pero con indicador) */
.add-to-cart-variations {
    position: relative;
}

.add-to-cart-variations::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Dropdown Container */
.product-variations-dropdown {
    position: absolute;
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    overflow: hidden;
    display: none;
}

.product-variations-dropdown.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
}

/* Flecha del dropdown - eliminada por posicionamiento dinámico */

/* Header del dropdown */
.variations-dropdown-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.variations-dropdown-header i {
    font-size: 16px;
    color: #3b82f6;
}

/* Lista de variaciones */
.variations-dropdown-list {
    padding: 12px;
    max-height: 280px;
    overflow-y: auto;
}

/* Custom scrollbar para el dropdown */
.variations-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.variations-dropdown-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.variations-dropdown-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.variations-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Opciones de variación */
.variation-option {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-align: left;
}

.variation-option:last-child {
    margin-bottom: 0;
}

.variation-option:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.variation-option:active {
    transform: translateX(1px);
}

.variation-option.selected {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.variation-option.loading {
    pointer-events: none;
    opacity: 0.6;
}

.variation-option.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 14px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.variation-option span {
    flex: 1;
}

.variation-option i {
    font-size: 16px;
    color: #cbd5e1;
    transition: all 0.2s;
}

.variation-option:hover i {
    color: #3b82f6;
}

.variation-option.selected i {
    color: white;
    transform: scale(1.15);
}

/* Animación de spin para loading */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive - Ajustes para móvil */
@media (max-width: 767px) {
    .product-variations-dropdown {
        width: 260px;
    }

    .variations-dropdown-header {
        padding: 12px 16px;
        font-size: 13px;
    }

    .variations-dropdown-header i {
        font-size: 14px;
    }

    .variations-dropdown-list {
        padding: 10px;
        max-height: 240px;
    }

    .variation-option {
        padding: 10px 12px;
        font-size: 12px;
    }

    .variation-option i {
        font-size: 14px;
    }
}

/* En dispositivos muy pequeños, centrar el dropdown mejor */
@media (max-width: 480px) {
    .product-variations-dropdown {
        width: calc(100vw - 40px);
        max-width: 280px;
    }
}

/* Accessibility - Focus states */
.variation-option:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Eliminado - ahora usa posicionamiento dinámico con JavaScript */

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
    .product-variations-dropdown {
        background: #1e293b;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    }

    .product-variations-dropdown::after {
        border-top-color: #1e293b;
    }

    .variations-dropdown-header {
        background: linear-gradient(135deg, #0f172a, #1e293b);
        border-bottom-color: #334155;
        color: #e2e8f0;
    }

    .variation-option {
        background: #0f172a;
        border-color: #334155;
        color: #e2e8f0;
    }

    .variation-option:hover {
        background: #1e293b;
    }
}

/* Performance optimizations */
.product-variations-dropdown,
.variation-option {
    will-change: transform, opacity;
}

/* Animación de entrada más suave */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.product-variations-dropdown.active {
    animation: dropdownFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Asegurar que el dropdown se vea bien en el grid */
.product-card {
    position: relative;
}

/* Z-index management para evitar overlaps */
.product-card:hover {
    z-index: 10;
}

.product-variations-wrapper {
    z-index: 1;
}

.product-variations-dropdown.active {
    z-index: 1001;
}

/* Estado cuando el dropdown está abierto: evitar clipping y mantener visible el botón */
.product-card.variations-open {
    overflow: visible;
    z-index: 20;
}

.product-card.variations-open .product-image {
    overflow: visible;
}

.product-card.variations-open .product-actions {
    opacity: 1;
    transform: translateY(0);
}
