/* static/css/forms.css */

/* Основной контейнер формы */
.form-container {
    text-align: center;
    font-family: 'Arial', sans-serif;
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background-color: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group input[type="radio"] {
    margin-right: 10px;
}

.form-label {
    text-align: left;
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px; /* Увеличиваем для мобильных */
    transition: border-color 0.3s;
    -webkit-appearance: none; /* Убирает стандартные стили на iOS */
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.submit-btn {
    background-color: #007BFF;
    color: white;
    padding: 14px 30px; /* Увеличиваем padding */
    border: none;
    border-radius: 8px; /* Немного больше скругление */
    cursor: pointer;
    font-size: 18px; /* Увеличиваем шрифт */
    transition: background-color 0.3s;
    width: 100%;
    font-weight: bold;
    margin-top: 10px;
}

.submit-btn:hover {
    background-color: #0056b3;
}

.submit-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.h3-register,
.h5-register {
    text-align: center;
    margin-bottom: 20px;
    word-wrap: break-word;
}

.text-confirm {
    text-align: left;
    font-family: 'Arial', sans-serif;
    font-size: 14px; /* Увеличиваем на мобильных */
    color: #666;
    line-height: 1.5;
}

/* Form errors */
.form-error {
    color: #dc3545;
    font-size: 14px; /* Увеличиваем */
    margin-top: 5px;
    text-align: left;
}

.input-error {
    border-color: #dc3545 !important;
}

.input-error:focus {
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.25);
}

input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* ============================================
   СОВРЕМЕННЫЕ СТИЛИ ДЛЯ РАДИОКНОПОК
   ============================================ */

/* Контейнер для радио-кнопок */
.radio-group {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin: 15px 0 5px;
}

/* Скрываем стандартные радио-кнопки */
.radio-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

/* Стили для меток */
.radio-group label {
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
    color: #333;
    transition: color 0.3s;
    display: inline-block;
}

/* Создаем кастомные радио-кнопки */
.radio-group label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Внутренняя точка */
.radio-group label:after {
    content: '';
    position: absolute;
    left: 7px;
    top: 7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #007bff;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

/* Стили для выбранной радио-кнопки */
.radio-group input[type="radio"]:checked + label:before {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.radio-group input[type="radio"]:checked + label:after {
    transform: scale(1);
}

/* Стили при наведении */
.radio-group label:hover:before {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

/* Стили при фокусе */
.radio-group input[type="radio"]:focus + label:before {
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
    border-color: #007bff;
}

/* Стили для отключенных радио-кнопок */
.radio-group input[type="radio"]:disabled + label {
    opacity: 0.6;
    cursor: not-allowed;
}

.radio-group input[type="radio"]:disabled + label:before {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Анимация при клике */
.radio-group input[type="radio"]:active + label:before {
    transform: scale(0.9);
}

/* Стили для горизонтального расположения */
.radio-group-inline {
    flex-direction: row;
    align-items: center;
}

/* Стили для вертикального расположения */
.radio-group-vertical {
    flex-direction: column;
    gap: 15px;
}

/* Альтернативный стиль в виде карточек */
.radio-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.radio-card {
    flex: 1;
    min-width: 120px;
    position: relative;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Иконки для карточек пола */
.radio-card[data-gender="M"] label:before {
    content: '♂';
    font-size: 32px;
    margin-bottom: 8px;
    color: #007bff;
    line-height: 1;
}

.radio-card[data-gender="F"] label:before {
    content: '♀';
    font-size: 32px;
    margin-bottom: 8px;
    color: #e83e8c;
    line-height: 1;
}

/* Стили для выбранной карточки */
.radio-card input[type="radio"]:checked + label {
    border-color: #007bff;
    background: linear-gradient(145deg, #f0f7ff, #e3f2fd);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
    transform: translateY(-2px);
}

.radio-card input[type="radio"]:checked + label:before {
    color: #007bff;
}

.radio-card[data-gender="F"] input[type="radio"]:checked + label {
    border-color: #e83e8c;
    background: linear-gradient(145deg, #fff0f7, #ffe3f0);
    box-shadow: 0 4px 12px rgba(232, 62, 140, 0.2);
}

.radio-card[data-gender="F"] input[type="radio"]:checked + label:before {
    color: #e83e8c;
}

/* Стили при наведении */
.radio-card label:hover {
    border-color: #007bff;
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.radio-card[data-gender="F"] label:hover {
    border-color: #e83e8c;
    background: #fff8fc;
}

/* Стили при фокусе */
.radio-card input[type="radio"]:focus + label {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
}

.radio-card[data-gender="F"] input[type="radio"]:focus + label {
    box-shadow: 0 0 0 4px rgba(232, 62, 140, 0.25);
}

/* ============================================
   АДАПТИВНЫЕ СТИЛИ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ============================================ */

/* Планшеты и маленькие десктопы */
@media (max-width: 768px) {
    .form-container {
        max-width: 95%; /* Занимает почти всю ширину */
        padding: 20px;
        margin: 20px auto;
        border-radius: 12px;
    }

    input, select, textarea {
        padding: 14px; /* Больше область касания */
        font-size: 16px;
    }

    .form-label {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .submit-btn {
        padding: 16px 20px;
        font-size: 18px;
    }

    /* Адаптация радио-кнопок */
    .radio-group {
        gap: 20px;
    }

    .radio-group label {
        padding-left: 40px;
        font-size: 17px;
    }

    .radio-group label:before {
        width: 28px;
        height: 28px;
    }

    .radio-group label:after {
        left: 8px;
        top: 8px;
        width: 16px;
        height: 16px;
    }

    .radio-card label {
        padding: 15px 10px;
        font-size: 16px;
    }

    .radio-card[data-gender="M"] label:before,
    .radio-card[data-gender="F"] label:before {
        font-size: 28px;
    }
}

/* Мобильные телефоны */
@media (max-width: 576px) {
    .form-container {
        max-width: 100%; /* Вся ширина */
        padding: 20px 15px;
        margin: 15px 10px;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .form-group {
        margin-bottom: 18px;
    }

    input, select, textarea {
        padding: 14px;
        font-size: 16px;
        border-radius: 8px;
    }

    .form-label {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .h3-register {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .h5-register {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .submit-btn {
        padding: 16px 20px;
        font-size: 18px;
        border-radius: 8px;
    }

    .text-confirm {
        font-size: 14px;
        padding: 10px 0;
    }

    /* Улучшаем радио-кнопки для касания */
    .radio-group {
        flex-direction: column;
        gap: 15px;
    }

    .radio-group label {
        padding-left: 45px;
        min-height: 32px;
        display: flex;
        align-items: center;
    }

    .radio-group label:before {
        width: 32px;
        height: 32px;
        top: 50%;
        transform: translateY(-50%);
    }

    .radio-group label:after {
        left: 9px;
        top: 50%;
        transform: translateY(-50%) scale(0);
        width: 18px;
        height: 18px;
    }

    .radio-group input[type="radio"]:checked + label:after {
        transform: translateY(-50%) scale(1);
    }

    /* Карточки на мобильных */
    .radio-cards {
        flex-direction: column;
        gap: 12px;
    }

    .radio-card {
        min-width: 100%;
    }

    .radio-card label {
        flex-direction: row;
        gap: 15px;
        padding: 15px 20px;
    }

    .radio-card[data-gender="M"] label:before,
    .radio-card[data-gender="F"] label:before {
        font-size: 24px;
        margin-bottom: 0;
    }
}

/* Очень маленькие телефоны */
@media (max-width: 375px) {
    .form-container {
        padding: 15px 12px;
        margin: 10px 8px;
    }

    input, select, textarea {
        padding: 12px;
        font-size: 15px;
    }

    .submit-btn {
        padding: 14px 16px;
        font-size: 17px;
    }

    .h3-register {
        font-size: 22px;
    }

    .h5-register {
        font-size: 16px;
    }

    .form-label {
        font-size: 15px;
    }

    .radio-group label {
        padding-left: 40px;
        font-size: 15px;
    }
}

/* Для устройств с маленькой высотой (ландшафтная ориентация) */
@media (max-height: 600px) and (orientation: landscape) {
    .form-container {
        padding: 15px;
        margin: 10px auto;
    }

    .form-group {
        margin-bottom: 12px;
    }

    input, select, textarea {
        padding: 10px;
    }
}

/* Улучшаем доступность для touch-устройств */
@media (hover: none) and (pointer: coarse) {
    input, select, textarea, .submit-btn {
        min-height: 48px; /* Минимальная высота для касания */
    }

    .radio-group label {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .radio-group label:before {
        width: 32px;
        height: 32px;
    }

    .radio-card label {
        min-height: 60px;
    }
}

/* Дополнительные улучшения для мобильных */
.form-wrapper {
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Убираем увеличение шрифта на iOS при повороте */
@media screen and (max-width: 768px) {
    input, select, textarea, button, .radio-group label {
        font-size: 16px !important; /* Предотвращает авто-зум на iOS */
    }
}

/* Анимация для кнопки на мобильных */
@media (max-width: 576px) {
    .submit-btn:active {
        transform: scale(0.98);
        background-color: #0056b3;
    }

    .radio-card label:active {
        transform: scale(0.98);
    }
}

/* Стили для select на мобильных */
@media (max-width: 576px) {
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 40px;
    }
}

/* ============================================
   ПЕРЕОПРЕДЕЛЕНИЕ СТИЛЕЙ ДЛЯ ЧЕКБОКСОВ (МАКСИМАЛЬНО СПЕЦИФИЧНО)
   ============================================ */

div.form-check input.form-check-input[type="checkbox"],
.form-check input[type="checkbox"],
input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 2px solid #6c757d !important;
    border-radius: 4px !important;
    background-color: white !important;
    cursor: pointer !important;
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
    box-shadow: none !important;
    flex-shrink: 0;
    position: static !important;
    opacity: 1 !important;
    display: inline-block !important;
}

div.form-check input.form-check-input[type="checkbox"]:checked,
.form-check input[type="checkbox"]:checked,
input[type="checkbox"]:checked {
    background-color: #007bff !important;
    border-color: #007bff !important;
    accent-color: #007bff !important;
}

div.form-check input.form-check-input[type="checkbox"]:focus,
.form-check input[type="checkbox"]:focus,
input[type="checkbox"]:focus {
    outline: 2px solid #007bff !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

.form-check {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
}

.form-check-label {
    margin-bottom: 0 !important;
    cursor: pointer !important;
    font-weight: normal !important;
    font-size: 16px !important;
    color: #333 !important;
    line-height: 1.4 !important;
}