/* ===================================================
   Formularios: inputs, grid, FormSection, FormActions.
   =================================================== */

.form-control, .form-select {
    border: 1.5px solid var(--control-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    background-color: var(--control-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}

.form-control:hover:not(:disabled):not([readonly]),
.form-select:hover:not(:disabled) {
    border-color: var(--control-hover-border);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--control-focus-border);
    box-shadow: 0 0 0 3px var(--control-focus-ring);
}

.form-control:disabled, .form-select:disabled,
.form-control[readonly] {
    background-color: var(--color-input-disabled);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-label {
    font-weight: 500;
    font-size: 0.825rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.35rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-text {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
}

/* --- FormSection.razor --- */
.ds-form-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.ds-form-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-hover);
}

.ds-form-section-header i {
    color: var(--accent-text);
    font-size: 1rem;
}

.ds-form-section-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.ds-form-section-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    margin: 0;
}

.ds-form-section-description {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin: 0.15rem 0 0 0;
}

.ds-form-section-body {
    padding: 1.25rem;
}

.ds-form-content {
    min-width: 0;
}

/* --- Grid de formulario responsive --- */
.ds-form-grid {
    display: grid;
    grid-template-columns: repeat(var(--ds-form-cols, 3), 1fr);
    gap: 1rem 1.25rem;
}

.ds-form-grid[data-cols="2"] { --ds-form-cols: 2; }
.ds-form-grid[data-cols="3"] { --ds-form-cols: 3; }

.ds-form-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ds-form-field.ds-span-2 { grid-column: span 2; }
.ds-form-field.ds-span-full { grid-column: 1 / -1; }

@media (max-width: 1023.98px) {
    .ds-form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639.98px) {
    .ds-form-grid { grid-template-columns: 1fr; }
    .ds-form-field.ds-span-2 { grid-column: auto; }
    .ds-form-section-header { align-items: flex-start; flex-wrap: wrap; }
    .ds-form-section-actions { width: 100%; margin-left: 0; }
    .ds-form-section-body { padding: 1rem; }
    .ds-form-section-actions .btn { flex: 1; justify-content: center; }
}

/* --- FormActions.razor --- */
.ds-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.5rem;
}

.ds-form-actions-leading {
    margin-right: auto;
}

.ds-form-actions-stacked {
    flex-direction: column-reverse;
    align-items: stretch;
}

.ds-form-actions-stacked .btn {
    width: 100%;
    justify-content: center;
}

@media (max-width: 639.98px) {
    .ds-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .ds-form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
