/**
 * MODERN EFFECTS - Bimmer Modular
 * ================================
 * Efectos visuales modernos: hover, focus, ripple, glow
 * Inspirado en Material Design 3 y UI modernas
 */

/* ==================== BUTTON HOVER GLOW ANIMATION ==================== */
@keyframes buttonHoverGlow {
    0% {
        box-shadow: 
            0 8px 16px rgba(255, 107, 107, 0.1),
            0 16px 32px rgba(255, 107, 107, 0.15);
    }
    50% {
        box-shadow: 
            0 8px 16px rgba(255, 107, 107, 0.25),
            0 16px 32px rgba(255, 107, 107, 0.35),
            0 0 30px rgba(255, 107, 107, 0.15);
    }
    100% {
        box-shadow: 
            0 8px 16px rgba(255, 107, 107, 0.2),
            0 16px 32px rgba(255, 107, 107, 0.3),
            0 0 0 0 rgba(255, 107, 107, 0.1);
    }
}

/* ==================== INPUT FOCUS EFFECTS ==================== */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 
        0 0 0 3px rgba(255, 107, 107, 0.1),
        0 0 0 1px var(--color-primary),
        0 0 20px rgba(255, 107, 107, 0.15),
        var(--shadow-md);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

textarea:focus {
    transform: translateY(-1px);
}

/* ==================== INPUT LABEL ANIMATIONS ==================== */
.input-group label {
    transition: all 0.3s ease;
    position: relative;
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

input:focus + label,
textarea:focus + label,
select:focus + label {
    color: var(--color-primary);
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.2);
}

/* ==================== HOVER EFFECTS FOR CARDS ==================== */
.card,
.panel,
[class*="card-item"] {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.card:hover,
.panel:hover,
[class*="card-item"]:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.08),
        0 20px 40px rgba(255, 107, 107, 0.15);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

/* ==================== LIST ITEM HOVER EFFECTS ==================== */
.list-item,
li,
.menu-item,
.option-item {
    transition: all 0.3s ease;
    position: relative;
    padding: 12px 16px;
}

.list-item:hover,
li:hover,
.menu-item:hover,
.option-item:hover {
    background: rgba(255, 107, 107, 0.05);
    transform: translateX(4px);
    border-radius: 8px;
}

.list-item::after,
.menu-item::after,
.option-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transform: scaleY(0);
    transition: all 0.3s ease;
}

.list-item:hover::after,
.menu-item:hover::after,
.option-item:hover::after {
    opacity: 1;
    transform: scaleY(1);
}

/* ==================== LINK HOVER EFFECTS ==================== */
a, .link {
    position: relative;
    transition: all 0.3s ease;
}

a:hover, .link:hover {
    color: var(--color-primary);
}

a::after, .link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

a:hover::after, .link:hover::after {
    width: 100%;
}

/* ==================== TAB ACTIVE STATE EFFECTS ==================== */
.tab-button.active,
[role="tab"][aria-selected="true"] {
    position: relative;
}

.tab-button.active::after,
[role="tab"][aria-selected="true"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-sunset);
    border-radius: 3px 3px 0 0;
    animation: slideInUp 0.4s ease;
}

/* ==================== CHECKBOX & RADIO ANIMATIONS ==================== */
input[type="checkbox"],
input[type="radio"] {
    cursor: pointer;
    accent-color: var(--color-primary);
    transition: all 0.3s ease;
    transform: scale(1);
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.3));
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    animation: scaleInElastic 0.4s ease;
}

/* ==================== BADGE ANIMATIONS ==================== */
.badge,
[class*="badge"],
.tag,
.label {
    display: inline-block;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
}

.badge:hover,
.tag:hover,
.label:hover {
    transform: scale(1.1) rotate(1deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* ==================== PROGRESS BAR ANIMATIONS ==================== */
.progress,
.progress-bar {
    transition: all 0.6s ease;
}

.progress-bar {
    background: linear-gradient(
        90deg,
        var(--color-primary) 0%,
        var(--color-secondary) 50%,
        var(--color-primary) 100%
    );
    background-size: 200% 100%;
    animation: textGradientFlow 2s ease-in-out infinite;
    box-shadow: 
        0 0 20px rgba(255, 107, 107, 0.4),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
}

/* ==================== TOOLTIP ANIMATIONS ==================== */
.tooltip,
[role="tooltip"],
.popover {
    animation: slideInUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tooltip::after {
    content: '';
    animation: fadeIn 0.3s ease;
}

/* ==================== DROPDOWN ANIMATIONS ==================== */
.dropdown-menu,
.dropdown-content,
.select-dropdown {
    animation: slideInDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

.dropdown-menu .option,
.dropdown-content .item {
    transition: all 0.25s ease;
    position: relative;
}

.dropdown-menu .option:hover,
.dropdown-content .item:hover {
    background: rgba(255, 107, 107, 0.08);
    transform: translateX(4px);
}

/* ==================== MODAL BACKDROP EFFECTS ==================== */
.modal-backdrop,
.overlay {
    animation: fadeIn 0.3s ease;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.6) 100%
    );
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ==================== TOAST/NOTIFICATION EFFECTS ==================== */
.toast,
.notification,
.alert {
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.toast::before,
.notification::before,
.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 3px;
    background: var(--color-primary);
    border-radius: 3px 0 0 3px;
}

.toast.success::before,
.notification.success::before,
.alert.success::before {
    background: var(--color-success);
}

.toast.warning::before,
.notification.warning::before,
.alert.warning::before {
    background: var(--color-warning);
}

.toast.error::before,
.notification.error::before,
.alert.error::before {
    background: var(--color-danger);
}

/* ==================== RIPPLE EFFECT ON CLICK ==================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(255, 107, 107, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* ==================== DISABLED STATE EFFECTS ==================== */
:disabled,
.disabled,
[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transition: all 0.3s ease;
}

:disabled:hover,
.disabled:hover,
[aria-disabled="true"]:hover {
    transform: none;
    box-shadow: none;
}

/* ==================== LOADING STATE EFFECTS ==================== */
.loading,
[aria-busy="true"],
.is-loading {
    position: relative;
}

.loading::after,
[aria-busy="true"]::after,
.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
    border-radius: inherit;
}

/* ==================== FOCUS VISIBLE IMPROVEMENTS ==================== */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ==================== SCROLL SHADOW EFFECT ==================== */
.scroll-shadow {
    position: relative;
    overflow: auto;
}

.scroll-shadow::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1) 0%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.scroll-shadow.scrolled::before {
    opacity: 1;
}

/* ==================== TRANSITION EASING CLASSES ==================== */
.ease-smooth { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.ease-sharp { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-elastic { transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
.ease-bounce { transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }

/* ==================== DARK MODE EFFECTS ==================== */
body.dark-mode .card:hover,
body.dark-mode .panel:hover {
    box-shadow: 
        0 12px 24px rgba(255, 107, 107, 0.2),
        0 20px 40px rgba(255, 107, 107, 0.1);
}

body.dark-mode input[type="text"]:focus,
body.dark-mode input[type="email"]:focus,
body.dark-mode input[type="password"]:focus,
body.dark-mode input[type="number"]:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
    box-shadow: 
        0 0 0 3px rgba(255, 107, 107, 0.15),
        0 0 0 1px var(--color-primary),
        0 0 20px rgba(255, 107, 107, 0.2),
        var(--shadow-md);
}

body.dark-mode .list-item:hover,
body.dark-mode li:hover,
body.dark-mode .menu-item:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
/* Use transform and opacity for smooth animations */
.animate-gpu {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Disable animations on reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
