/* Koru Recruitment Portal - Loading Styles */

/* Only apply loading styles when the loading container is present */
#app:has(.loading-container) {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Roboto', sans-serif;
}

/* Fallback for browsers that don't support :has() */
#app .loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Roboto', sans-serif;
    z-index: 9999;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.loading-progress {
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
}

.loading-circle {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transform-origin: center;
    animation: rotate 2s linear infinite;
}

.loading-circle-bg {
    stroke: rgba(255, 255, 255, 0.2);
}

.loading-circle-progress {
    stroke: #ffffff;
    stroke-dasharray: 251.2; /* 2 * π * 40 */
    stroke-dashoffset: 251.2;
    animation: progress 2s ease-in-out infinite;
}

.loading-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    margin: 0 4px;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0; }

.loading-progress-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.loading-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 300;
    margin-bottom: 2rem;
}

.loading-brand {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.loading-brand-icon {
    width: 48px;
    height: 48px;
    margin-right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.loading-brand-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.loading-brand-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.025em;
}

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

@keyframes progress {
    0% {
        stroke-dashoffset: 251.2;
    }
    50% {
        stroke-dashoffset: 125.6;
    }
    100% {
        stroke-dashoffset: 251.2;
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Additional modern loading states */

.loading-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    opacity: 0.7;
}

.loading-step {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 3px;
    transition: all 0.3s ease;
}

.loading-step.active {
    background-color: white;
    transform: scale(1.5);
}

/* Professional shimmer effect */
.loading-shimmer {
    position: relative;
    overflow: hidden;
}

.loading-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

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

/* Floating elements for visual interest */
.floating-element {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.floating-element:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: -1s;
}

.floating-element:nth-child(2) {
    top: 30%;
    right: 15%;
    animation-delay: -3s;
    animation-duration: 8s;
}

.floating-element:nth-child(3) {
    bottom: 25%;
    left: 20%;
    animation-delay: -5s;
    animation-duration: 7s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 0.7;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .loading-progress {
        width: 100px;
        height: 100px;
    }
    
    .loading-brand-text {
        font-size: 1.25rem;
    }
    
    .loading-progress-text {
        font-size: 1rem;
    }
}

/* Blazor Error UI Styles */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* App loading state improvements */
.loading-fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

/* Additional professional touches */
.loading-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.1;
        transform: scale(1.1);
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    #app {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
}
