/* ========================================
   COMPONENTES - FORMULARIOS
   ======================================== */

/* Contenedor de formulario */
.form-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin: 2rem 0;
}

/* Grupos de formulario */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Etiquetas */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: block;
}

.form-label.required::after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

/* Campos de entrada */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
    background: #f8f9fa;
}

.form-control:invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-control:valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Campos deshabilitados */
.form-control:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Campos de solo lectura */
.form-control[readonly] {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Textarea */
.form-control[type="textarea"],
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Select */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Checkbox y radio */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: #3498db;
    border-color: #3498db;
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
}

.form-check-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
}

/* Input groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.input-group .form-control:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.input-group-text {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #6c757d;
    padding: 0.75rem 1rem;
    font-weight: 500;
}

/* Mensajes de validación */
.form-text {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.text-muted {
    color: #6c757d !important;
}

.text-success {
    color: #27ae60 !important;
}

.text-danger {
    color: #e74c3c !important;
}

.text-warning {
    color: #f39c12 !important;
}

.text-info {
    color: #17a2b8 !important;
}

/* Alertas de formulario */
.alert {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Formularios horizontales */
.form-horizontal .form-group {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.form-horizontal .form-label {
    width: 150px;
    margin-bottom: 0;
    margin-right: 1rem;
}

.form-horizontal .form-control {
    flex: 1;
}

/* Formularios en línea */
.form-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
        margin: 1rem 0;
    }

    .form-horizontal .form-group {
        flex-direction: column;
        align-items: stretch;
    }

    .form-horizontal .form-label {
        width: auto;
        margin-bottom: 0.5rem;
        margin-right: 0;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
}
