/* Core Animation Keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin2 {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

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

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

@keyframes animated-gradient {
    to { background-position: 200%; }
}

@keyframes skeleton-loading {
    0% { background-position: -150% 0; opacity: 0.7; }
    50% { background-position: 50% 0; opacity: 0.85; }
    100% { background-position: 150% 0; opacity: 0.7; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

/* Fade Animations */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

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

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

@keyframes fadeInDown {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    0% { opacity: 0; transform: translateX(-20px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes slideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Vendor Prefixes for FadeIn */
@-webkit-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
@-moz-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
@-o-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }

/* Animation Classes */
.animated {
    animation-duration: 0.5s;
    animation-fill-mode: both;
    -webkit-animation-duration: 0.5s;
    -webkit-animation-fill-mode: both;
    -moz-animation-duration: 0.5s;
    -moz-animation-fill-mode: both;
    -o-animation-duration: 0.5s;
    -o-animation-fill-mode: both;
}

.animated.fadeIn { animation-name: fadeIn; -webkit-animation-name: fadeIn; -moz-animation-name: fadeIn; -o-animation-name: fadeIn; }
.animated.fadeInDown { animation-name: fadeInDown; -webkit-animation-name: fadeInDown; -moz-animation-name: fadeInDown; -o-animation-name: fadeInDown; }
.animated.fadeInUp { animation-name: fadeInUp; -webkit-animation-name: fadeInUp; -moz-animation-name: fadeInUp; -o-animation-name: fadeInUp; }
.animated.fadeInLeft { animation-name: fadeInLeft; -webkit-animation-name: fadeInLeft; -moz-animation-name: fadeInLeft; -o-animation-name: fadeInLeft; }
.animated.fadeInRight { animation-name: fadeInRight; -webkit-animation-name: fadeInRight; -moz-animation-name: fadeInRight; -o-animation-name: fadeInRight; }

.shake { animation: shake 0.5s ease-in-out; }
.fadeIn2 { animation: fadeIn2 1s ease-out forwards; }

/* Spinner and Loading Elements */
.spinner {
    position: absolute;
    border: 4px solid rgba(213, 213, 213, 0.7);
    border-top: 4px solid var(--main-blue);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 1000;
    top: 0;
}

.spinner-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin2 1s linear infinite;
    z-index: 10;
}

.global-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: g-spin 0.8s linear infinite;
}

.content-spinner {
    display: flex;
    justify-content: center;
    left: 0;
    top: 4rem;
    position: relative;
    opacity: 0;
    transform: translateY(-100px);
    visibility: hidden;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0s 0.3s;
}

.content-spinner.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.content-spinner.hide {
    opacity: 0;
    transform: translateY(-100px);
    visibility: hidden;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0s 0.3s;
}

.radius-flex {
    background: var(--forma-blue);
    border-radius: 50%;
    padding: 0.6rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    z-index: 999;
    border-radius: 8px;
    backdrop-filter: blur(6px);
}

.loading-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0.3) 20%, rgba(230, 230, 230, 0.5) 50%, rgba(255, 255, 255, 0.3) 80%);
    background-size: 400% 100%;
    animation: skeleton-loading 2.8s ease-in-out infinite;
    border-radius: 8px;
    opacity: 0.85;
}

/* JConfirm Specific */
.jconfirm .jconfirm-box.open-fade {
    animation: fadeInDown 0.3s ease forwards !important;
}

.jconfirm .jconfirm-box.close-down {
    animation: fadeInDown 0.2s ease forwards !important;
}