/* Loading States & Animations */

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Large Loading Spinner */
.loading-spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

.loading-spinner-lg .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    background: white;
    padding: var(--spacing-2xl);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-xl);
    min-width: 200px;
}

.loading-content .loading-spinner {
    margin-bottom: var(--spacing-md);
}

.loading-content .loading-text {
    color: var(--dark-gray);
    font-weight: 500;
}

/* Page Loading Animation */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.page-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Pulse Animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.fade-in-delay-1 {
    animation: fadeIn 0.5s ease-out 0.1s both;
}

.fade-in-delay-2 {
    animation: fadeIn 0.5s ease-out 0.2s both;
}

.fade-in-delay-3 {
    animation: fadeIn 0.5s ease-out 0.3s both;
}

.fade-in-delay-4 {
    animation: fadeIn 0.5s ease-out 0.4s both;
}

.fade-in-delay-5 {
    animation: fadeIn 0.5s ease-out 0.5s both;
}

/* Slide In Animation */
@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Slide Up Animation */
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

/* Scale In Animation */
@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

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

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

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

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--light-gray) 25%, var(--light) 50%, var(--light-gray) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-md);
}

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

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

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

.skeleton-card {
    height: 200px;
    margin-bottom: 1rem;
}

/* Hover Animations */
.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: all 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: all 0.3s ease;
}

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

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary::before {
    background: rgba(255, 255, 255, 0.3);
}

.btn-secondary::before {
    background: rgba(255, 255, 255, 0.3);
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    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::before {
    width: 300px;
    height: 300px;
}

/* Progress Animation */
.progress-bar {
    transition: width 0.6s ease;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

/* Chart Loading Animation */
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.chart-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

.chart-loading .loading-text {
    margin-top: var(--spacing-md);
    color: var(--dark-gray);
    font-size: var(--font-size-sm);
}

/* Notification Animations */
.notification-enter {
    animation: notificationEnter 0.3s ease-out;
}

.notification-exit {
    animation: notificationExit 0.3s ease-in;
}

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

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

/* Modal Animations */
.modal.fade .modal-dialog {
    animation: modalSlideIn 0.3s ease-out;
}

.modal.fade.show .modal-dialog {
    animation: modalSlideIn 0.3s ease-out;
}

.modal.fade .modal-dialog {
    animation: modalSlideOut 0.3s ease-in;
}

@keyframes modalSlideIn {
    from {
        transform: translate(0, -50px);
        opacity: 0;
    }
    to {
        transform: translate(0, 0);
        opacity: 1;
    }
}

@keyframes modalSlideOut {
    from {
        transform: translate(0, 0);
        opacity: 1;
    }
    to {
        transform: translate(0, -50px);
        opacity: 0;
    }
}

/* Dropdown Animations */
.dropdown-menu {
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Entrance Animation */
.card-entrance {
    animation: cardEntrance 0.5s ease-out;
}

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

/* Loading States for Components */
.loading-card {
    position: relative;
    pointer-events: none;
}

.loading-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-lg);
}

.loading-card .spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

/* Responsive Animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .loading-overlay,
    .page-loading,
    .btn,
    .dropdown-menu,
    .modal {
        display: none !important;
    }
    
    * {
        animation: none !important;
        transition: none !important;
    }
}