/* ============================================
   FORMS - Sistema de Formulários Padronizados
   Galinheiro Pinheiro
   ============================================ */

/* Container do Formulário */
.form-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Grid Responsivo de Campos */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Campo de Formulário */
.form-row {
    display: flex;
    flex-direction: column;
}

/* Campo que ocupa linha inteira (textarea, observações) */
.form-row-full {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
}

/* Labels dos Campos */
.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Inputs, Selects e Textareas */
.form-grid input[type="text"],
.form-grid input[type="email"],
.form-grid input[type="number"],
.form-grid input[type="date"],
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #111827;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.form-grid input[type="text"]:focus,
.form-grid input[type="email"]:focus,
.form-grid input[type="number"]:focus,
.form-grid input[type="date"]:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-grid textarea {
    min-height: 120px;
    resize: vertical;
}

/* Checkboxes */
.form-grid input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
}

.form-grid input[type="checkbox"]:checked {
    background-color: #8b5cf6;
    border-color: #8b5cf6;
}

/* Lista de Checkboxes (pessoas, etc.) */
.form-grid ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.form-grid ul li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid ul li label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

/* Texto de Ajuda */
.form-help {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.375rem;
    font-style: italic;
    line-height: 1.4;
    word-break: normal;
    overflow-wrap: break-word;
}

/* Mensagens de Erro */
.form-error {
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.375rem;
    font-weight: 500;
    line-height: 1.4;
    word-break: normal;
    overflow-wrap: break-word;
}

/* Container de Botões */
.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 1.5rem;
}

/* Botões do Formulário */
.form-actions .btn-primary,
button[type="submit"].btn-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #ffffff;
    padding: 0.625rem 1.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: auto;
    width: auto;
}

.form-actions .btn-primary:hover,
button[type="submit"].btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.form-actions .btn-primary svg,
button[type="submit"].btn-primary svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.form-actions .btn-secondary,
a.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.625rem 1.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: auto;
    width: auto;
}

.form-actions .btn-secondary:hover,
a.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.form-actions .btn-secondary svg,
a.btn-secondary svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Responsividade */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions .btn-primary,
    .form-actions .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* Preview de Cálculo (Total do lote, etc.) */
#total_preview {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 0.5rem;
    font-weight: 600;
    color: #065f46;
}

#total_preview_value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #047857;
}
