/* ========== СТИЛИ РЕГИСТРАЦИИ ========== */

/* Скрываем чат на экранах регистрации */
#welcomeScreen.active ~ .chat-container,
#welcomeScreen.active ~ .chat-header,
#welcomeScreen.active ~ .app-message,
#registrationScreen.active ~ .chat-container,
#registrationScreen.active ~ .chat-header,
#registrationScreen.active ~ .app-message,
#guestScreen.active ~ .chat-container,
#guestScreen.active ~ .chat-header,
#guestScreen.active ~ .app-message {
    display: none !important;
}

/* Централизация всех экранов регистрации */
#welcomeScreen,
#registrationScreen,
#guestScreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    overflow: hidden !important;
}

/* Контейнер приветствия */
.welcome-content {
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    overflow: hidden !important;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.welcome-logo {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px 20px;
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    border-radius: 18px;
    border: 1px solid #667eea30;
    max-width: 350px;
    width: 100%;
    box-sizing: border-box;
}

.logo-emoji {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounce 2s infinite;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    color: #667eea;
    margin-bottom: 5px;
}

.logo-subtitle {
    font-size: 14px;
    color: #666;
    font-weight: 300;
}

/* Базовый контейнер кнопок (для других шагов) */
.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
    width: 100%;
    box-sizing: border-box;
}

/* Контейнер регистрации */
.registration-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #f0f2f5 0%, #e6e9f0 100%);
    overflow: hidden !important;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Верхнее уведомление */
.registration-notification {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 14px;
    min-height: 24px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.2);
    animation: slideDown 0.3s ease;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
}

/* Контент регистрации */
.registration-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 400px;
    width: 100%;
    overflow: hidden !important;
    box-sizing: border-box;
}

/* Шаг регистрации */
.registration-step {
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease;
    overflow: hidden !important;
    box-sizing: border-box;
}

.step-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Кнопка выпадающего списка */
.dropdown-btn {
    width: 100%;
    padding: 16px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    margin-bottom: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.dropdown-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.dropdown-btn:active {
    transform: translateY(0);
}

.dropdown-btn:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    border-color: #ddd;
}

.dropdown-btn:disabled:hover {
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-color: #ddd;
}

.dropdown-placeholder {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
    padding-right: 10px;
    box-sizing: border-box;
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.dropdown-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Выпадающий список */
.dropdown-list {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    background: white;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    margin-top: -5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

.dropdown-list.active {
    max-height: 250px;
    opacity: 1;
    overflow-y: auto;
}

.dropdown-item {
    padding: 14px 20px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    word-break: break-word;
    white-space: normal;
    line-height: 1.3;
    box-sizing: border-box;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    color: #667eea;
    padding-left: 25px;
}

.dropdown-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

/* ========== СТИЛИ ДЛЯ ШАГА 3 (ПОДТВЕРЖДЕНИЕ) ========== */

/* Подтверждение данных - ИСПРАВЛЕННЫЕ СТИЛИ */
.confirmation-data {
    background: white;
    border-radius: 20px;
    padding: 25px 20px; /* Увеличили горизонтальные отступы для симметрии */
    margin: 0 auto 30px; /* Центрируем и добавляем отступ снизу */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Уменьшили тень */
    border: 2px solid #667eea20; /* Сделали более светлую границу */
    width: 100%;
    max-width: 350px; /* Ограничили максимальную ширину */
    text-align: center;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Убираем псевдоэлемент с градиентной полосой, если он был */
.confirmation-data::before {
    display: none;
}

.data-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f2f5; /* Сделали более тонкую и светлую линию */
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.data-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.data-label {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
    margin-bottom: 8px;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

/* Убираем иконки для меток, если они были */
.data-label[for="selectedGroupDisplay"]::before,
.data-label[for="selectedStudentDisplay"]::before {
    content: none;
    margin-right: 0;
}

.data-value {
    font-weight: 600; /* Сделали полужирным вместо жирного */
    color: #333;
    font-size: 16px;
    text-align: center;
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    padding: 12px 15px; /* Увеличили отступы */
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f2f5 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0; /* Более тонкая граница */
    margin: 5px 0;
    transition: all 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: none; /* Убираем тень */
}

/* Убираем hover эффект, если он был слишком агрессивным */
.data-value:hover {
    border-color: #667eea40;
    background: #f8f9fa;
    transform: none; /* Убираем трансформацию */
    box-shadow: none; /* Убираем тень */
}

/* Для очень длинных имен - особые стили */
.data-value.long-name {
    font-size: 14px;
    padding: 10px 8px;
    line-height: 1.3;
}

/* Контейнер кнопок в шаге подтверждения - ИСПРАВЛЕННЫЕ СТИЛИ */
#registrationStep3 .buttons-container {
    display: flex;
    flex-direction: row;
    gap: 15px; /* Увеличили расстояние между кнопками */
    width: 100%;
    max-width: 350px;
    margin: 0 auto; /* Центрируем контейнер */
    padding: 0 10px; /* Добавили небольшие отступы по бокам */
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* Кнопка "Изменить группу" - ИСПРАВЛЕННЫЕ СТИЛИ */
#editGroupBtn {
    flex: 1;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 10px; /* Уменьшили горизонтальные отступы */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 48px;
    box-sizing: border-box;
    min-width: 120px; /* Минимальная ширина для гармонии */
}

#editGroupBtn:hover {
    background: #f0f2f5;
    border-color: #667eea60;
    color: #667eea;
    transform: translateY(-1px); /* Уменьшили эффект поднятия */
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* Кнопка "Всё верно" - ИСПРАВЛЕННЫЕ СТИЛИ */
#confirmRegistrationBtn {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 10px; /* Уменьшили горизонтальные отступы */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 48px;
    box-sizing: border-box;
    min-width: 120px; /* Минимальная ширина для гармонии */
}

#confirmRegistrationBtn:hover {
    transform: translateY(-1px); /* Уменьшили эффект поднятия */
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#confirmRegistrationBtn:active {
    transform: translateY(0);
}

/* Анимация появления данных */
@keyframes dataAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.data-item {
    animation: dataAppear 0.4s ease-out;
}

.data-item:nth-child(1) { animation-delay: 0.1s; }
.data-item:nth-child(2) { animation-delay: 0.2s; }

/* Экран гостя */
.guest-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #f0f2f5 0%, #e6e9f0 100%);
    overflow: hidden !important;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.guest-message {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #ed8936;
    animation: scaleUp 0.5s ease;
    box-sizing: border-box;
}

.guest-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.guest-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.guest-text {
    font-size: 16px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 25px;
}

/* ========== АДАПТИВНОСТЬ РЕГИСТРАЦИИ ========== */

@media (max-width: 500px) {
    .registration-container,
    .welcome-content,
    .guest-container {
        padding: 15px;
    }

    .step-title {
        font-size: 18px;
    }

    .dropdown-btn {
        padding: 14px 16px;
        font-size: 15px;
    }

    .dropdown-item {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Исправленные стили для шага 3 на мобильных */
    .confirmation-data {
        padding: 20px 15px;
        margin-bottom: 25px;
        border-radius: 18px;
        max-width: 320px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    }

    .data-item {
        margin-bottom: 18px;
        padding-bottom: 18px;
    }

    .data-label {
        font-size: 13px;
    }

    .data-value {
        font-size: 15px;
        padding: 10px 12px;
        min-height: 46px;
        border-radius: 10px;
    }

    .data-value.long-name {
        font-size: 14px;
        padding: 10px 8px;
    }

    #registrationStep3 .buttons-container {
        max-width: 320px;
        gap: 12px;
        padding: 0 8px;
    }

    #editGroupBtn,
    #confirmRegistrationBtn {
        padding: 12px 8px;
        font-size: 14px;
        min-height: 44px;
        border-radius: 10px;
        min-width: 110px;
    }

    .guest-message {
        padding: 20px;
    }

    .guest-title {
        font-size: 22px;
    }

    .guest-text {
        font-size: 15px;
    }

    .welcome-logo {
        padding: 20px 15px;
        margin-bottom: 25px;
    }

    .logo-emoji {
        font-size: 42px;
    }

    .logo-text {
        font-size: 22px;
    }
}

@media (max-width: 380px) {
    .welcome-content,
    .registration-container,
    .guest-container {
        padding: 10px;
    }

    .welcome-logo {
        padding: 15px 10px;
    }

    .confirmation-data {
        padding: 18px 12px;
        border-radius: 16px;
        max-width: 300px;
    }

    .data-value {
        font-size: 14px;
        padding: 10px 8px;
        min-height: 42px;
    }

    .data-value.long-name {
        font-size: 13px;
        padding: 10px 6px;
    }

    .data-label {
        font-size: 12px;
    }

    #registrationStep3 .buttons-container {
        max-width: 300px;
        gap: 10px;
        padding: 0 5px;
    }

    #editGroupBtn,
    #confirmRegistrationBtn {
        padding: 10px 6px;
        font-size: 13px;
        min-height: 42px;
        min-width: 100px;
    }

    .dropdown-btn {
        padding: 10px 12px;
        font-size: 14px;
    }

    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 350px) {
    .confirmation-data {
        max-width: 280px;
        padding: 16px 10px;
    }

    .data-value {
        font-size: 13px;
        padding: 8px 6px;
    }

    .data-value.long-name {
        font-size: 12px;
        padding: 8px 4px;
    }

    .data-label {
        font-size: 11px;
    }

    #registrationStep3 .buttons-container {
        max-width: 280px;
        flex-direction: column; /* На очень маленьких экранах делаем кнопки вертикально */
        gap: 8px;
    }

    #editGroupBtn,
    #confirmRegistrationBtn {
        width: 100%;
    }
}

@media (max-height: 700px) {
    .welcome-logo {
        padding: 18px 15px;
        margin-bottom: 20px;
    }

    .logo-emoji {
        font-size: 38px;
    }

    .buttons-container {
        gap: 8px;
    }

    .step-title {
        margin-bottom: 20px;
        font-size: 18px;
    }

    .confirmation-data {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .data-item {
        margin-bottom: 15px;
        padding-bottom: 15px;
    }

    .guest-message {
        padding: 20px;
    }

    .guest-icon {
        font-size: 50px;
        margin-bottom: 15px;
    }
}

@media (max-height: 600px) {
    .welcome-logo {
        padding: 15px 12px;
        margin-bottom: 15px;
    }

    .logo-emoji {
        font-size: 36px;
        margin-bottom: 8px;
    }

    .logo-text {
        font-size: 20px;
    }

    .logo-subtitle {
        font-size: 13px;
    }

    .step-title {
        margin-bottom: 15px;
        font-size: 17px;
    }

    .dropdown-btn {
        padding: 12px 14px;
        min-height: 46px;
    }

    .data-label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .data-value {
        font-size: 14px;
        padding: 10px 8px;
    }
}

/* Ландшафтная ориентация */
@media (max-height: 500px) and (orientation: landscape) {
    .welcome-content,
    .registration-container,
    .guest-container {
        justify-content: flex-start;
        padding-top: 30px;
        overflow-y: auto;
    }

    .welcome-logo {
        margin-bottom: 15px;
        padding: 15px;
    }

    .registration-notification {
        margin-bottom: 15px;
    }

    .step-title {
        margin-bottom: 15px;
    }

    .buttons-container {
        margin-bottom: 20px;
    }

    .confirmation-data {
        max-width: 320px;
        padding: 15px 12px;
        margin-bottom: 15px;
    }

    .data-item {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .data-value {
        min-height: 40px;
        padding: 8px 10px;
    }

    #registrationStep3 .buttons-container {
        margin-top: 15px;
    }
}