/* ============================================================================
   PREMIUM TRANSITION SCREEN - Circular Progress Design
   Professional transition with zero layout shift
   ============================================================================ */

/* ============================================= */
/* TRANSITION OVERLAY                            */
/* ============================================= */

.premium-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 50% 60% at center,
        rgba(10, 10, 15, 0.92) 0%,
        rgba(10, 10, 15, 0.70) 35%,
        rgba(10, 10, 15, 0.50) 70%,
        rgba(10, 10, 15, 0.40) 100%
    );
    backdrop-filter: blur(10px) brightness(0.85);
    -webkit-backdrop-filter: blur(10px) brightness(0.85);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-transition-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ============================================= */
/* CENTER CONTENT CONTAINER                      */
/* ============================================= */

.transition-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* Reserve space for skip container to prevent layout shift */
    padding-bottom: 140px;
}

/* ============================================= */
/* CIRCULAR PROGRESS CONTAINER                   */
/* ============================================= */

.transition-circle-container {
    width: 280px;
    height: 280px;
    margin: 0 auto 56px;
    position: relative;
}

.transition-progress-ring {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.transition-progress-ring-circle {
    transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    stroke: rgba(67, 132, 255, 0.15);
    fill: transparent;
}

.transition-progress-ring-progress {
    transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    stroke: url(#progressGradient);
    fill: transparent;
    stroke-linecap: round;
    filter: drop-shadow(0 0 12px rgba(67, 132, 255, 0.5));
    animation: progressGlow 2s ease-in-out infinite;
}

/* Shimmer overlay for flowing effect */
.transition-progress-shimmer {
    transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
    mix-blend-mode: overlay;
    pointer-events: none;
}

/* Percentage display in center */
.transition-percentage-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.98);
    letter-spacing: -0.03em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.transition-percentage-symbol {
    font-size: 36px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 4px;
}

/* ============================================= */
/* TYPOGRAPHY                                    */
/* ============================================= */

.transition-title {
    font-size: 26px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.4;
    transition: opacity 0.15s ease-out;
    min-height: 1.4em;
}

/* Subtle breathing animation for status text */
.transition-title::after {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    margin-left: 8px;
    animation: statusPulse 1.5s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ============================================= */
/* ANIMATIONS                                    */
/* ============================================= */

/* Gentle pulsing glow on progress ring */
@keyframes progressGlow {
    0%, 100% {
        filter: drop-shadow(0 0 12px rgba(67, 132, 255, 0.5));
        opacity: 1;
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(123, 66, 255, 0.8));
        opacity: 0.95;
    }
}

/* Fade out animation for OLD screen */
.screen-fade-out {
    animation: fadeOutBlur 0.4s ease-out forwards;
}

@keyframes fadeOutBlur {
    0% {
        opacity: 1;
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        filter: blur(8px);
    }
}

/* ============================================= */
/* PREMIUM POLISH ENHANCEMENTS                   */
/* ============================================= */

/* Ambient background glow */
.premium-transition-overlay::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(67, 132, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(123, 66, 255, 0.06) 0%, transparent 50%);
    animation: ambientFloat 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes ambientFloat {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 1; }
    50% { transform: translate(-10px, 10px) scale(1.05); opacity: 0.8; }
}

/* Circle entry animation */
.premium-transition-overlay.active .transition-circle-container {
    animation: circleEntry 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes circleEntry {
    0% { 
        opacity: 0; 
        transform: scale(0.8); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

/* Status text smooth transition */
.transition-title {
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    min-height: 1.4em;
}

/* Subtle breathing indicator dot */
.transition-title::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    border-radius: 50%;
    margin-left: 10px;
    animation: statusPulse 1.5s ease-in-out infinite;
    vertical-align: middle;
    box-shadow: 0 0 8px rgba(67, 132, 255, 0.6);
}

@keyframes statusPulse {
    0%, 100% { 
        opacity: 0.4; 
        transform: scale(1); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.3); 
    }
}

/* Enhanced progress ring glow */
.transition-progress-ring-progress {
    filter: drop-shadow(0 0 12px rgba(67, 132, 255, 0.5))
            drop-shadow(0 0 24px rgba(123, 66, 255, 0.3));
}

/* Percentage number subtle animation */
.transition-percentage-center {
    animation: percentagePulse 3s ease-in-out infinite;
}

@keyframes percentagePulse {
    0%, 100% { 
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                     0 0 30px rgba(67, 132, 255, 0.1);
    }
    50% { 
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                     0 0 40px rgba(123, 66, 255, 0.2);
    }
}

/* ============================================= */
/* RESPONSIVE DESIGN                             */
/* ============================================= */

@media (max-width: 768px) {
    .transition-circle-container {
        width: 220px;
        height: 220px;
        margin: 0 auto 40px;
    }
    
    .transition-percentage-center {
        font-size: 56px;
    }
    
    .transition-percentage-symbol {
        font-size: 28px;
    }
    
    .transition-title {
        font-size: 26px;
    }
    
    .transition-title {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .transition-circle-container {
        width: 180px;
        height: 180px;
    }
    
    .transition-percentage-center {
        font-size: 48px;
    }
    
    .transition-title {
        font-size: 22px;
    }
    
    .transition-title {
        font-size: 20px;
    }
}

/* ============================================= */
/* ACCESSIBILITY                                 */
/* ============================================= */

@media (prefers-reduced-motion: reduce) {
    .premium-transition-overlay,
    .transition-progress-ring-progress,
    .screen-fade-out,
    .transition-status-text {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================= */
/* LAYOUT SHIFT PREVENTION                       */
/* ============================================= */

/* Prevent body scrollbar from causing layout shifts */
html {
    overflow-y: scroll;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

/* Ensure app screens don't cause layout shifts */
.app-screen {
    width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
    /* Remove any auto-fade animations - JS handles transitions */
    opacity: 1 !important;
    transition: none !important;
}

/* ============================================= */
/* LONG WAIT MESSAGE & SKIP BUTTON               */
/* ============================================= */

.transition-long-wait-container {
    margin-top: 40px;
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    animation: fadeSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    max-width: 440px;
}

@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.transition-long-wait-message {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-align: center;
}

.transition-skip-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.15), rgba(123, 66, 255, 0.15));
    border: 1px solid rgba(67, 132, 255, 0.4);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.transition-skip-button:hover {
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.25), rgba(123, 66, 255, 0.25));
    border-color: rgba(67, 132, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(67, 132, 255, 0.2);
}

.transition-skip-button:active {
    transform: translateY(0);
}

.transition-skip-button svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.transition-skip-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    margin: 12px 0 0 0;
    text-align: center;
}

/* ============================================= */
/* SUBTITLE / STATS LINE                         */
/* ============================================= */

.transition-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    margin: 12px 0 0 0;
    letter-spacing: 0.01em;
    min-height: 1.3em;
    transition: opacity 0.2s ease-out;
}

/* ============================================= */
/* INTELLIGENT SKIP OPTION                       */
/* ============================================= */

.transition-skip-container {
    /* Absolute positioning to prevent layout shift when appearing */
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
    box-sizing: border-box;
    text-align: center;
    animation: skipFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes skipFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.transition-skip-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    margin: 0 auto 24px auto;
}

.transition-skip-status {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-align: center;
}

.transition-skip-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #4384ff 0%, #7b42ff 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.transition-skip-button:hover {
    background: linear-gradient(135deg, #5a9fff 0%, #9b6eff 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(67, 132, 255, 0.3);
}

.transition-skip-button:active {
    transform: translateY(0);
}

.transition-skip-button svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.transition-skip-button:hover svg {
    transform: translateX(3px);
    opacity: 1;
}

/* High progress state - slightly brighter gradient */
.transition-skip-container.high-progress .transition-skip-button {
    background: linear-gradient(135deg, #4a8fff 0%, #8652ff 100%);
    box-shadow: 0 4px 16px rgba(67, 132, 255, 0.25);
}

.transition-skip-container.high-progress .transition-skip-button:hover {
    background: linear-gradient(135deg, #5a9fff 0%, #9b6eff 100%);
    box-shadow: 0 8px 28px rgba(67, 132, 255, 0.35);
}