/* ==========================================================================
   1. RESET GENERAL Y CONFIGURACIÓN PANTALLA COMPLETA
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

input, select, textarea {
    font-size: 16px !important; /* Previene zoom en dispositivos móviles */
}

a {
    color: #f1c40f;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

a:hover {
    color: #e67e22;
    text-decoration: underline;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ==========================================================================
   2. LOGIN Y AUTENTICACIÓN
   ========================================================================== */
.body-login {
    background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url('../img/fondo-pesca.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    color: #ffffff;
}

.contenedor-auth {
    background-color: rgba(20, 20, 20, 0.92);
    border: 2px solid #f1c40f;
    padding: 35px 25px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
}

.logo-contenedor {
    text-align: center;
    margin-bottom: 25px;
}

.logo-contenedor h2 {
    font-size: 1.8rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logo-contenedor h2 span {
    color: #f1c40f;
}

.logo-contenedor p {
    color: #aaaaaa;
    font-size: 0.85rem;
    margin-top: 5px;
}

.grupo-input {
    margin-bottom: 18px;
}

.grupo-input label {
    display: block;
    margin-bottom: 6px;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
}

.grupo-input input {
    width: 100%;
    padding: 12px;
    background-color: #222222;
    border: 1px solid #444444;
    border-radius: 6px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.grupo-input input:focus {
    outline: none;
    border-color: #e67e22;
    box-shadow: 0 0 5px rgba(230, 126, 34, 0.5);
}

.btn-principal {
    width: 100%;
    padding: 14px;
    background-color: #f1c40f;
    color: #111111;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.btn-principal:hover {
    background-color: #e67e22;
    color: #ffffff;
}

.btn-principal:active {
    transform: scale(0.98);
}

.auth-enlaces {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}

.auth-enlaces p {
    color: #cccccc;
}

/* ==========================================================================
   3. LAYOUT DEL DASHBOARD Y BARRA SUPERIOR
   ========================================================================== */
.body-dashboard {
    background-color: #121212;
    color: #ffffff;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Elimina la barra de desplazamiento global de la pantalla */
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #111111;
    padding: 10px 20px;
    border-bottom: 2px solid #f1c40f;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-wrap: wrap;
    gap: 10px;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-logo img {
    max-height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

.navbar-logo img:hover {
    transform: scale(1.05);
}

.navbar-menu {
    display: flex;
    gap: 12px;
    align-items: center;
}

.navbar-menu a {
    color: #ffffff;
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.3s;
}

.navbar-menu a:hover {
    background-color: #333333;
    color: #f1c40f;
}

.navbar-usuario {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-usuario span {
    color: #cccccc;
    font-size: 0.85rem;
}

.btn-cerrar {
    background-color: #e67e22;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.btn-cerrar:hover {
    background-color: #d35400;
}

/* Contenedor Principal Ajustado */
.dashboard-contenedor {
    flex: 1;
    padding: 15px 20px;
    width: 100%;
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.encabezado-seccion {
    margin-bottom: 15px;
}

.encabezado-seccion h1 {
    font-size: 1.6rem;
    color: #ffffff;
}

.encabezado-seccion p {
    color: #aaaaaa;
    font-size: 0.9rem;
}

/* Grilla de Módulos */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    overflow-y: auto;
}

.tarjeta-modulo {
    background-color: #1e1e1e;
    border: 1px solid #333333;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.tarjeta-modulo:hover {
    transform: translateY(-4px);
    border-color: #f1c40f;
}

.tarjeta-modulo.destacado {
    border: 1px dashed #e67e22;
}

.tarjeta-modulo h3 {
    color: #f1c40f;
    margin-bottom: 10px;
    font-size: 1.15rem;
}

.tarjeta-modulo p {
    color: #cccccc;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
}

.btn-modulo {
    display: block;
    text-align: center;
    background-color: #333333;
    color: #ffffff;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    transition: background 0.3s;
}

.tarjeta-modulo:hover .btn-modulo {
    background-color: #f1c40f;
    color: #111111;
}

.tarjeta-modulo.destacado:hover .btn-modulo {
    background-color: #e67e22;
    color: #ffffff;
}

/* ==========================================================================
   4. INVENTARIO Y TABLA AJUSTADA A PANTALLA
   ========================================================================== */
.grid-contenedor-inventario {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 15px;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.layout-inventario {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 15px;
    align-items: start;
    height: 100%;
    overflow: hidden;
}

.formulario-carga, .tabla-inventario {
    background-color: #1e1e1e;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #333333;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.formulario-carga h3, .tabla-inventario h3 {
    color: #ffffff;
    margin-bottom: 12px;
    border-bottom: 2px solid #333333;
    padding-bottom: 6px;
    font-size: 1.1rem;
}

select {
    width: 100%;
    padding: 8px;
    background-color: #222222;
    border: 1px solid #444444;
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.9rem;
}

.btn-secundario {
    padding: 8px 12px;
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-secundario:hover {
    background-color: #d35400;
}

.bloque-calculos {
    background-color: #151515;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #f1c40f;
    margin-top: 12px;
}

.bloque-calculos h4 {
    color: #f1c40f;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

/* Tabla comprimida sin scroll horizontal */
.tabla-wrapper {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Elimina la barra horizontal */
    border-radius: 6px;
    border: 1px solid #333333;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    table-layout: auto;
    white-space: normal;
}

th, td {
    padding: 6px 8px !important;
    font-size: 0.8rem !important;
    border-bottom: 1px solid #333333;
    vertical-align: middle;
}

th {
    background-color: #151515;
    color: #aaaaaa;
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: #252525;
}

.col-imagen img {
    max-width: 38px;
    height: auto;
    border: 1px solid #444444;
    border-radius: 4px;
    transition: transform 0.2s;
}

.col-imagen img:hover {
    transform: scale(2.2);
    position: relative;
    z-index: 10;
}

.badge-categoria {
    background: #333333;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.status-alert { color: #e67e22; font-weight: bold; }
.status-ok { color: #27ae60; font-weight: bold; }

/* Botones en celdas de tabla */
td div[style*="display: flex"], td:last-child {
    display: flex !important;
    gap: 4px !important;
    flex-wrap: nowrap;
}

td button, td .btn {
    padding: 4px 6px !important;
    font-size: 0.75rem !important;
    white-space: nowrap;
}

/* ==========================================================================
   5. VENTANAS MODALES
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 15px;
}

.modal.mostrar {
    display: flex !important;
}

.modal-contenido {
    background-color: #1e1e1e;
    border: 2px solid #e67e22;
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    color: #ffffff;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.modal-contenido input, 
.modal-contenido select {
    width: 100% !important;
    box-sizing: border-box;
}

/* ==========================================================================
   6. ADAPTACIÓN PARA MÓVILES Y PANTALLAS PEQUEÑAS
   ========================================================================== */
@media screen and (max-width: 900px) {
    .body-dashboard {
        height: auto;
        min-height: 100vh;
        overflow-y: auto; /* Restablece scroll en móviles para legibilidad */
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
    }

    .navbar-container {
        flex-direction: column;
        gap: 10px;
    }

    .navbar-menu {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .navbar-usuario {
        justify-content: space-between;
        width: 100%;
        border-top: 1px solid #333;
        padding-top: 8px;
    }

    .grid-contenedor-inventario,
    .layout-inventario {
        grid-template-columns: 1fr !important;
        height: auto;
        overflow: visible;
    }

    .tabla-wrapper {
        overflow-x: auto; /* Permite desplazamiento horizontal seguro solo en celulares */
    }

    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    #btn_filtrar_stock_bajo {
        width: 100% !important;
        max-width: 100% !important;
    }
}