/* mobile-fixes.css - Mobile Telegram WebApp Compatibility */

/* Базовые mobile fixes */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#root {
    min-height: 100vh;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Фикс для iOS safe areas */
.app {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Отключаем выделение текста на mobile */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Разрешаем выделение для инпутов */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Улучшенная обработка touch событий */
button, .premium-btn, .option-btn {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Фикс для iOS zoom при фокусе на input */
input, select, textarea {
    font-size: 16px !important;
    transform: translateZ(0);
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

/* Фикс для Android keyboard issues */
.screen {
    position: relative;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Telegram WebApp specific fixes */
body.telegram-webapp {
    background: var(--dark-gradient) !important;
    margin: 0;
    padding: 0;
}
/* Blueprint v1.2 light theme overrides: force light background in Mini App */
body.telegram-webapp[data-style="blueprint-v1"] {
    background: var(--bg) !important;
    color: var(--fg) !important;
}

/* Фикс для viewport height на mobile */
@supports (-webkit-touch-callout: none) {
    .screen {
        min-height: -webkit-fill-available;
    }
}

/* Улучшенная обработка scroll на iOS */
.scrollable {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

/* Фикс для modal на mobile */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    -webkit-overflow-scrolling: touch;
}

/* Telegram WebApp header fix */
.progress-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    /* Фикс для notch на iPhone */
    padding-top: max(15px, env(safe-area-inset-top));
}
[data-style="blueprint-v1"] .progress-wrapper {
    background: transparent !important;
    backdrop-filter: none !important;
    border-bottom: none !important;
}

/* Responsive font sizes */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .premium-btn {
        font-size: 16px !important;
        padding: 16px 20px !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 320px) {
    .container {
        padding: 10px !important;
    }
    
    .hero-title {
        font-size: 1.5rem !important;
    }
}

/* Landscape orientation на mobile */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        padding: 20px 0 !important;
    }
    
    .hero-title {
        font-size: 1.8rem !important;
    }
}

/* Фикс для Android Chrome address bar */
@media screen and (max-width: 768px) {
    .screen {
        min-height: calc(100vh - 56px);
        min-height: calc(100dvh - 56px);
    }
}

/* Telegram WebApp theme integration */
.telegram-theme-dark {
    --tg-theme-bg-color: #0f0c29;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: rgba(255, 255, 255, 0.6);
    --tg-theme-link-color: #FFD700;
    --tg-theme-button-color: #667eea;
    --tg-theme-button-text-color: #ffffff;
}

/* Loading state для mobile */
.mobile-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--dark-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10000;
}
[data-style="blueprint-v1"] .mobile-loading { background: var(--bg) !important; color: var(--fg) !important; }

.mobile-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-top: 3px solid #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error state для mobile */
.mobile-error {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--dark-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10000;
    padding: 20px;
    text-align: center;
}
[data-style="blueprint-v1"] .mobile-error { background: var(--bg) !important; color: var(--fg) !important; }

.mobile-error h3 {
    color: #ff6b6b;
    margin-bottom: 10px;
}

.mobile-error p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.mobile-error button {
    background: var(--gold-gradient);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Strengthen premium gold buttons (global) */
.premium-btn.gold,
button.premium-btn.gold,
.modal .premium-btn.gold {
    background: var(--gold-gradient) !important;
    color: #000 !important;
    box-shadow: 0 6px 18px rgba(255, 215, 0, 0.35) !important;
    border: 1px solid rgba(255, 215, 0, 0.5) !important;
}

.premium-btn.gold:active,
.premium-btn.gold:hover {
    filter: brightness(1.05);
}

/* Debug panel для mobile */
.mobile-debug {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 9999;
    max-width: 200px;
    word-wrap: break-word;
}

/* Скрываем debug на production */
.mobile-debug.hidden {
    display: none;
} 