* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent; /* Убрать подсветку при тапе */
    -webkit-text-size-adjust: 100%; /* Предотвратить авто-масштабирование */
}

body {
    background-image: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    color: #333;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0px 10px 0px 10px;
}

.container_ {
    width: 100%;
    max-width: 900px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 95%;
    max-height: 95dvh;
}

header {
    background-image: linear-gradient(to right, #1a2a6c, #3a7bd5);
    color: white;
    padding: 15px 25px 5px 15px;
    text-align: center;
    position: relative;
}

h1 {
    font-size: 26px;
    font-weight: 500;
    margin-bottom: 15px;
    line-height: 1.1!important;
    text-align: right;
    padding: 0px;
    margin: 0px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.doctor-icon {
    position: absolute;
    top: 5px;
    right: 20px;
    font-size: 40px;
}

/* Стили для иконки профиля в левом верхнем углу */
.profile-icon {
    position: absolute;
    top: 15px;
    left: 20px;
    z-index: 1001;
    transition: transform 0.3s ease;
}

.profile-icon:hover {
    transform: scale(1.1);
}

.profile-icon img {
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.3s ease;
}

.profile-icon:hover img {
    border-color: rgba(255, 255, 255, 0.6);
}

.chat-container {
    flex: 1;
    padding: 25px;
    overflow-y: scroll; /* Лучшая поддержка в WebView */
    -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="white"/><path d="M0,50 Q25,40 50,50 T100,50" fill="none" stroke="%23e0f7fa" stroke-width="2"/></svg>');
    background-size: 300px;
}

.message {
    font-size: 1.2rem;
    max-width: 80%;
    padding: 15px;
    border-radius: 15px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bot-message {
    background-color: #e3f2fd;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.user-message {
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    color: white;
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.result-message {
    background-color: #e3f2fd;
    min-width: 80%;
}

.option-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1rem;
    font-weight: 500;
}

.option-btn:hover {
    background-color: #0d8aee;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.option-btn.selected {
    background: #764ba2;
    color: white;
    border-color: #764ba2;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}


.send-button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.input-container {
    padding: 20px;
    background-color: #f5f5f5;
    display: flex;
    gap: 10px;
    border-top: 1px solid #e0e0e0;
}

input, textarea {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #bbdefb;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus {
    border-color: #2196f3;
}




button {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

button:hover {
    background-color: #0d8aee;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* ===================================   */

.btn_ {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    width: 100%;
}

.btn-primary_ {
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary_:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary_ {
    background-image: linear-gradient(135deg, #e1e4e8 0%, #939ca3 100%);
    color: #4a5568;
}

.btn-secondary_:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.btn-success_ {
    background-image: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success_:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn_:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===================================   */

/* Прогресс бар */
.progress-section {

}

.progress-header h3 {

}

.progress-bar {
    /*width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;*/

    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {

}


.conclusion {
    background-color: #e8f5e9;
    border-left: 5px solid #4caf50;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    animation: slideIn 0.5s ease-out;
}

.conclusion h3 {
    color: #2e7d32;
    margin-bottom: 15px;
}

.recommendation {
    background-color: #fffde7;
    border-left: 5px solid #ffc107;
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
}

.recommendation h3 {
    color: #f57f17;
    margin-bottom: 15px;
}




@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


/* для мобильных устройств */
@media (max-width: 768px) {
    .container_ {
        height: 95%;
    }

    .message {
        max-width: 90%;
        font-size: 1.2rem;
    }

    .options-container {
        flex-direction: column;
    }

    .input-container {
        padding: 12px;
    }
    input, button {
        padding: 10px 15px !important;
    }

    #user-input, #messageInput {
        width: 100%;
    }

    .option-image {
        max-width: 100%;
        height: auto;
    }

    .progress-bar {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* Стили для иконки профиля на мобильных */
    .profile-icon {
        top: 10px;
        left: 15px;
    }

    .profile-icon img {
        width: 50px !important;
        height: 50px !important;
    }

    .profile-menu {
        top: 70px;
        left: 15px;
        min-width: 180px;
    }

    /* Уменьшаем заголовки на мобильных */
    h1 {
        font-size: 20px !important;
    }
}


/* Загрузка */
.loading-spinner {
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Стили для изображений в вариантах ответов */
.option-with-image {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.option-text {
    flex: 1;
}

.option-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: border-color 0.3s;
}

.option-image:hover {
    border-color: #007bff;
}

/* ответы */
.answers-section {
    margin-bottom: 0px;
}

.answers-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.answers-list {
    display: grid;
    gap: 15px;
}

.answer-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.answer-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.answer-question {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.answer-text {
    color: #718096;
    margin-bottom: 2px;
}

.answer-time {
    font-size: 0.9rem;
    color: #a0aec0;
    font-style: italic;
}


/* Модальное окно для изображений */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-width: 90%;
    max-height: 90%;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 1);
}

.modal-nav.prev {
    left: 20px;
}

.modal-nav.next {
    right: 20px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 1001;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.9);
    color: black;
    border-color: #007bff;
}

.image-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

/* Стили для кнопки "Домой" */
.home-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.home-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Модальное окно для продолжения теста */
.continue-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.continue-modal .modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    text-align: center;
}

.continue-modal h3 {
    margin-bottom: 20px;
    color: #4a5568;
}

.continue-modal p {
    margin-bottom: 25px;
    color: #718096;
}

.continue-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}



/* Форма */
.form-section h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}



/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #4a5568;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #718096;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}



/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-section, .progress-section, .question-section, .result-section, .history-section {
    animation: fadeIn 0.5s ease;
}

/* Фокус */
.option-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Стили для модального окна регистрации */
.registration-info {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    text-align: center;
}

.registration-info p {
    margin-bottom: 15px;
    color: #4a5568;
}

.registration-info .btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.registration-info .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#userChatId {
    font-family: 'Courier New', monospace;
    background: #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    color: #2d3748;
}

.modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay .modal-content {
    animation: fadeIn 0.3s ease;
}

/* Стили для выпадающего меню профиля */
.profile-menu {
    position: absolute;
    top: 80px;
    left: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 200px;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-menu-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 500;
    color: #333;
}

.profile-menu-item:last-child {
    border-bottom: none;
}

.profile-menu-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.profile-menu-item:active {
    background-color: #e9ecef;
}

/* Позиционирование для контейнера с иконкой */
.col-4 {
    position: relative;
}

