/* Nexus Bank - Smart Loading Animations */
/* Only shows when actually processing operations */

/* ===============================
   Page Loading Overlay (different from form loading)
   =============================== */
.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.2s ease-out;
}

.page-loading-overlay.fade-out {
    opacity: 0;
}

.page-loader {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
}

.page-logo {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 36px;
    box-shadow: 0 20px 60px rgba(76, 175, 80, 0.4);
    animation: page-logo-pulse 1.8s ease-in-out infinite alternate;
}

@keyframes page-logo-pulse {
    0% { 
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 20px 60px rgba(76, 175, 80, 0.4);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 25px 80px rgba(76, 175, 80, 0.6);
    }
}

.page-ring {
    position: absolute;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: page-spin 3s linear infinite;
}

.page-ring:nth-child(1) {
    width: 120px;
    height: 120px;
    border-top: 4px solid #4CAF50;
    border-right: 4px solid rgba(76, 175, 80, 0.3);
    animation-duration: 1.8s;
}

.page-ring:nth-child(2) {
    width: 100px;
    height: 100px;
    top: 10px;
    left: 10px;
    border-top: 3px solid #45a049;
    border-left: 3px solid rgba(69, 160, 73, 0.3);
    animation: page-spin 1.4s linear infinite reverse;
}

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

.page-loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
}

.page-loading-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.page-loading-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1rem;
}

/* ===============================
   Content Loading Overlay
   =============================== */
.content-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease-in-out;
}

.content-loading.hidden {
    opacity: 0;
    pointer-events: none;
}
.nexus-loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 2rem;
}

.nexus-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 32px;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
    animation: logo-pulse 2s ease-in-out infinite alternate;
}

.nexus-logo::before {
    content: "N";
    font-family: 'Segoe UI', Arial, sans-serif;
}

@keyframes logo-pulse {
    0% { 
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 20px 50px rgba(102, 126, 234, 0.6);
    }
}

.nexus-ring {
    position: absolute;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: nexus-spin 2s linear infinite;
}

.nexus-ring:nth-child(1) {
    width: 100px;
    height: 100px;
    border-top: 3px solid #667eea;
    border-right: 3px solid rgba(102, 126, 234, 0.3);
}

.nexus-ring:nth-child(2) {
    width: 80px;
    height: 80px;
    top: 10px;
    left: 10px;
    border-top: 2px solid #764ba2;
    border-left: 2px solid rgba(118, 75, 162, 0.3);
    animation: nexus-spin 1.5s linear infinite reverse;
}

.nexus-ring:nth-child(3) {
    width: 60px;
    height: 60px;
    top: 20px;
    left: 20px;
    border-top: 2px solid #8b5a8c;
    border-bottom: 2px solid rgba(139, 90, 140, 0.3);
    animation: nexus-spin 2.5s linear infinite;
}

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

/* ===============================
   Loading Text Animations
   =============================== */
.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
}

.loading-title {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.loading-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
    font-weight: 300;
}

.loading-message {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.loading-dots {
    color: #667eea;
    font-weight: bold;
    display: inline-block;
    width: 20px;
}

.loading-dots::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

/* ===============================
   Progress Bar
   =============================== */
.progress-container {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: progress-flow 2s ease-in-out infinite;
}

@keyframes progress-flow {
    0% { 
        width: 0%; 
        background-position: 0% 50%;
    }
    50% { 
        width: 70%; 
        background-position: 100% 50%;
    }
    100% { 
        width: 100%; 
        background-position: 200% 50%;
    }
}

/* ===============================
   Content Loading Overlay
   =============================== */
.content-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease-in-out;
}

.content-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===============================
   Form Loading States
   =============================== */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 1000;
}

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: btn-spin 1s linear infinite;
}

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

/* ===============================
   Page Transition Loading - REMOVED
   =============================== */
/* No automatic page transitions */

/* ===============================
   AJAX Content Loading - Smart
   =============================== */
.ajax-loading {
    position: relative;
    overflow: hidden;
}

.ajax-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    animation: ajax-shimmer 1.5s infinite;
    z-index: 1;
}

@keyframes ajax-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===============================
   Banking Operation Animations
   =============================== */
.transaction-processing {
    animation: transaction-pulse 1.5s ease-in-out infinite;
}

@keyframes transaction-pulse {
    0%, 100% { 
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        transform: scale(1);
    }
    50% { 
        background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
        transform: scale(1.02);
    }
}

/* ===============================
   Success & Error States
   =============================== */
.success-loader .nexus-logo {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: success-bounce 0.6s ease-out;
}

.error-loader .nexus-logo {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    animation: error-shake 0.6s ease-out;
}

@keyframes success-bounce {
    0% { transform: translate(-50%, -50%) scale(0.8); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes error-shake {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    25% { transform: translate(-50%, -50%) translateX(-10px); }
    75% { transform: translate(-50%, -50%) translateX(10px); }
}

/* ===============================
   Mobile Optimizations
   =============================== */
@media (max-width: 768px) {
    .nexus-loader {
        width: 80px;
        height: 80px;
    }
    
    .nexus-logo {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .nexus-ring:nth-child(1) {
        width: 80px;
        height: 80px;
    }
    
    .nexus-ring:nth-child(2) {
        width: 60px;
        height: 60px;
        top: 10px;
        left: 10px;
    }
    
    .nexus-ring:nth-child(3) {
        width: 40px;
        height: 40px;
        top: 20px;
        left: 20px;
    }
    
    .loading-title {
        font-size: 1.5rem;
    }
    
    .loading-message {
        font-size: 1rem;
    }
    
    .progress-container {
        max-width: 250px;
    }
}

/* ===============================
   Accessibility
   =============================== */
@media (prefers-reduced-motion: reduce) {
    .nexus-ring,
    .progress-bar,
    .ajax-loading::before,
    .btn-loading::after {
        animation: none;
    }
    
    .loading-dots::after {
        content: '...';
        animation: none;
    }
    
    .logo-pulse {
        animation: none;
    }
}

/* ===============================
   Success/Error Notifications
   =============================== */
.nexus-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.3s ease-out;
    max-width: 400px;
    border-left: 4px solid #667eea;
}

.nexus-notification.show {
    transform: translateX(0);
}

.nexus-notification-success {
    border-left-color: #28a745;
}

.nexus-notification-error {
    border-left-color: #dc3545;
}

.nexus-notification-content {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nexus-notification-content i {
    font-size: 18px;
    flex-shrink: 0;
}

.nexus-notification-success .nexus-notification-content i {
    color: #28a745;
}

.nexus-notification-error .nexus-notification-content i {
    color: #dc3545;
}

.nexus-notification-content span {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.nexus-notification-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.nexus-notification-close:hover {
    color: #666;
    background: #f5f5f5;
}

/* ===============================
   Dark Theme Support
   =============================== */
@media (prefers-color-scheme: dark) {
    .form-loading::after {
        background: rgba(26, 26, 46, 0.9);
    }
    
    .nexus-notification {
        background: #2d2d2d;
        color: #fff;
    }
    
    .nexus-notification-content span {
        color: #fff;
    }
}

/* ===============================
   Print Styles
   =============================== */
@media print {
    .initial-loader,
    .content-loading,
    .page-transition,
    .nexus-notification {
        display: none !important;
    }
}