/* ============================
   LOGIN STYLES - INICIO
   Basado en los colores del logo FERMAQ (verde + naranja)
   ============================ */

.login-page { min-height: 100vh; display:flex; align-items:center; justify-content:center; padding:2rem; background: linear-gradient(180deg, rgba(3,89,44,0.03) 0%, rgba(255,140,0,0.02) 100%); position:relative; overflow:hidden; }

.login-card { width:100%; max-width:920px; background:#fff; border-radius:14px; box-shadow:0 12px 30px rgba(18,38,63,0.08); display:grid; grid-template-columns:420px 1fr; overflow:hidden; }

.branding { background: linear-gradient(180deg, #0b7a3a 0%, #0a6d34 100%); color:#fff; padding:28px; display:flex; flex-direction:column; gap:18px; align-items:center; justify-content:center; text-align:center; }
.branding .logo { width:120px; height:auto; border-radius:8px; background: rgba(255,255,255,0.03); padding:8px; display:inline-flex; align-items:center; justify-content:center; }
.branding h2 { margin:0; font-size:20px; letter-spacing:0.4px; }
.branding p { margin:0; opacity:0.95; font-size:14px; }
.branding .accent { display:inline-block; margin-top:10px; background:#ff8c00; color:#fff; padding:6px 10px; border-radius:999px; font-weight:700; font-size:13px; }

.login-form { padding:28px 30px; display:flex; flex-direction:column; justify-content:center; gap:14px; }
.login-form h1 { margin:0 0 6px 0; font-size:20px; color:#17233a; }
.login-form .hint { color:#6b7280; font-size:13px; margin-bottom:10px; }

.form-group { margin-bottom:12px; }
.form-group label { display:block; margin-bottom:6px; font-weight:600; color:#374151; font-size:13px; }
.form-group input { width:100%; padding:12px 14px; border-radius:8px; border:1px solid #e6eef2; box-sizing:border-box; font-size:14px; background:#fbfeff; color:#0f1724; }

.form-actions { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-top:10px; }
.btn-primary { background: linear-gradient(90deg,#0b7a3a,#0a6d34); border:none; color:white; padding:10px 18px; border-radius:10px; font-weight:700; cursor:pointer; box-shadow:0 6px 16px rgba(11,122,58,0.16); }
.btn-primary:active { transform:translateY(1px); }
.btn-secondary { background:transparent; border:1px solid #d1e7dc; color:#0b7a3a; padding:8px 14px; border-radius:10px; font-weight:600; cursor:pointer; }

.login-footer { text-align:right; color:#94a3b8; font-size:12px; margin-top:8px; }

/* Mensajes flash estilo coherente */
.alert { padding:10px; border-radius:8px; font-weight:600; }
.alert-success { background:#d4edda; color:#155724; border:1px solid #c3e6cb; }
.alert-danger  { background:#f8d7da; color:#721c24; border:1px solid #f5c6cb; }

/* Marca de agua principal dentro del contenedor general (si está presente en la plantilla) */
.watermark { position:absolute; z-index:0; font-weight:700; font-size:72px; color:rgba(0,0,0,0.035); transform:rotate(-12deg); pointer-events:none; user-select:none; }

/* Responsive */
@media (max-width: 880px) {
    .login-card { grid-template-columns: 1fr; }
    .branding { padding: 18px; }
    .branding .logo { width: 96px; }
    .watermark { display:none; }
}

/* ============================
   LOGIN STYLES - FIN
   ============================ */



/* Estilos generales */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    /* CORRECCIÓN CRÍTICA: Asegura que la página ocupe al menos la altura visible. */
    min-height: 100vh; 
}

/* Encabezado (Header) */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo img {
    height: 40px;
}

nav {
    display: flex;
    align-items: center;
}

.nav-item {
    color: #555;
    text-decoration: none;
    padding: 10px 15px;
    font-weight: 500;
    transition: color 0.3s, background-color 0.3s;
    border-radius: 5px;
    display: flex;
    align-items: center;
}

.nav-item:hover {
    background-color: #eef1f0;
    color: #007bff;
}

.nav-item i {
    margin-right: 8px;
}

/* Dropdown para submenús */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 5px;
    top: calc(100% + 5px);
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Información del usuario y logout */
.user-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #777;
}

.user-info i {
    margin-right: 5px;
}

.logout-btn {
    background-color: #dc3545;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 5px;
    margin-left: 20px;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #c82333;
}

/* Contenedor principal */
.container {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Título de la página */
.page-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 700;
}

/* Cuadrícula del dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

/* Estilos de las tarjetas (cards) */
.card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #555;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.card p {
    margin: 0;
    font-size: 0.9em;
    color: #777;
}

.card-icon {
    font-size: 4em;
    color: #007bff;
    margin-top: 15px;
    transition: color 0.3s;
}

.card:hover .card-icon {
    color: #0056b3;
}

/* Estilos para los mensajes flash */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Estilos para formularios y tablas */
.table-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    /* CORRECCIÓN: Centra contenido verticalmente en la tabla (útil para iconos) */
    vertical-align: middle; 
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

tr:hover {
    background-color: #f9f9f9;
}

/* Estilos para botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
    /* CORRECCIÓN: Centra horizontalmente el contenido (icono y texto) */
    justify-content: center; 
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-edit {
    background-color: #28a745;
    color: white;
}

.btn-edit:hover {
    background-color: #218838;
}

.btn-search {
    background-color: #6c757d;
    color: white;
}

.btn-search:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

/* CORRECCIÓN: Estilos para centrar la caja de búsqueda y ordenar los filtros */
.search-box {
    display: flex;
    /* CRÍTICO: Centra el formulario de búsqueda horizontalmente */
    justify-content: center !important; 
    margin-bottom: 30px !important; /* Más espacio para separar de la tabla */
    align-items: center;
    padding: 15px;
    background-color: #eef1f0; /* Fondo sutil para el área de filtros */
    border-radius: 8px;
}

/* CRÍTICO: Aplica flexbox directamente al formulario para alinear inputs */
.search-box form {
    display: flex !important;
    flex-direction: row !important; /* Fuerza la disposición horizontal */
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important; /* Permite que se envuelvan en pantallas más pequeñas */
    justify-content: center !important; /* Centra los elementos envueltos */
}

/* Estilos de los inputs de búsqueda */
.search-box input,
.search-box select,
.search-box button {
    height: 40px !important; /* Asegura que todos los elementos tengan la misma altura */
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
    box-sizing: border-box; 
}

/* CORRECCIÓN FINAL: Limitar el ancho del campo de texto de búsqueda */
.search-box form input[name="busqueda_general"] {
    /* Forzamos un ancho máximo para que quepa el botón a su lado. */
    max-width: 250px !important; 
    width: 100% !important; /* Ajuste para asegurar que ocupe espacio, pero limitado por max-width */
}


/* Estilos para el botón de "Volver" */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: #0056b3;
}

/* Estilos para la sección de reporte */
.product-report-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.product-report-section h2 {
    color: #2c3e50;
    margin-top: 0;
}

.export-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    margin-bottom: 20px;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

/* Estilo para stock bajo en la tabla */
.stock-bajo {
    background-color: #ffcccc; /* Un color de fondo rojo claro */
}

/* Resaltar stock comprometido */
.stock-comprometido {
    color: #ff8c00; /* naranja */
    font-weight: 700;
}

.stock-simulado {
    color: #ff8c00;
    font-weight: 600;
}

/* Estilos generales */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    /* CORRECCIÓN CRÍTICA: Asegura que la página ocupe al menos la altura visible. */
    min-height: 100vh; 
}

/* Encabezado (Header) */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo img {
    height: 40px;
}

nav {
    display: flex;
    align-items: center;
}

.nav-item {
    color: #555;
    text-decoration: none;
    padding: 10px 15px;
    font-weight: 500;
    transition: color 0.3s, background-color 0.3s;
    border-radius: 5px;
    display: flex;
    align-items: center;
}

.nav-item:hover {
    background-color: #eef1f0;
    color: #007bff;
}

.nav-item i {
    margin-right: 8px;
}

/* Dropdown para submenús */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 5px;
    top: calc(100% + 5px);
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Información del usuario y logout */
.user-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #777;
}

.user-info i {
    margin-right: 5px;
}

.logout-btn {
    background-color: #dc3545;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 5px;
    margin-left: 20px;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #c82333;
}

/* Contenedor principal */
.container {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Título de la página */
.page-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 700;
}

/* Cuadrícula del dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

/* Estilos de las tarjetas (cards) */
.card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #555;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.card p {
    margin: 0;
    font-size: 0.9em;
    color: #777;
}

.card-icon {
    font-size: 4em;
    color: #007bff;
    margin-top: 15px;
    transition: color 0.3s;
}

.card:hover .card-icon {
    color: #0056b3;
}

/* Estilos para los mensajes flash */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Estilos para formularios y tablas */
.table-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    /* CORRECCIÓN: Centra contenido verticalmente en la tabla (útil para iconos) */
    vertical-align: middle; 
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

tr:hover {
    background-color: #f9f9f9;
}

/* Estilos para botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
    /* CORRECCIÓN: Centra horizontalmente el contenido (icono y texto) */
    justify-content: center; 
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-edit {
    background-color: #28a745;
    color: white;
}

.btn-edit:hover {
    background-color: #218838;
}

.btn-search {
    background-color: #6c757d;
    color: white;
}

.btn-search:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

/* CORRECCIÓN: Estilos para centrar la caja de búsqueda y ordenar los filtros */
.search-box {
    display: flex;
    /* CRÍTICO: Centra el formulario de búsqueda horizontalmente */
    justify-content: center !important; 
    margin-bottom: 30px !important; /* Más espacio para separar de la tabla */
    align-items: center;
    padding: 15px;
    background-color: #eef1f0; /* Fondo sutil para el área de filtros */
    border-radius: 8px;
}

/* CRÍTICO: Aplica flexbox directamente al formulario para alinear inputs */
.search-box form {
    display: flex !important;
    flex-direction: row !important; /* Fuerza la disposición horizontal */
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important; /* Permite que se envuelvan en pantallas más pequeñas */
    justify-content: center !important; /* Centra los elementos envueltos */
}

/* Estilos de los inputs de búsqueda */
.search-box input,
.search-box select,
.search-box button {
    height: 40px !important; /* Asegura que todos los elementos tengan la misma altura */
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
    box-sizing: border-box; 
}

/* CORRECCIÓN FINAL: Limitar el ancho del campo de texto de búsqueda */
.search-box form input[name="busqueda_general"] {
    /* Forzamos un ancho máximo para que quepa el botón a su lado. */
    max-width: 250px !important; 
    width: 100% !important; /* Ajuste para asegurar que ocupe espacio, pero limitado por max-width */
}


/* Estilos para el botón de "Volver" */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: #0056b3;
}

/* Estilos para la sección de reporte */
.product-report-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.product-report-section h2 {
    color: #2c3e50;
    margin-top: 0;
}

.export-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    margin-bottom: 20px;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}