/* ============================================================
   FORMULARIOS — SIGv
   Estilos globales para todos los formularios del sistema.
   Incluye inputs, selects, textareas, switches y fieldsets.
============================================================ */

/* ---------------------------
   Contenedor general
--------------------------- */
.form-container {
    background: #ffffff;
    padding: 20px 22px;
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 3px 8px rgba(0,0,0,0.12));
    margin-bottom: 20px;
}

/* ---------------------------
   Etiquetas
--------------------------- */
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text, #2c3e50);
}

/* ---------------------------
   Inputs básicos
--------------------------- */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Hover */
input:hover,
select:hover,
textarea:hover {
    border-color: var(--color-vino, #6f1d1b);
}

/* Focus */
input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-vino, #6f1d1b);
    box-shadow: 0 0 0 3px rgba(111, 29, 27, 0.25);
}

/* Textarea */
textarea {
    min-height: 90px;
    resize: vertical;
}

/* ---------------------------
   Inputs deshabilitados
--------------------------- */
input:disabled,
select:disabled,
textarea:disabled {
    background: #f0f0f0;
    color: #777;
    cursor: not-allowed;
}

/* ---------------------------
   Select (flecha custom)
--------------------------- */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236f1d1b' stroke-width='2'/ %3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* ---------------------------
   Checkbox y radios
--------------------------- */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--color-vino, #6f1d1b);
    transform: scale(1.1);
    margin-right: 6px;
}

/* ---------------------------
   Switch (interruptor)
--------------------------- */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.switch input {
    appearance: none;
    width: 38px;
    height: 20px;
    background: #bdbdbd;
    border-radius: 999px;
    position: relative;
    transition: background 0.25s ease;
}

.switch input::after {
    content: "";
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: transform 0.25s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.switch input:checked {
    background: var(--color-verde, #1abc9c);
}

.switch input:checked::after {
    transform: translateX(18px);
}

/* ---------------------------
   Fieldsets
--------------------------- */
fieldset {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

fieldset legend {
    font-size: 14px;
    font-weight: 600;
    padding: 0 8px;
    color: var(--color-vino, #6f1d1b);
}

/* ---------------------------
   Layout de formulario
--------------------------- */
.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Espacio entre elementos */
.form-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ---------------------------
   Botones dentro de formularios
--------------------------- */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.form-actions .btn {
    min-width: 120px;
}

/* ---------------------------
   Validaciones visuales
--------------------------- */
input.error,
select.error,
textarea.error {
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211,47,47,0.25);
}

.form-error {
    color: #d32f2f;
    font-size: 13px;
    margin-top: -4px;
}

/* ---------------------------
   Mensaje de éxito
--------------------------- */
.form-success {
    color: #2e7d32;
    font-size: 14px;
    font-weight: 600;
}

/* ---------------------------
   Responsive
--------------------------- */
@media (max-width: 600px) {
    .form-container {
        padding: 16px;
    }
}
