/* ========================================
   Animations & Visual Enhancements
   Toast Notifications, Fade In, Loading, etc.
   ======================================== */

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast_container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 500px;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    padding: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    pointer-events: all;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--color-primary);
}

.toast.toast-success {
    border-left-color: var(--color-success);
}

.toast.toast-error {
    border-left-color: var(--color-error);
}

.toast.toast-warning {
    border-left-color: #f0ad4e;
}

.toast.toast-info {
    border-left-color: var(--color-info);
}

.toast.toast-hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

.toast_icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-success .toast_icon {
    color: var(--color-success);
}

.toast-error .toast_icon {
    color: var(--color-error);
}

.toast-warning .toast_icon {
    color: #f0ad4e;
}

.toast-info .toast_icon {
    color: var(--color-info);
}

.toast_content {
    flex: 1;
}

.toast_title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.toast_message {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.toast_close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.toast_close:hover {
    color: var(--color-text-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* ========================================
   FADE IN ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

/* Staggered animations for multiple items */
.stagger-item {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }

/* ========================================
   LOADING SPINNER
   ======================================== */

.loading_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.loading_overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.spinner_circle {
    width: 100%;
    height: 100%;
    border: 4px solid var(--color-bg-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner_logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: var(--color-primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Inline spinner (pequeño) */
.spinner-inline {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-bg-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* ========================================
   RIPPLE EFFECT
   ======================================== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   BACK TO TOP BUTTON
   ======================================== */

.back_to_top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--color-primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    transition: all var(--transition-base);
    z-index: 1000;
}

.back_to_top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back_to_top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.back_to_top:active {
    transform: translateY(-2px);
}

/* ========================================
   FORM SHAKE ANIMATION (on error)
   ======================================== */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s;
}

/* ========================================
   MICROINTERACTIONS
   ======================================== */

/* Breathing button */
@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.breathe {
    animation: breathe 2s ease-in-out infinite;
}

/* Pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(68, 176, 236, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(68, 176, 236, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(68, 176, 236, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Icon hover animations */
.icon-hover {
    transition: transform var(--transition-fast);
}

.icon-hover:hover {
    transform: scale(1.2) rotate(5deg);
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* ========================================
   PROGRESS BAR (top of page)
   ======================================== */

.progress_bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--color-primary-gradient);
    z-index: 10001;
    transition: width 0.3s ease;
}

/* ========================================
   SKELETON LOADING
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 0%,
        var(--color-bg-secondary) 50%,
        var(--color-bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-xl);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media screen and (max-width: 700px) {
    .toast_container {
        right: 10px;
        left: 10px;
        top: 70px;
    }

    .toast {
        min-width: unset;
        max-width: unset;
    }

    .back_to_top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}
