:root {
    /* Основные цвета приложения - принудительно светлая тема */
    --tg-theme-bg-color: #ffffff;
    --tg-theme-text-color: #000000;
    --tg-theme-hint-color: #999999;
    --tg-theme-link-color: #2481cc;
    --tg-theme-button-color: #1E88E5;
    --tg-theme-button-text-color: #ffffff;
    
    /* Дополнительные цвета */
    --primary-color: #1E88E5;
    --secondary-color: #808080;
    --success-color: #4CAF50;
    --danger-color: #f35e31;
    --warning-color: #FFC107;
    --light-gray: #f5f5f5;
    --border-color: #e0e0e0;
    
    /* Метрики */
    --star-inactive: #CCCCCC;
    --star-active: #FFD700;
    
    /* Размеры и отступы */
    --container-padding: 15px;
    --border-radius: 10px;
    --input-height: 48px;
    --button-height: 50px;
}

/* Адаптация темы к Telegram */
.theme-light {
    --bg-color: var(--tg-theme-bg-color, #ffffff);
    --text-color: var(--tg-theme-text-color, #000000);
    --hint-color: var(--tg-theme-hint-color, #999999);
    --link-color: var(--tg-theme-link-color, #2481cc);
    --button-color: var(--tg-theme-button-color, #50a8eb);
    --button-text-color: var(--tg-theme-button-text-color, #ffffff);
}

.theme-dark {
    --bg-color: var(--tg-theme-bg-color, #212121);
    --text-color: var(--tg-theme-text-color, #ffffff);
    --hint-color: var(--tg-theme-hint-color, #aaaaaa);
    --link-color: var(--tg-theme-link-color, #64b5f6);
    --button-color: var(--tg-theme-button-color, #50a8eb);
    --button-text-color: var(--tg-theme-button-text-color, #ffffff);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Базовые настройки для мобильных устройств */
html, body {
    width: 100vw;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    font-size: 16px;
    width: 100%;
    max-width: 100%;
}

/* Контейнер приложения */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: var(--container-padding);
    padding-bottom: env(safe-area-inset-bottom, 15px);
    padding-top: env(safe-area-inset-top, 15px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Форма ввода данных пользователя */
.user-info-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: var(--container-padding);
    margin-top: 20px;
    animation: fadeIn 0.3s ease-out;
}

/* Стили для группы ввода */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Стили для контейнера подсказки */
.input-hint-container {
    display: block;
    width: 100%;
    padding: 3px 5px;
    margin-top: 2px;
}

/* Стили для подсказки */
.input-hint {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    display: inline-block;
}

.user-info-form h2 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 22px;
    font-weight: 600;
}

.user-info-form input {
    height: var(--input-height);
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Оптимизация для ввода телефона */
input[type="tel"] {
    text-align: left;
    letter-spacing: 1px;
    font-size: 18px;
    padding-left: 15px; /* Добавляем отступ слева, как у поля ввода имени */
}

/* Кнопки */
.primary-button, .secondary-button {
    border: none;
    padding: 0 20px;
    height: var(--button-height);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(30, 136, 229, 0.3);
}

.secondary-button {
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.primary-button:active, .secondary-button:active {
    transform: scale(0.98);
}

/* Информационный баннер */
.info-banner {
    background-color: rgba(30, 136, 229, 0.1);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(30, 136, 229, 0.3);
    animation: fadeIn 0.5s;
    text-align: center;
}

/* Выбор гида */
.guide-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    animation: fadeIn 0.3s ease-out;
}

.guide-selection h2 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 22px;
    font-weight: 600;
}

.guides-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 15px 0;
}

.guide-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.guide-item:active {
    transform: scale(0.97);
    background-color: rgba(255, 255, 255, 0.9);
}

.guide-item img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.guide-item .guide-name {
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    color: var(--text-color);
}

/* Информация о маршруте и гиде */
.survey-info {
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px; /* Увеличенный размер шрифта */
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 12px; /* Увеличенный размер шрифта */
}

.info-value {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 12px; /* Увеличенный размер шрифта */
}

/* Контейнер метрик */
.metrics-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

/* Метрики с звездами */
.metric-item {
    text-align: center;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out;
}

.metric-title {
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
    font-size: 16px;
    color: #000000;
    text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.5);
}

.metric-description {
    font-size: 16px;
    color: #333333;
    margin-bottom: 10px;
    text-align: center;
}

.rating-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 30px;
    margin-top: 10px;
}

.star {
    color: var(--star-inactive);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.star.selected {
    color: var(--star-active);
}

.star:active {
    transform: scale(1.1);
}

/* Контейнер для кнопок действий */
.actions-container {
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

/* Экран завершения */
.completion-screen {
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    animation: fadeIn 0.5s ease-out;
}

.completion-icon {
    font-size: 70px;
    color: var(--success-color);
    margin: 20px 0;
    animation: pulse 1.5s infinite;
}

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

.completion-screen h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.completion-screen p {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-color);
}

.gift-info {
    margin-top: 30px;
    padding: 15px;
    background-color: #FFF8E1;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    width: 100%;
    color: #8B4513;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Стили для зеленого окна (средний балл > 3) */
.gift-info-success {
    background-color: #71c574;
    color: white;
}

/* Стили для оранжевого окна (средний балл < 3) */
.gift-info-danger {
    background-color: #f35e31; /* Яркий оранжевый цвет */
    color: white;
}

/* Стиль для блока с отзывами */
.review-platforms-block {
    background-color: #4CAF50;
    color: white;
    padding: 15px 5px;
    margin-top: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Стиль для контейнера кнопок */
.review-buttons-container {
    display: flex;
    flex-wrap: nowrap; /* Запрещаем перенос на новую строку */
    justify-content: space-around;
    gap: 5px;
    margin-bottom: 12px;
    width: 100%;
}

/* Стиль для отдельных кнопок с платформами */
.review-platform-button {
    background-color: white;
    color: #4CAF50;
    border: none;
    border-radius: 20px;
    padding: 6px 5px;
    font-weight: bold;
    font-size: 8px; /* Уменьшен размер шрифта с 12px до 10px */
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    margin: 0 2px;
    letter-spacing: -0.3px; /* Добавлен небольшой отрицательный кернинг */
}

.review-platform-button:hover {
    background-color: #e7f6e7;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Стиль для текста в блоке отзывов */
.review-text {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.4;
    padding: 0 5px;
    color: white;
    font-weight: 500;
}

/* Медиа-запрос для очень маленьких экранов */
@media screen and (max-width: 350px) {
    .review-platform-button {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 70px;
    }
    
    .review-text {
        font-size: 13px;
    }
}

/* Языковые кнопки */
.language-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    position: fixed;
    bottom: 15px;
    left: 0;
    right: 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10;
}

.lang-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn:active {
    transform: scale(0.9);
}

.lang-btn.active {
    background-color: rgba(30, 136, 229, 0.2);
    border-radius: 50%;
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(30, 136, 229, 0.5);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    width: 85%;
    max-width: 350px;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    padding: 20px;
    text-align: center;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 20px;
}

.modal-content p {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 16px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

/* Индикатор загрузки */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(30, 136, 229, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Медиа-запросы для различных устройств */

/* Очень маленькие экраны */
@media screen and (max-width: 320px) {
    .app-container {
        padding: 10px;
    }
    
    .guides-grid {
        grid-template-columns: repeat(2, 1fr); /* Сохраняем два столбца даже на маленьких экранах */
        gap: 8px;
    }
    
    .guide-item img {
        width: 60px;
        height: 60px;
    }
    
    .rating-stars {
        font-size: 26px;
        gap: 5px;
    }
    
    .user-info-form h2, .guide-selection h2, .completion-screen h2 {
        font-size: 18px;
    }
}

/* Маленькие экраны */
@media screen and (min-width: 321px) and (max-width: 375px) {
    .app-container {
        padding: 12px;
    }
    
    .guides-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Средние экраны */
@media screen and (min-width: 376px) and (max-width: 767px) {
    .app-container {
        padding: var(--container-padding);
    }
    
    .guides-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Планшеты */
@media screen and (min-width: 768px) {
    .app-container {
        max-width: 450px;
        margin: 0 auto;
    }
    
    .guides-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .guide-item img {
        width: 80px;
        height: 80px;
    }
    
    .rating-stars {
        font-size: 36px;
    }
}

/* Специфичные стили для iOS */
.ios .primary-button, .ios .secondary-button {
    border-radius: 12px;
}

.ios input {
    border-radius: 10px;
}

/* Специфичные стили для Android */
.android .rating-stars {
    margin-top: -30px; /* Отрицательный отступ для Android */
}

/* Специфичные стили для Android 14 */
.android-14 .app-container {
    padding-top: 10px;
    padding-bottom: 10px;
}

.phone-input-wrapper {
    position: relative;
    display: inline-block;
    width: 70%;
}

#phone-container input {
    width: 40%;
    padding: 12px;
    border: 2px solid #e73c22; /* Красная рамка */
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 500;
    text-align: center;
    color: #000000; /* Черный цвет текста */
    background-color: #ffffff; /* Белый фон */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Стили для плейсхолдера */
#phone-container input::placeholder {
    color: #999999;
    opacity: 0.8;
}

/* Кнопки действий */
#actions-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* Центрируем кнопку по горизонтали */
    justify-content: center; /* Центрируем по вертикали */
    gap: 8px;
    margin-top: 20px; /* Увеличиваем отступ сверху */
    margin-bottom: 25px; /* Увеличиваем отступ снизу */
    flex-grow: 0;
    width: 100%; /* Занимаем всю ширину */
    text-align: center; /* Текст по центру */
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #4CAF50; /* Зеленая кнопка */
    color: white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25); /* Усиливаем тень */
    font-weight: bold;
    border: 2px solid #3d9140; /* Добавляем границу */
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-danger {
    background-color: #f35e31; /* Оранжевая кнопка */
    color: white;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Специфичный стиль для кнопки Завершить опрос */
#finish-survey {
    font-size: 16px !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    background-color: #FF5722 !important; /* Более яркий оранжевый */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
    border: none !important;
    position: relative !important;
    z-index: 5 !important;
    margin-right: 12px !important; /* Отступ справа */
    display: inline-block !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.btn-large {
    padding: 16px 20px; /* Увеличиваем паддинги */
    font-size: 18px; /* Увеличиваем размер шрифта */
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    width: 70%; /* Уменьшаем ширину до 80%, чтобы не перекрывалась информацией о зарядке */
    max-width: 400px; /* Максимальная ширина кнопки */
    border-radius: 8px; /* Увеличиваем скругление углов */
    margin: 0 auto; /* Центрируем кнопку */
    display: block; /* Делаем блочным элементом */
}

.btn-large:hover {
    transform: translateY(-3px); /* Увеличиваем эффект поднятия */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Усиливаем тень */
    background-color: #45a049; /* Немного темнее при наведении */
}

/* Специфичный стиль для кнопки голосования */
#vote-btn {
    width: 70% !important; /* Принудительно устанавливаем ширину */
    max-width: 350px !important; /* Максимальная ширина */
    margin: 0 auto !important; /* Центрируем по горизонтали */
    display: block !important; /* Делаем блочным элементом */
    position: relative; /* Добавляем позиционирование */
    z-index: 5; /* Устанавливаем z-index */
    font-size: 18px !important; /* Увеличиваем размер шрифта */
    padding: 18px 24px !important; /* Увеличиваем паддинги */
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Языковые кнопки и кнопка пропуска */
#language-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px; /* Увеличиваем отступ сверху */
    /* Изменяем позиционирование, чтобы не накладывалось на клавиатуру */
    position: relative; /* Меняем с sticky на relative */
    background-color: var(--bg-color);
    z-index: 10;
    /* Добавляем тень для визуального разделения */
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

.lang-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: transform 0.2s;
}

.lang-btn:hover, .lang-btn.active {
    transform: scale(1.2);
}

.language-buttons {
    display: flex;
    gap: 16px;
}

#language-selector #skip-btn {
    background-color: #838383;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 8px;
    white-space: nowrap;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 400px;
}

.modal-content {
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 5;
}

/* Адаптивность */
@media (max-width: 480px) {
    .star {
        font-size: 28px;
    }
}

/* Планшетная адаптивность */
@media (min-width: 480px) and (max-width: 1024px) {
    main {
        padding: 16px 8px;
    }
    
    .info-banner {
        margin: 10px 8px;
    }
    
    .star {
        font-size: 36px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fadeIn {
    animation: fadeIn 0.3s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shake 0.3s;
}
