/**
 * FLEX Loading Page Styles - Gradient Glass Edition
 * Преміальний дизайн з gradient glass ефектами
 * @version 3.0.0
 */
/* ТИМЧАСОВО ВІДКЛЮЧАЄМО DARK MODE */
:root {
    --tg-theme-bg-color: #ffffff !important;
    --tg-theme-text-color: #1a1a1a !important;
    --tg-theme-hint-color: #666666 !important;
    --tg-theme-link-color: #9333EA !important;
    --tg-theme-button-color: #9333EA !important;
    --tg-theme-button-text-color: #ffffff !important;
    --tg-theme-secondary-bg-color: #f8f8f8 !important;
}

body {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
}

.app-container {
    background: #ffffff !important;
}
/* ===== CSS Variables ===== */
:root {
    /* Background Colors */
    --bg-primary: #F2F2F7;
    --bg-secondary: #FFFFFF;

    /* Text Colors */
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-tertiary: #666666;
    --text-muted: #999999;
    --text-hint: #8E8E93;

    /* Primary Gradient Colors */
    --primary-color: #9333EA;
    --primary-hover: #8B31E3;
    --primary-active: #7C3AED;
    --primary-light: rgba(147, 51, 234, 0.1);
    --primary-glow: rgba(147, 51, 234, 0.4);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: 20px;

    /* Status Colors */
    --success-color: #22C55E;
    --error-color: #DC3545;
    --warning-color: #FFB800;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 30px rgba(147, 51, 234, 0.15);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 36px;

    /* Animations */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Safe Areas */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ===== App Container ===== */
.loading-app {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    padding-top: calc(var(--spacing-md) + var(--safe-area-top));
    padding-bottom: calc(var(--spacing-md) + var(--safe-area-bottom));
    z-index: 1;
}

/* ===== Screen System ===== */
.screen {
    width: 100%;
    height: 100vh;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity var(--transition-normal);
    opacity: 0;
    overflow: hidden;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ===== Initial Loading ===== */
.initial-loader {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(147, 51, 234, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== Glass Card Style ===== */
.glass-card {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(255, 255, 255, 0.8) 100%);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: 40px;
    box-shadow: var(--shadow-glass);
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.glass-card::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: shine 4s ease-in-out infinite;
    z-index: 1;
}

@keyframes shine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.glass-card > * {
    position: relative;
    z-index: 2;
}

/* ===== Typography ===== */
.logo {
    font-size: 52px;
    font-weight: 700;
    background: linear-gradient(135deg, #7C3AED, #9333EA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -2px;
}

.title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.2;
}

.subtitle {
    font-size: 14px;
    color: var(--text-hint);
    margin-bottom: 30px;
    font-weight: 500;
    line-height: 1.5;
}

/* ===== Buttons - Gradient Style ===== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    user-select: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #7C3AED, #9333EA);
    color: white;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(147, 51, 234, 0.5);
}

.btn-secondary {
    background: rgba(147, 51, 234, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(147, 51, 234, 0.2);
}

.btn-secondary:hover {
    background: rgba(147, 51, 234, 0.15);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Progress Bar - Gradient Style ===== */
.progress-container {
    width: 100%;
    max-width: 280px;
    margin: 30px auto;
}

.progress-percentage {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7C3AED, #9333EA);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: progressShine 1.5s ease-in-out infinite;
}

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

/* ===== Loading Dots ===== */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: dotPulse 1.5s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.4);
        opacity: 1;
    }
}

/* ===== Checkbox - Gradient Style ===== */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 24px 0;
    padding: 16px;
    background: rgba(147, 51, 234, 0.04);
    border: 1px solid rgba(147, 51, 234, 0.1);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.checkbox-container:hover {
    background: rgba(147, 51, 234, 0.06);
    border-color: rgba(147, 51, 234, 0.2);
}

.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #6c757d;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
    background: white;
}

.checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* ===== Success Icon ===== */
.success-icon {
    width: 60px;
    height: 60px;
    color: var(--success-color);
    margin: 30px auto;
    animation: checkmarkPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% { transform: scale(0) rotate(-45deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 40px auto;
    border: 3px solid #F5F5F5;
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

/* ===== SVG Icons ===== */
.icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== Toast Container (Hidden) ===== */
#toast-container {
    display: none !important; /* Hide all toasts */
}

/* ===== Duration Labels ===== */
.duration-label {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

/* ===== Animations ===== */
@keyframes progressAnimation {
    from { width: 0%; }
    to { width: 75%; }
}

@keyframes progressAnimationFull {
    from { width: 0%; }
    to { width: 100%; }
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {
    .glass-card {
        padding: 30px;
        margin: 20px;
        max-width: calc(100% - 40px);
    }

    .logo {
        font-size: 40px;
    }

    .title {
        font-size: 20px;
    }

    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }

    .progress-container {
        max-width: 240px;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Focus States ===== */
.btn:focus-visible,
.checkbox:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}