html, body {
    width: 100%;
    height: 100%;
}

.fondo {
    position: relative;
    /* Usamos min-height para que si el contenido crece, el fondo también */
    min-height: 100vh; 
    width: 100%;
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Evitamos que el desenfoque del pseudo-elemento cree bordes blancos */
    overflow: hidden; 

    /* Moví el fondo aquí para que sea la base */
    background: url("../images/FONDO.jpg") no-repeat center center;
    background-size: cover;
}

.contenedor-volver {
    position: absolute;
    left: 20px;
    top: 35px;
    margin: 0;
    display: block;
    z-index: 10;
}

/* ---- Menu cards ---- */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.menu-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -100px;
}

.menu-logo {
    width: 300px;
    margin-bottom: 10px;
}

.menu-usuario-top {
    position: fixed;
    top: 18px;
    left: 20px;
    color: rgba(255,255,255,0.92);
    font-size: 17px;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
    letter-spacing: 0.5px;
    z-index: 100;
}

.menu-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.card-link {
    text-decoration: none;
}

.card-link:nth-child(1) .card-menu { animation-delay: 0s; }
.card-link:nth-child(2) .card-menu { animation-delay: 0.1s; }
.card-link:nth-child(3) .card-menu { animation-delay: 0.2s; }

.card-menu {
    background: rgba(255,255,255,0.92);
    border-radius: 12px;
    padding: 20px;
    width: 300px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: cardFadeIn 0.4s ease both;
}

.card-menu:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.card-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #1a252f;
    margin-bottom: 15px;
}

.card-btn {
    margin-top: auto;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.card-btn--orange { background: #f39c12; }
.card-btn--green  { background: #27ae60; }
.card-btn--blue   { background: #3498db; }

.toast-bienvenida {
    position: fixed;
    top: 25px;
    left: 25px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 16px 28px;
    border-radius: 14px;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    z-index: 100;
    opacity: 1;
    transition: opacity 1s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-footer {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 50;
}

.btn-logout {
    text-decoration: none;
    background: rgba(231,76,60,0.85);
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: background 0.2s ease;
}

.btn-logout:hover {
    background: rgba(192,57,43,0.95);
}

.menu-fecha {
    color: white;
    font-size: 20px;
    opacity: 0.75;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
    white-space: nowrap;
}
.contenedor-volver img {
    width: 60px;
    height: auto;
    cursor: pointer;
}

/* Capa de estilo Glassmorphism */
.fondo::before {
    content: "";
    position: absolute;
    /* Usamos inset: 0 como shorthand de top/left/right/bottom */
    inset: 0; 
    
    /* Un gradiente sutil suele verse más pro que un color sólido */
    background: radial-gradient(circle, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%);
    
    /* El blur es pesado para el procesador, 5px-8px es el punto dulce */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); /* Soporte para Safari */
    
    z-index: 1;
}

/* MUY IMPORTANTE: Tu caja de login/contenido debe tener esto */
.contenido {
    position: relative;
    z-index: 2; /* Para que quede por encima de la capa oscura */
}

.grupo_superior {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; 
}

/* Nuevo contenedor para poner los elementos en fila */
.fila_inputs {
    display: flex;
    flex-direction: row; /* Los pone uno al lado del otro */
    justify-content: center;
    align-items: flex-end; /* Alinea los fondos de los inputs */
    gap: 30px; /* Espacio entre el proveedor y el buscador */
    width: 100%;
    margin-bottom: 20px;
}

/* Ajuste para que los inputs no se vean tan pegados al borde */
.list {
    font-size: 18px; /* Un poco más pequeña para ahorrar espacio */
    padding: 10px 20px;
    width: 350px; /* Ancho fijo para que no se deformen */
    font-size: 20px;
    font-weight: 600;
    padding: 12px 25px;
    border-radius: 50px;
    border: 3px solid #f39c12;
    background-color: rgba(255, 255, 255, 0.95);
    color: #222;
    cursor: pointer;
    outline: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    width: 100%;
    /* Ajustamos el ancho para que se vea más ordenado */
    min-width: 400px; 
    max-width: 500px;
    box-sizing: border-box; /* Importante para el padding */
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Estilo para el Label */
.seleccione {
    background-color: rgba(0, 123, 255, 0.7);
    padding: 5px 15px;
    border-radius: 30px 30px 0 0;
    font-size: 18px; /* Tamaño equilibrado */
    color: #ffffff;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 800;          /* Muy negrita */
    text-transform: uppercase;  /* Mayúsculas para mayor impacto */
    letter-spacing: 3px;       /* Espaciado elegante entre letras */
    
    /* Triple sombra para asegurar que se lea sobre cualquier fondo */
    text-shadow: 2px 2px 0px #000, 
                 4px 4px 10px rgba(0,0,0,0.7);
    margin-bottom: 0px;
    display: inline-block;
    border-bottom: 3px solid #f39c12;
}

.list:hover {
    background-color: #ffffff;
    border-color: #e67e22;
    transform: scale(1.02); /* Crece un poquito al pasar el mouse */
}

.form-busqueda {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.aviso-busqueda {
    display: none;
    color: #c0392b;
    font-weight: bold;
    background: #fdecea;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 10px 20px;
    text-align: center;
}

/* Ajustamos el contenedor del botón para darle aire */
.contenedor-boton {
    margin-top: 190px; /* Incrementa este valor para bajarlo más */
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Color del placeholder cuando el select no ha cambiado */
select.list:invalid,
select.list option[value=""] {
    color: #999; 
}

/* Color de las opciones reales */
select.list option {
    color: #222;
}

/* Forzamos el tamaño del botón para que no crezca descontrolado */
.button_catalog img {
    width: 350px; /* Tamaño original sugerido */
    height: auto;
    transition: transform 0.3s ease;
}

.button_catalog:hover img {
    transform: scale(1.05); /* Efecto visual opcional */
}

.button_cursor {
    text-decoration: none;
    color: #4b0082; /* Púrpura */
    font-weight: bold;
    font-size: 0.9rem;
    padding: 6px 15px;
    border: 2px solid #4b0082; /* Borde del mismo color que el texto */
    border-radius: 20px;       /* Bordes redondeados para seguir la línea de los selectores */
    background-color: rgba(255, 255, 255, 0.8); /* Fondo blanco traslúcido */
    transition: all 0.3s ease;
    display: inline-block;
}

.button_cursor:hover {
    background-color: #4b0082; /* Se invierte al pasar el mouse */
    color: #ffffff;
    transform: translateY(-2px); /* Pequeño salto hacia arriba */
}

.button_catalog:hover img {
    transform: scale(1.05); /* Efecto visual opcional */
}

/*---------------------------- css para el login ----------------------------------- */

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-login {
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 18px;
    text-align: left;
}

.alert-error {
    background: #fdecea;
    border: 1px solid #e74c3c;
    color: #c0392b;
}

.alert-lockout {
    background: #fff8e1;
    border: 1px solid #f39c12;
    color: #7d5a00;
}


.fondo-login {
    background-image: url("../images/FONDO.jpg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center; /* Centrado horizontal real */
    align-items: center;     /* Centrado vertical real */
    position: relative;
}

/* Efecto de oscurecido y desenfoque sobre el fondo del login */
.fondo-login::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* Capa oscura */
    backdrop-filter: blur(5px);    /* Desenfoque suave */
    z-index: 1;
}

/* Ajuste de la tarjeta de Login */
.login-box {
    position: relative;
    z-index: 2;
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: loginFadeIn 0.45s ease;
}

/* Mejoramos los inputs para que no se vean tan cuadrados */
.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px; /* Redondeado igual que el resto de la web */
    outline: none;
    transition: 0.3s;
    box-sizing: border-box; /* Fundamental para que no se desborde el input */
}

.login-box h2 {
    margin-bottom: 30px;
    color: #333;
    font-weight: bold;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
}

.input-group input:focus {
    border-color: #f39c12; 
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #f39c12; 
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #e67e22;
}

.forgot-pass {
    display: block;
    margin-top: 15px;
    font-size: 13px;
    color: #3498db;
    text-decoration: none;
}

.logo {
    width: 190px;
}



/* --- AJUSTES PARA MÓVILES (Menú principal) --- */
@media (max-width: 768px) {

    /* El fondo deja de centrar verticalmente y permite scroll */
    .fondo {
        align-items: flex-start;
        overflow-y: auto;
    }

    /* El contenido ocupa todo el ancho y tiene padding para no quedar bajo el nombre fijo */
    .contenido {
        width: 100%;
        box-sizing: border-box;
        padding: 70px 16px 30px;
        display: flex;
        flex-direction: column;
    }

    .menu-usuario-top {
        font-size: 14px;
        top: 12px;
        left: 12px;
    }

    /* Saca el margin-top negativo que aprieta todo */
    .menu-wrapper {
        margin-top: 0;
        padding: 0;
        width: 100%;
    }

    .menu-logo {
        width: 160px;
        margin-bottom: 20px;
    }

    /* Cards en columna, estiradas al ancho completo */
    .menu-cards {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        width: 100%;
    }

    .card-link {
        display: block;
        width: 100%;
    }

    /* Card horizontal: ícono a la izquierda, texto + botón a la derecha */
    .card-menu {
        width: 100%;
        min-height: 80px;
        padding: 16px 20px;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 16px;
        text-align: left;
    }

    .card-icon {
        font-size: 32px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .card-title {
        font-size: 18px;
        margin-bottom: 6px;
        flex: 1;
    }

    .card-btn {
        font-size: 13px;
        padding: 8px 14px;
        width: auto;
        flex-shrink: 0;
    }

    /* Footer fluye debajo de las cards, deja de ser fixed */
    .menu-footer {
        position: static;
        transform: none;
        margin-top: 28px;
        padding-bottom: 10px;
        align-items: center;
    }

    .btn-logout {
        font-size: 18px;
        padding: 14px 36px;
    }

    .menu-fecha {
        font-size: 14px;
    }

    .card-menu {
        width: 85vw !important;
        min-height: 90px !important;
        padding: 12px !important;
    }

    .card-menu div:first-child {
        font-size: 28px !important;
    }

    .card-menu div:nth-child(2) {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }

    .card-menu div:last-child {
        font-size: 12px !important;
        padding: 7px !important;
    }

    div[style*="display: flex; gap: 20px"] {
        flex-direction: column !important;
        align-items: center !important;
    }
}

/* --- AJUSTES PARA MÓVILES (Index) --- */
@media (max-width: 768px) {
    .fila_inputs {
        flex-direction: column; /* Poner uno debajo del otro */
        align-items: center;
        width: 100%;
    }

    .list {
        min-width: unset !important; /* Quitar el mínimo de 400px */
        width: 90vw !important; /* Que ocupe el 90% del ancho del celu */
        max-width: 100%;
        font-size: 16px;
    }

    .contenedor-boton {
        margin-top: 50px; /* Bajarlo menos, para que no quede fuera de pantalla */
    }

    .button_catalog img {
        width: 80vw; /* El botón "Ver Catálogo" que se adapte al ancho */
    }

    .contenido {
        margin-bottom: 20px; /* Subir todo el bloque */
    }

    .contenedor-volver {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 999;
    }

    .contenedor-volver img {
        width: 45px;
    }

    /* --- Filas de productos en list.php --- */
    .contenido table {
        width: 100%;
        border-collapse: collapse;
    }

    .contenido table thead {
        display: none;
    }

    .contenido table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
        padding: 8px 4px;
        border-bottom: 1px solid #ddd;
    }

    /* Columna código + selector de listas */
    .contenido table td.codigo {
        flex: 0 0 auto;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0;
    }

    /* Columna detalle + % */
    .contenido table td:nth-child(2) {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0;
    }

    /* Columna imagen */
    .contenido table td:nth-child(3) {
        flex: 0 0 auto;
        padding: 0;
        text-align: center;
    }

    /* Columna precio */
    .contenido table td.precio {
        flex: 0 0 auto;
        padding: 0;
        text-align: right;
    }

    /* Imagen más pequeña (override de inline style) */
    .contenido table td img {
        width: 70px !important;
        height: auto;
    }

    .detalle {
        font-size: 13px;
        display: block;
    }

    .comision-fila {
        width: 46px !important;
        font-size: 12px !important;
        padding: 2px 4px !important;
    }

    .monto {
        font-size: 15px;
        font-weight: bold;
        white-space: nowrap;
    }

    .select-trigger {
        font-size: 11px;
        padding: 4px 6px;
    }

    .select-stock-mini {
        font-size: 11px;
        padding: 2px 4px;
        margin-bottom: 4px;
    }
}