/* Combined Her OS1 + Skeleton Screen Loading Animation */

#ai-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #667eea;
    z-index: 10000;
    display: none;
}

#ai-loading-overlay.active {
    display: block;
}

/* Three.js Canvas Container */
#loading-canvas-wrap {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
}

#loading-canvas-wrap canvas {
    position: absolute;
    left: 50%;
    top: 40%;
    width: 500px;
    height: 500px;
    margin: -250px 0 0 -250px;
}

/* Status Text */
.loading-status-container {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 15%;
    text-align: center;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 2;
}

.loading-main-text {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    animation: fadeInUp 0.6s ease-out;
}

.loading-sub-text {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
    animation: fadeInUp 0.8s ease-out;
}

/* Profile Skeleton Preview */
.skeleton-preview {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(10px);
    z-index: 3;
    animation: fadeInScale 0.6s ease-out;
}

.skeleton-preview:empty {
    height: 400px;
    position: relative;
    overflow: hidden;

    background-image:
        /* Profile picture circle - pulsing */
        radial-gradient(circle 60px at 50% 80px, rgba(255, 255, 255, 0.35) 99%, transparent 0),
        /* Shimmer effect - faster sweep */
        linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 80%),
        /* Name line - stronger */
        linear-gradient(rgba(255, 255, 255, 0.35) 20px, transparent 0),
        /* Title line */
        linear-gradient(rgba(255, 255, 255, 0.25) 16px, transparent 0),
        /* Bio lines */
        linear-gradient(rgba(255, 255, 255, 0.25) 12px, transparent 0),
        linear-gradient(rgba(255, 255, 255, 0.25) 12px, transparent 0),
        linear-gradient(rgba(255, 255, 255, 0.25) 12px, transparent 0),
        /* Section headers */
        linear-gradient(rgba(255, 255, 255, 0.35) 16px, transparent 0),
        linear-gradient(rgba(255, 255, 255, 0.35) 16px, transparent 0),
        /* Content blocks */
        linear-gradient(rgba(255, 255, 255, 0.25) 40px, transparent 0),
        linear-gradient(rgba(255, 255, 255, 0.25) 40px, transparent 0);

    background-repeat: no-repeat;

    background-size:
        120px 120px, /* circle */
        100% 400px, /* shimmer */
        200px 20px, /* name */
        150px 16px, /* title */
        250px 12px, /* bio line 1 */
        240px 12px, /* bio line 2 */
        200px 12px, /* bio line 3 */
        120px 16px, /* section 1 header */
        120px 16px, /* section 2 header */
        260px 40px, /* content block 1 */
        260px 40px; /* content block 2 */

    background-position:
        50% 80px, /* circle */
        0 0, /* shimmer */
        50% 170px, /* name - centered */
        50% 200px, /* title - centered */
        30px 240px, /* bio line 1 */
        30px 260px, /* bio line 2 */
        30px 280px, /* bio line 3 */
        30px 310px, /* section 1 header */
        30px 450px, /* section 2 header */
        30px 340px, /* content block 1 */
        30px 390px; /* content block 2 */

    animation: shimmer 1.2s ease-in-out infinite, skeletonPulse 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position:
            50% 80px,
            -100% 0, /* start shimmer from left */
            50% 170px,
            50% 200px,
            30px 240px,
            30px 260px,
            30px 280px,
            30px 310px,
            30px 450px,
            30px 340px,
            30px 390px;
    }
    100% {
        background-position:
            50% 80px,
            200% 0, /* move shimmer past right edge */
            50% 170px,
            50% 200px,
            30px 240px,
            30px 260px,
            30px 280px,
            30px 310px,
            30px 450px,
            30px 340px,
            30px 390px;
    }
}

@keyframes skeletonPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Step Indicators */
.loading-steps-list {
    position: absolute;
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    max-width: 280px;
    z-index: 3;
}

.loading-step-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border-left: 3px solid transparent;
    opacity: 0.4;
    transition: all 0.4s ease;
}

.loading-step-item.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    border-left-color: white;
    transform: translateX(5px);
}

.loading-step-item.completed {
    opacity: 0.7;
    border-left-color: #4ade80;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.loading-step-item.active .step-number {
    background: white;
    color: #667eea;
    animation: pulse-scale 1s infinite;
}

.loading-step-item.completed .step-number {
    background: #4ade80;
    color: white;
}

.step-label {
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
}

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

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

/* Responsive */
@media (max-width: 1024px) {
    .skeleton-preview {
        display: none;
    }

    .loading-steps-list {
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90%;
    }

    #loading-canvas-wrap canvas {
        width: 300px;
        height: 300px;
        margin: -150px 0 0 -150px;
        top: 30%;
    }
}

@media (max-width: 768px) {
    #loading-canvas-wrap canvas {
        width: 250px;
        height: 250px;
        margin: -125px 0 0 -125px;
    }

    .loading-main-text {
        font-size: 1.5rem;
    }

    .loading-sub-text {
        font-size: 1rem;
    }
}
