/* =====================================================================
   FORM ENHANCEMENTS - Campos de entrada melhorados e responsivos
   ===================================================================== */

:root {
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== CAMPOS DE ENTRADA ===== */

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s var(--spring);
    backdrop-filter: blur(8px);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* ===== FOCO ===== */

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

/* ===== VALIDAÇÃO - VÁLIDO ===== */

input[type="text"]:valid,
input[type="email"]:valid,
input[type="password"]:valid {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
}

input[type="text"]:valid:focus,
input[type="email"]:valid:focus,
input[type="password"]:valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ===== VALIDAÇÃO - INVÁLIDO ===== */

input[type="text"]:invalid,
input[type="email"]:invalid,
input[type="password"]:invalid {
    border-color: rgba(225, 29, 72, 0.4);
    background: rgba(225, 29, 72, 0.05);
}

input[type="text"]:invalid:focus,
input[type="email"]:invalid:focus,
input[type="password"]:invalid:focus {
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

/* ===== DESABILITADO ===== */

input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

/* ===== LABELS ===== */

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

input:focus ~ label,
textarea:focus ~ label,
select:focus ~ label {
    color: var(--primary-2);
}

/* ===== HINTS E MENSAGENS ===== */

.field-hint,
small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    transition: color 0.3s ease;
}

input:focus ~ .field-hint {
    color: var(--primary-2);
}

/* ===== CHECKBOX E RADIO ===== */

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-2);
    transition: all 0.3s var(--spring);
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    transform: scale(1.1);
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 2px solid var(--primary-2);
    outline-offset: 2px;
}

/* ===== SELECT ===== */

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f1eef7' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 36px;
}

select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ec4899' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
}

/* ===== TEXTAREA ===== */

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

textarea:focus {
    resize: both;
}

/* ===== SPINNER (NUMBER INPUT) ===== */

input[type="number"] {
    padding-right: 36px;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* ===== RANGE INPUT ===== */

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(139, 92, 246, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-2);
    cursor: pointer;
    transition: all 0.3s var(--spring);
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-2);
    cursor: pointer;
    border: none;
    transition: all 0.3s var(--spring);
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
}

/* ===== CAMPO COM ÍCONE ===== */

.field-with-icon {
    position: relative;
}

.field-with-icon input {
    padding-left: 40px;
}

.field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s ease;
}

.field-with-icon input:focus ~ .field-icon {
    color: var(--primary-2);
}

/* ===== CAMPO COM BOTÃO ===== */

.field-with-button {
    position: relative;
}

.field-with-button input {
    padding-right: 44px;
}

.field-button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s var(--spring);
}

.field-button:hover {
    color: var(--primary-2);
    transform: translateY(-50%) scale(1.1);
}

.field-button:active {
    transform: translateY(-50%) scale(0.95);
}

/* ===== GRUPOS DE CAMPOS ===== */

.field-group {
    display: flex;
    gap: 12px;
}

.field-group .field {
    flex: 1;
}

/* ===== CAMPO OBRIGATÓRIO ===== */

.field.required label::after {
    content: ' *';
    color: var(--primary-2);
}

/* ===== ERRO DE CAMPO ===== */

.field.error input,
.field.error textarea,
.field.error select {
    border-color: rgba(225, 29, 72, 0.5);
    background: rgba(225, 29, 72, 0.08);
}

.field.error input:focus,
.field.error textarea:focus,
.field.error select:focus {
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

.field-error {
    font-size: 12px;
    color: #fca5b1;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== SUCESSO DE CAMPO ===== */

.field.success input,
.field.success textarea,
.field.success select {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.08);
}

.field.success input:focus,
.field.success textarea:focus,
.field.success select:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.field-success {
    font-size: 12px;
    color: #6ee7b7;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 480px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px;
        padding: 12px 12px;
    }

    .field-group {
        flex-direction: column;
        gap: 12px;
    }

    .field-group .field {
        flex: 1 1 100%;
    }
}

/* ===== AUTOFILL ===== */

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.04) inset !important;
    -webkit-text-fill-color: var(--text) !important;
}

input:-webkit-autofill::first-line {
    font-family: inherit;
}

/* ===== PLACEHOLDER ===== */

::placeholder {
    opacity: 0.6;
}

::-webkit-input-placeholder {
    opacity: 0.6;
}

:-moz-placeholder {
    opacity: 0.6;
}

::-moz-placeholder {
    opacity: 0.6;
}

:-ms-input-placeholder {
    opacity: 0.6;
}

::-ms-input-placeholder {
    opacity: 0.6;
}
