/* backend/static/css/forms.css */

/* 
   Versão: 1.3.1 - BTOS DNA Forms & Security (Smart Error Fix)
   Status: ESTABILIZADO - Containment de Ícones & Layout Robusto
   Objetivo: Inputs de alta legibilidade, feedback de erro semântico e suporte a Toggle de Senha.
*/

/* ==========================================================================
   1. INPUTS E TEXTAREAS (BTOS Standard)
   ========================================================================== */
.form-control {
    display: block;
    width: 100%; /* Resolve a largura curta dos campos no login */
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-family-sans-serif);
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text-default);
    background-color: var(--color-bg-container);
    border: 1px solid var(--border-color-default);
    border-radius: var(--border-radius-md);
    transition: var(--transition-fast);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-control:focus {
    border-color: var(--color-primary-bs);
    box-shadow: 0 0 0 4px rgba(19, 50, 188, 0.1);
    background-color: var(--color-bg-container);
}

.form-control::placeholder {
    color: var(--color-text-muted);
    opacity: 0.5;
}

.form-control:disabled, 
.form-control[readonly] {
    background-color: var(--color-bg-light);
    opacity: 1;
    cursor: not-allowed;
}

/* ==========================================================================
   2. PASSWORD TOGGLE (Sincronizado com _formhelpers.html)
   ========================================================================== */
.password-wrapper-btos {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-wrapper-btos .form-control {
    padding-right: 3rem; /* Espaço reservado para o ícone do olho */
}

.password-toggle-btos {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 5;
}

.password-toggle-btos:hover {
    color: var(--color-primary-bs);
    transform: scale(1.1);
}

.password-toggle-btos:focus {
    outline: none;
}

.password-toggle-btos svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* ==========================================================================
   3. LABELS, CHECKBOXES E FEEDBACK
   ========================================================================== */
.form-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-headings);
}

.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.75rem;
    margin-bottom: 0.125rem;
}

.form-check-input {
    float: left;
    margin-left: -1.75rem;
    width: 1.15em;
    height: 1.15em;
    margin-top: 0.2em;
    background-color: var(--color-bg-container);
    border: 1px solid var(--border-color-default);
    appearance: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.form-check-input:checked {
    background-color: var(--color-primary-bs);
    border-color: var(--color-primary-bs);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--color-danger-bs);
    font-weight: 600;
}

.is-invalid {
    border-color: var(--color-danger-bs) !important;
}

.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1) !important;
}

/* ==========================================================================
   4. SELECTS E ESPECIALIDADES
   ========================================================================== */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ==========================================================================
   5. ALERTA DE AÇÃO INTELIGENTE (Smart Error Interceptor)
   ========================================================================== */
.btos-error-action-card {
    background-color: #fff5f5; /* Vermelho muito suave */
    border: 1px solid #fc8181; /* Vermelho claro */
    border-left: 4px solid #e53e3e; /* Vermelho forte */
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-top: 0.75rem;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 2px 4px rgba(229, 62, 62, 0.1);
    box-sizing: border-box;
    width: 100%;
}

.btos-error-action-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.btos-error-icon {
    color: #e53e3e;
    /* FIX: Força bruta de dimensões para evitar explosão de SVG */
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
}

.btos-error-content {
    flex: 1;
    min-width: 0; /* Previne overflow de texto flex */
}

.btos-error-title {
    font-weight: 700;
    color: #c53030;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    display: block;
    line-height: 1.2;
}

.btos-error-desc {
    font-size: 0.85rem;
    color: #2d3748;
    line-height: 1.4;
    margin-bottom: 0;
}

.btos-error-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(229, 62, 62, 0.2);
}

.btn-error-action {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    white-space: nowrap;
}

.btn-error-login {
    background-color: #e53e3e;
    color: white;
    border: 1px solid #e53e3e;
}

.btn-error-login:hover {
    background-color: #c53030;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(197, 48, 48, 0.2);
}

.btn-error-reset {
    background-color: transparent;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.btn-error-reset:hover {
    background-color: #fff0f0;
    border-color: #c53030;
    color: #9b2c2c;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}