/* Animaciones para Sistema de Direcciones Guardadas */

/* Contenedor principal */
#zoom-saved-addresses-container {
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

#zoom-saved-addresses-container.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Selector compacto */
.btn-current-address {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1);
}

.btn-current-address:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.btn-current-address:active {
    transform: scale(0.98);
}

/* Icono de flecha animado */
.change-btn {
    transition: transform 0.3s ease;
    display: inline-block;
}

.change-btn.rotated {
    transform: rotate(180deg);
}

/* Dropdown con animación suave */
.saved-addresses-dropdown {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    overflow: hidden;
}

.saved-addresses-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 400px;
}

/* Items de dirección con hover suave */
.address-item {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.address-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 115, 170, 0.1), transparent);
    transition: left 0.5s ease;
}

.address-item:hover::before {
    left: 100%;
}

.address-item:hover {
    background: #f8f9fa;
}

.address-item.active {
    background: #e3f2fd;
    border-left: 4px solid #0073aa;
    animation: pulse-active 2s ease-in-out;
}

/* Botones con animaciones */
.new-address-btn, .save-current-address {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.new-address-btn::before, .save-current-address::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.new-address-btn:hover::before, .save-current-address:hover::before {
    width: 300px;
    height: 300px;
}

.new-address-btn:hover, .save-current-address:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Toast animado */
.saved-address-toast {
    animation: slideInRight 0.3s ease-out;
}

.saved-address-toast.fade-out {
    animation: slideOutRight 0.3s ease-in;
}

/* Loading spinner */
.address-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Keyframes */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

@keyframes pulse-active {
    0%, 100% { 
        border-left-color: #0073aa;
        background-color: #e3f2fd;
    }
    50% { 
        border-left-color: #005a87;
        background-color: #bbdefb;
    }
}

/* Micro-interacciones */
.address-item .address-label {
    transition: color 0.2s ease;
}

.address-item:hover .address-label {
    color: #0073aa;
}

/* Estilos para items de vendedores (mismo look que principal) */
.vendor-address-item {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.vendor-address-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 115, 170, 0.1), transparent);
    transition: left 0.5s ease;
}

.vendor-address-item:hover::before {
    left: 100%;
}

.vendor-address-item:hover {
    background: #f8f9fa;
}

.vendor-address-item.active {
    background: #e3f2fd;
    border-left: 4px solid #0073aa;
}

.vendor-address-item .address-label {
    transition: color 0.2s ease;
}

.vendor-address-item:hover .address-label {
    color: #0073aa;
}

/* Responsive animations */
@media (max-width: 768px) {
    .saved-addresses-dropdown {
        max-height: 300px;
    }
    
    .btn-current-address:hover {
        transform: none;
    }
}

/* Reducir animaciones para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}