/* === СТИЛИ ТЕКСТОВЫХ ПОЛЕЙ ВВОДА (АДАПТИРОВАННЫЕ ПОД БАЗОВЫЕ СТИЛИ) === */

/* Основные стили текстовых полей */
.form-control,
.text-input {
    display: inline-block;
    padding: 12px 16px;
    border: 1px solid var(--form-control-border);
    border-radius: 8px;
    background-color: var(--form-control-bg);
    color: var(--form-control-tx);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-control::placeholder,
.text-input::placeholder {
    color: var(--form-control-placeholder);
    opacity: 1;
}

/* Состояние фокуса */
.form-control:focus,
.text-input:focus {
    background-color: var(--form-control-bg);
    border-color: var(--btn-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Состояния полей */
.form-control:hover,
.text-input:hover {
    border-color: var(--btn-primary-hover);
}

.form-control:disabled,
.text-input:disabled {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control.error,
.text-input.error {
    border-color: var(--btn-danger);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-control.success,
.text-input.success {
    border-color: var(--btn-success);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.form-control.warning,
.text-input.warning {
    border-color: var(--btn-warning);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1);
}

/* Специфичные стили для полей */
.text-input-code {
    width: 120px;
    text-align: center;
}

.text-input-nomer {
    width: 220px;
    margin-left: 10px;
}

.text-input-fio { 
    width: calc(100% - 50px); 
}

/* Процентные ширины */
.text-input-10 { width: calc(100% - 50px); }
.text-input-9  { width: calc(90% - 50px); }
.text-input-8  { width: calc(80% - 50px); }
.text-input-7  { width: calc(70% - 50px); }
.text-input-6  { width: calc(60% - 50px); }
.text-input-5  { width: calc(50% - 50px); }
.text-input-4  { width: calc(40% - 50px); }
.text-input-3  { width: calc(30% - 50px); }
.text-input-2  { width: calc(20% - 50px); }
.text-input-1  { width: calc(10% - 50px); }

/* Фиксированные ширины */
.text-input-500 { width: 500px; } 
.text-input-490 { width: 490px; }
.text-input-480 { width: 480px; }
.text-input-470 { width: 470px; }
.text-input-460 { width: 460px; }
.text-input-450 { width: 450px; }
.text-input-440 { width: 440px; }
.text-input-430 { width: 430px; }
.text-input-420 { width: 420px; }
.text-input-410 { width: 410px; }
.text-input-400 { width: 400px; }
.text-input-390 { width: 390px; }
.text-input-380 { width: 380px; }
.text-input-370 { width: 370px; }
.text-input-360 { width: 360px; }
.text-input-350 { width: 350px; }
.text-input-340 { width: 340px; }
.text-input-330 { width: 330px; }
.text-input-320 { width: 320px; }
.text-input-310 { width: 310px; }
.text-input-300 { width: 300px; } 
.text-input-290 { width: 290px; }
.text-input-280 { width: 280px; }
.text-input-270 { width: 270px; }
.text-input-260 { width: 260px; }
.text-input-250 { width: 250px; }
.text-input-240 { width: 240px; }
.text-input-230 { width: 230px; }
.text-input-220 { width: 220px; }
.text-input-210 { width: 210px; }
.text-input-200 { width: 200px; }
.text-input-190 { width: 190px; }
.text-input-180 { width: 180px; }
.text-input-170 { width: 170px; }
.text-input-160 { width: 160px; }
.text-input-150 { width: 150px; }
.text-input-140 { width: 140px; }
.text-input-130 { width: 130px; }
.text-input-120 { width: 120px; }
.text-input-110 { width: 110px; }
.text-input-100 { width: 100px; }
.text-input-90  { width: 90px;  }
.text-input-80  { width: 80px;  }
.text-input-70  { width: 70px;  }
.text-input-60  { width: 60px;  }
.text-input-50  { width: 50px;  }
.text-input-40  { width: 40px;  }
.text-input-30  { width: 30px;  }
.text-input-20  { width: 20px;  }

/* Стили для текстовых областей */
.text-area {
    display: inline-block;
    padding: 12px 16px;
    border: 1px solid var(--form-control-border);
    border-radius: 8px;
    background-color: var(--form-control-bg);
    color: var(--form-control-tx);
    transition: all 0.3s ease;
    width: calc(100% - 50px);
    height: calc(100vh * 0.5 - 200px);
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.text-area::placeholder {
    color: var(--form-control-placeholder);
}

.text-area:focus {
    background-color: var(--form-control-bg);
    border-color: var(--btn-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.text-area:hover {
    border-color: var(--btn-primary-hover);
}

.text-area:disabled {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.text-area.error {
    border-color: var(--btn-danger);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.text-area.success {
    border-color: var(--btn-success);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Стили для поля даты */
input[type="date"] {
    width: 150px;
    padding: 12px 16px;
    border: 1px solid var(--form-control-border);
    border-radius: 8px;
    background-color: var(--form-control-bg);
    color: var(--form-control-tx);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

input[type="date"]:focus {
    border-color: var(--btn-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.1);
}

input[type="date"]:hover {
    border-color: var(--btn-primary-hover);
}

input[type="date"]:disabled {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Дополнительные типы полей */
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="search"] {
    padding: 12px 16px;
    border: 1px solid var(--form-control-border);
    border-radius: 8px;
    background-color: var(--form-control-bg);
    color: var(--form-control-tx);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="search"]:focus {
    border-color: var(--btn-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.1);
}

/* Варианты размеров */
.text-input.small,
.form-control.small {
    padding: 8px 12px;
    font-size: 13px;
}

.text-input.large,
.form-control.large {
    padding: 16px 20px;
    font-size: 16px;
}

.text-area.small {
    padding: 8px 12px;
    font-size: 13px;
}

.text-area.large {
    padding: 16px 20px;
    font-size: 16px;
}

/* Варианты скругления */
.text-input.rounded,
.form-control.rounded {
    border-radius: 25px;
}

.text-input.square,
.form-control.square {
    border-radius: 4px;
}

.text-area.rounded {
    border-radius: 12px;
}

.text-area.square {
    border-radius: 4px;
}

/* Стили для группы полей ввода */
.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group .text-input {
    margin: 0;
    flex: 1;
}

.input-group .text-input:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .text-input:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .text-input:not(:first-child):not(:last-child) {
    border-radius: 0;
}

/* Стили для префиксов и суффиксов */
.input-with-prefix,
.input-with-suffix {
    display: flex;
    align-items: center;
    background-color: var(--form-control-bg);
    border: 1px solid var(--form-control-border);
    border-radius: 8px;
    overflow: hidden;
}

.input-prefix,
.input-suffix {
    padding: 12px 16px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    border: none;
    white-space: nowrap;
}

.input-with-prefix .text-input,
.input-with-suffix .text-input {
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex: 1;
}

.input-with-prefix .text-input:focus,
.input-with-suffix .text-input:focus {
    box-shadow: none;
}

.input-with-prefix:focus-within,
.input-with-suffix:focus-within {
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.1);
}

/* Адаптивность */
@media (max-width: 768px) {
    .text-input,
    .form-control,
    .text-area,
    input[type="date"] {
        padding: 10px 12px;
        font-size: 16px; /* Для лучшего UX на мобильных */
    }
    
    .text-input-fio,
    .text-area,
    .text-input-10 { 
        width: calc(100% - 24px); 
    }
    
    .text-input-code {
        width: 100px;
    }
    
    .text-input-nomer {
        width: calc(100% - 110px);
        margin-left: 0;
    }
    
    /* На мобильных фиксированные ширины становятся адаптивными */
    .text-input-500,
    .text-input-400,
    .text-input-300,
    .text-input-200 {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .text-input,
    .form-control,
    .text-area,
    input[type="date"] {
        padding: 8px 10px;
    }
    
    .input-group {
        flex-direction: column;
        gap: 4px;
    }
    
    .input-group .text-input {
        border-radius: 8px !important;
        width: 100%;
    }
}

/* Специфические стили для темной темы */
[data-theme="dark"] .text-input,
[data-theme="dark"] .form-control,
[data-theme="dark"] .text-area,
[data-theme="dark"] input[type="date"] {
    background-color: var(--form-control-bg);
    border-color: var(--form-control-border);
    color: var(--form-control-tx);
}

[data-theme="dark"] .input-prefix,
[data-theme="dark"] .input-suffix {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
}

[data-theme="dark"] .input-with-prefix,
[data-theme="dark"] .input-with-suffix {
    background-color: var(--form-control-bg);
    border-color: var(--form-control-border);
}

/* Поддержка reduced-motion для доступности */
@media (prefers-reduced-motion: reduce) {
    .text-input,
    .form-control,
    .text-area,
    input[type="date"] {
        transition: none;
    }
}

/* Стили для валидации */
.validation-message {
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.validation-message.error {
    color: var(--btn-danger);
}

.validation-message.success {
    color: var(--btn-success);
}

.validation-message.warning {
    color: var(--btn-warning);
}