/* =====================================================
   Botones con más vida
   Tiene que cargarse DESPUÉS de style.css y productos.css
   ===================================================== */

/* Base: todos los botones se mueven suave y se "hunden" al apretarlos */
button {
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
                border-color 0.2s ease, color 0.2s ease, filter 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

button:active:not(:disabled) {
    transform: translateY(1px) scale(0.97);
}

button:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid rgba(83, 109, 254, 0.35);
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
}

/* ---------- Botón principal (Guardar, Agregar, Registrar, Ingresar) ---------- */
.btn-guardar,
.btn-principal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    color: white;
    background: linear-gradient(135deg, #536dfe, #7184ff);
    box-shadow: 0 4px 12px rgba(83, 109, 254, 0.3);
}

/* Rueda que gira mientras se está guardando (el botón queda deshabilitado) */
.btn-guardar:disabled::after,
.btn-principal:disabled::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: girar 0.7s linear infinite;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

/* ---------- Botones secundarios ---------- */
.btn-cancelar,
.btn-salir,
.btn-mini {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(20, 30, 60, 0.06);
}

.btn-mini {
    font-weight: 600;
}

/* ---------- Efectos al pasar el mouse (solo en PC, no molesta en el celular) ---------- */
@media (hover: hover) {
    .btn-guardar:hover:not(:disabled),
    .btn-principal:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(83, 109, 254, 0.4);
        filter: brightness(1.06);
    }

    .btn-cancelar:hover,
    .btn-salir:hover,
    .btn-mini:hover {
        border-color: var(--primary);
        background: #f4f6ff;
        color: var(--primary);
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(83, 109, 254, 0.15);
    }

    .btn-mini.peligro:hover {
        border-color: #f3b4ae;
        background: #fdecec;
        color: #b42318;
        box-shadow: 0 4px 10px rgba(180, 35, 24, 0.12);
    }

    .nav-link:hover {
        transform: translateX(3px);
    }

    .action-button:hover {
        box-shadow: 0 10px 22px rgba(83, 109, 254, 0.14);
    }

    .tab:hover:not(.active) {
        color: var(--text);
    }
}

/* Menú lateral y pestañas del login */
.nav-link {
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nav-link.active {
    font-weight: 600;
}

.tab {
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tab.active {
    box-shadow: 0 2px 6px rgba(20, 30, 60, 0.1);
}

/* Si la persona tiene activada la opción de "reducir movimiento", se apagan las animaciones */
@media (prefers-reduced-motion: reduce) {
    button,
    .nav-link,
    .action-button {
        transition: none;
    }

    .btn-guardar:disabled::after,
    .btn-principal:disabled::after {
        animation: none;
    }
}

/* =====================================================
   Formularios más visibles (Nombre, Código, Costo, etc.)
   ===================================================== */

/* El recuadro del formulario se distingue del resto: fondo suave y franja azul arriba */
.panel:has(> .form-grid) {
    background: linear-gradient(180deg, #eef1ff 0%, #ffffff 75%);
    border: 1px solid #d5dbfb;
    border-top: 4px solid var(--primary);
    box-shadow: 0 4px 16px rgba(83, 109, 254, 0.1);
}

.panel:has(> .form-grid) .form-title {
    font-size: 17px;
}

/* Las etiquetas (Nombre, Código...) más oscuras y en negrita */
.form-grid label {
    color: var(--text);
    font-weight: 600;
    font-size: 12.5px;
}

/* Los casilleros: fondo blanco, borde marcado y brillo azul al hacer clic */
.form-grid input,
.form-grid select {
    background: white;
    border: 1.5px solid #c3cbf4;
    box-shadow: 0 1px 3px rgba(83, 109, 254, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-grid input:hover,
.form-grid select:hover {
    border-color: #8f9ffa;
}

.form-grid input:focus,
.form-grid select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(83, 109, 254, 0.18);
}

/* En Productos y Clientes el botón va en su propia fila, más grande y fácil de encontrar */
form.form-grid .form-actions {
    grid-column: 1 / -1;
    margin-top: 4px;
}

form.form-grid .btn-guardar {
    padding: 14px 30px;
    font-size: 14px;
}

/* Un toque extra: las filas de las tablas se iluminan al pasar el mouse */
.tabla tbody tr:hover {
    background: #f8f9ff;
}
