/* Плавающие лейблы для медицинских форм */

.floating-field {
    position: relative;
    margin-bottom: 1.5rem;
}

.floating-field input,
.floating-field textarea,
.floating-field select {
    width: 100%;
    height: 4rem; /* 64px - увеличиваем высоту */
    padding: 1.75rem 1rem 0.75rem 1rem; /* Увеличиваем внутренние отступы */
    border: 1px solid #e2e8f0; /* Делаем границу тоньше */
    border-radius: 0.75rem; /* Увеличиваем скругление */
    background: white;
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
}

.floating-field textarea {
    height: auto;
    min-height: 4rem; /* Увеличиваем минимальную высоту */
    resize: none;
    overflow: hidden;
    padding: 1.75rem 1rem 0.5rem 1rem; /* Увеличиваем отступы */
    line-height: 1.4;
}

/* Автоматическое расширение textarea */
.floating-field textarea.auto-expand {
    min-height: 2.5rem;
    line-height: 1.4;
}

.floating-field textarea.auto-resize {
    min-height: 4rem;
    line-height: 1.4;
    padding: 1.75rem 1rem 0.5rem 1rem;
}

.floating-field label {
    position: absolute;
    top: 50%;
    left: 1rem; /* Увеличиваем отступ слева */
    transform: translateY(-50%);
    font-size: 1rem;
    color: #64748b;
    pointer-events: none;
    transition: all 0.2s ease;
    background: white;
    padding: 0 0.25rem;
    z-index: 1;
}

.floating-field textarea + label {
    top: 2rem; /* Увеличиваем позицию для textarea */
    transform: translateY(-50%);
}

/* Состояние фокуса - только при фокусе выделяем */
.floating-field input:focus,
.floating-field textarea:focus,
.floating-field select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3);
}

.floating-field input:focus + label,
.floating-field textarea:focus + label,
.floating-field select:focus + label {
    top: 0;
    transform: translateY(0);
    font-size: 0.75rem;
    color: #60a5fa;
    font-weight: 500;
}

/* Заполненные поля - лейбл вверху, но БЕЗ синего цвета */
.floating-field input:not(:placeholder-shown) + label,
.floating-field textarea:not(:placeholder-shown) + label,
.floating-field select:not([value=""]) + label,
.floating-field.field-filled label {
    top: 0;
    transform: translateY(0);
    font-size: 0.75rem;
    color: #64748b; /* Серый цвет для заполненных полей без фокуса */
    font-weight: 500;
}

/* Поля с датой и селекты всегда имеют лейбл вверху */
.floating-field input[type="date"] + label,
.floating-field input[type="datetime-local"] + label,
.floating-field select + label {
    top: 0;
    transform: translateY(0);
    font-size: 0.75rem;
    color: #64748b; /* Серый цвет по умолчанию */
    font-weight: 500;
}

/* При фокусе на поля с датой - синий цвет */
.floating-field input[type="date"]:focus + label,
.floating-field input[type="datetime-local"]:focus + label,
.floating-field select:focus + label {
    color: #60a5fa;
}

/* Скрываем placeholder в полях дат пока нет фокуса */
.floating-field input[type="text"][placeholder*="ДД.ММ.ГГГГ"]:not(:focus)::placeholder {
    color: transparent;
}

/* Показываем placeholder только при фокусе */
.floating-field input[type="text"][placeholder*="ДД.ММ.ГГГГ"]:focus::placeholder {
    color: #9ca3af;
}

.floating-field input[type="date"],
.floating-field input[type="datetime-local"],
.floating-field select {
    padding-top: 1.5rem;
}

/* Стили валидации убраны - выглядели кринжево */

/* Различные размеры полей */
.floating-field.w-24 {
    width: 6rem;
}

.floating-field.w-32 {
    width: 8rem;
}

.floating-field.w-48 {
    width: 12rem;
}

.floating-field.w-64 {
    width: 16rem;
}

.floating-field.w-full {
    width: 100%;
}

/* Сетки полей */
.fields-grid {
    display: grid;
    gap: 1rem;
}

.fields-grid.cols-1 {
    grid-template-columns: 1fr;
}

.fields-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.fields-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Адаптивные сетки */
@media (max-width: 768px) {
    .fields-grid.cols-2,
    .fields-grid.cols-3 {
        grid-template-columns: 1fr;
    }
    
    .floating-field.w-24,
    .floating-field.w-32,
    .floating-field.w-48,
    .floating-field.w-64 {
        width: 100%;
    }
}

/* Группы полей */
.field-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.field-group h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

/* Специальные стили для паспортных данных - БЛОЧНЫЙ РЕЖИМ */
.passport-fields {
    display: block !important;
    margin-bottom: 1.5rem;
}

.passport-fields .floating-field {
    margin-bottom: 1rem;
}

.passport-fields .floating-field input {
    font-size: 1rem;
    font-weight: normal;
    text-align: left;
}

/* Поля СНИЛС */
.snils-field input {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
    text-align: center;
}

/* Карточки документов о смене фамилии */
.name-change-document-card {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem !important;
    position: relative;
    transition: all 0.2s ease;
}

.name-change-document-card:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.name-change-document-card:last-child {
    margin-bottom: 1rem !important;
}

/* Поля телефона */
.phone-field input {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1.125rem;
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .floating-field input,
    .floating-field textarea,
    .floating-field select {
        background: #1e293b;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .floating-field label {
        background: #1e293b;
        color: #94a3b8;
    }
    
    .floating-field input:focus + label,
    .floating-field textarea:focus + label,
    .floating-field select:focus + label,
    .floating-field input:not(:placeholder-shown) + label,
    .floating-field textarea:not(:placeholder-shown) + label,
    .floating-field select:not([value=""]) + label,
    .floating-field.field-filled label {
        color: #60a5fa;
    }
    
    .field-group {
        background: #0f172a;
        border-color: #334155;
    }
    
    .field-group h3 {
        color: #f1f5f9;
        border-color: #334155;
    }
}

/* Анимации для плавности */
@keyframes labelFloat {
    from {
        top: 50%;
        transform: translateY(-50%);
        font-size: 1rem;
    }
    to {
        top: 0;
        transform: translateY(0);
        font-size: 0.75rem;
    }
}

.floating-field.animating label {
    animation: labelFloat 0.2s ease;
}

/* Индикаторы обязательных полей - убран красный цвет */
.floating-field.required label::after {
    content: ' *';
    color: #6b7280;
}

/* Иконки в полях */
.floating-field.with-icon {
    position: relative;
}

.floating-field.with-icon input,
.floating-field.with-icon textarea {
    padding-left: 2.5rem;
}

.floating-field.with-icon .field-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    z-index: 2;
}

.floating-field.with-icon input:focus ~ .field-icon {
    color: #3b82f6;
}

/* Кнопки действий в полях */
.floating-field .field-actions {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
}

.floating-field .field-action {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.floating-field .field-action:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* =================================================================== */
/* Стили для иконок помощи блоков */
/* =================================================================== */

.block-help-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.block-help-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.6);
    background: linear-gradient(135deg, #ffca28 0%, #ffa726 100%);
}

.block-help-icon i {
    font-size: 16px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.block-help-icon:active {
    transform: scale(0.95);
}

/* Анимация пульсации для привлечения внимания */
@keyframes pulse-help {
    0% { box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 2px 15px rgba(255, 193, 7, 0.7); }
    100% { box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4); }
}

.block-help-icon.pulse {
    animation: pulse-help 2s infinite;
}
