/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex; /* Mantenemos flex para controlar el flujo general */
  flex-direction: column; /* Apilamos los elementos verticalmente */
  font-family: Arial, sans-serif;
  background-color: #f4f6f8;
  margin: 0;
  padding: 0;
  padding-top: 110px;
  overflow: hidden;
}

/*
body-top{
    padding-top: 110px;
}
*/

header {
  gap: 15px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #711f91;
  z-index: 1000;
  padding: 25px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #ccc;
  color: white;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-logo {
  height: 60px;
  width: auto;
}

.header-buttons button {
  background-color: #ff0072;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
}

.header-buttons button:hover {
  background-color: #4e2670;
}




.header-user-photo {
  position: absolute;
  top: 20px;
  right: 20px;
}

.header-user-area {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 15px; /* espacio entre foto y botón */
}

.user-circle-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  cursor: pointer;
}

.logout-btn {
  background-color: #e74c3c;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.logout-btn:hover {
  background-color: #c0392b;
}



/* ||||| PÁGINA DEL LOGIN ||||| */

/* Imagen de fondo oculta por defecto */
.imagen-fondo {
  display: none;
}

/* Video de fondo por defecto */
.video-fondo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
}

/* Contenedor del login */
.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  margin: 100px auto;
  background: rgba(0, 0, 0, 0.6);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  color: #fff;
}

.login-logo {
  width: 150px;
  margin-bottom: 20px;
}

.login-container input[type="text"],
.login-container input[type="password"] {
  width: 100%;
  padding: 5px;
  margin: 15px 0;
  border: none;
  border-radius: 5px;
  font-size: 18px;
}

.login-container button {
  width: 100%;
  padding: 10px;
  background-color: #ff0072;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.login-container button:hover {
  background-color: #4e2670;
}

/* ========================
   MEDIA QUERY PARA MÓVILES
=========================== */
@media screen and (max-width: 768px) {
  .video-fondo {
    display: none;
  }
  
  .imagen-fondo {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('../assets/img/fondo_login_movil.jpg'); /* Asegúrate que sea una imagen */
    background-size: cover;
    background-position: center;
    z-index: -1;
  }

  .login-container {
    width: 100%;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column; /* para apilar logo, título y form */
    justify-content: center; /* centra verticalmente */
    align-items: center; /* centra horizontalmente */
    height: 100vh; /* ocupa toda la pantalla */
    margin: 0 auto; /* eliminamos margen forzado */
  }


  .login-logo {
    width: 130px;
    margin-bottom: 20px;
  }

  .login-container input[type="text"],
  .login-container input[type="password"] {
    font-size: 18px;
    padding: 15px;
  }

  .login-container button {
    font-size: 18px;
    padding: 14px;
  }
}

/* |||||||||||||  FORMATO MODALES  ||||||||||||||| */

/* Estilos para el modal */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  padding-top: 60px;
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto; /* 5% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 80%; /* Could be more or less, depending on screen size */
  max-width: 600px; /* Ajuste para el formulario */
  border-radius: 10px;
  position: relative;
}


.close-button {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close-button:hover,
.close-button:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* |||||||||||||  MAIN  |||||||||||| */

/*Cuadro blanco detrás de tabla - tipo panel*/
#main-usuarios, #main-proveedores {
  width: calc(100% - 60px); /* Ajustamos para dejar margen a los lados */
  max-width: 1200px; /* Un max-width razonable para el main */
  margin: 30px auto; /* Centrar y dar margen arriba/abajo */
  padding: 30px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden; /* Esto es importante para que el scroll del contenedor de la tabla funcione bien */
  flex-grow: 1; /* Permite que main-usuarios ocupe el espacio restante */
}




/* USUARIOS Y COMPRAS*/

/* Contenedor para el formulario de búsqueda y el botón de agregar usuario */
.top-controls {
  display: flex;
  justify-content: space-between; /* Distribuye el espacio entre los elementos */
  align-items: center; /* Alinea verticalmente los elementos */
  margin-bottom: 20px; /* Espacio debajo de este bloque */
  flex-wrap: wrap; /* Permite que los elementos se envuelvan en pantallas pequeñas */
  gap: 15px; /* Espacio entre los elementos cuando se envuelven */
}


/*Formulario de busqueda*/
.search-form {
  display: flex;
  gap: 15px;
  flex-grow: 1; /* Permite que el formulario de búsqueda crezca para ocupar espacio */
  max-width: 60%; /* Limita el ancho máximo para que el botón "Agregar usuario" quepa al lado */
  min-width: 280px; /* Ancho mínimo para el formulario de búsqueda */
}

.search-form input[type="text"] {
  padding: 14px 18px;
  flex-grow: 1; /* Permite que el input crezca */
  border-radius: 10px;
  border: 2px solid #ccc;
  font-size: 18px;
  min-width: 150px; /* Asegura un ancho mínimo para el input */
}

.search-form button {
  background-color: #0056b3;
  color: white;
  border: none;
  padding: 14px 25px;
  font-size: 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
}

.search-form button:hover {
  background-color: #1f6391;
}



/* Botón "Agregar usuario" */
.admin-btn-add, .btn-compras { /* Nueva clase para diferenciarlo del botón de formulario-row */
  background-color: #0056b3;
  color: white;
  font-size: 18px;
  border: none;
  border-radius: 10px;
  padding: 14px 25px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  white-space: nowrap; /* Evita que el texto se rompa */
}




/* Tabla proveedores*/

.tabla-proveedores-contenedor,
.tabla-usuarios-contenedor {
  overflow-x: auto; /* Scroll horizontal */
  overflow-y: auto; /* Scroll vertical */
  max-height: 70vh; /* Altura máxima antes de scroll */
  -webkit-overflow-scrolling: touch;
  margin-top: 20px;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.tabla-proveedores, 
.tabla-usuarios {
  width: 100%;
  border-collapse: separate; /* importante para sticky */
  font-size: 17px;
  min-width: 800px;
}

.tabla-proveedores th,
.tabla-proveedores td,
.tabla-usuarios th,
.tabla-usuarios td  {
  border: 1px solid #ddd;
  padding: 16px 20px;
  text-align: center;
  white-space: nowrap;
}



.tabla-proveedores tbody tr:nth-child(even),
.tabla-usuarios tbody tr:nth-child(even) {
  background-color: #f2f2f2;
}

/* Cabecera fija */
.tabla-proveedores thead th,
.tabla-usuarios thead th {
  position: sticky;
  top: 0;
  background-color: #b55fff; /* color de cabecera */
  color: white;
  z-index: 2; /* encima del contenido */
}

/* Columna de acciones fija a la derecha */
.tabla-proveedores th.col-acciones-proveedores,
.tabla-proveedores td.col-acciones-proveedores,
.tabla-usuarios th.col-acciones-usuarios,
.tabla-usuarios td.col-acciones-usuarios  {
    position: sticky;
    right: 0; 
    background-color: #f9f3ff; /* fondo blanco para que no se mezcle al hacer scroll */
    z-index: 11; /* z-index mayor que las filas */
    box-shadow: -2px 0 5px -2px rgba(0,0,0,0.3); /* sombra opcional */
    border-left: 1px solid #ddd; /* Separador visual */
}
.tabla-proveedores th.col-acciones-proveedores,
.tabla-usuarios th.col-acciones-usuarios {
    position: sticky;
    color: #000;
    right: 0; 
    background-color: #f9f3ff; /* fondo blanco para que no se mezcle al hacer scroll */
    z-index: 12; /* z-index mayor que las filas */
    box-shadow: -2px 0 5px -2px rgba(0,0,0,0.3); /* sombra opcional */
    border-left: 1px solid #ddd; /* Separador visual */
}

/* Evita que botones se rompan */
.col-acciones-proveedores .btn-editar,
.col-acciones-proveedores .btn-eliminar,
.col-acciones-usuarios .btn-editar,
.col-acciones-usuarios .btn-eliminar {
  white-space: nowrap;
}


.modal-content h3 {
    margin-bottom: 25px;
    font-size: 28px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    text-align: center;
}

.modal-content .form-row {
    margin-bottom: 18px;
}

.modal-content .form-row label {
    margin-bottom: 8px;
  font-weight: bold;
  color: #333;
  font-size: 15px;
}

.modal-content .form-row input,
.modal-content .form-row select {
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 5px;
    width: 100%;
    border: 1px solid #ccc;
}

.modal-content button[type="submit"] {
    background-color: #ff0072;
    color: white;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    padding: 15px 25px;
    cursor: pointer;
    width: 250px;
    margin-top: 20px;
}

.modal-content button[type="submit"]:hover {
    background-color: #ff0055;
}


    .admin-btn {
        background-color: #4e2670;
        color: white;
        padding: 10px 16px;
        border-radius: 10px;
        text-decoration: none;
        font-weight: bold;
        font-size: 15px;
        display: inline-block;
        text-align: center;
        transition: background-color 0.3s ease;
    }


    .admin-btm-eliminar{
        width: 50px;
    }

/* Reset para botones de acciones */
.col-acciones-proveedores .btn-editar,
.col-acciones-proveedores .btn-eliminar,
.col-acciones-usuarios .btn-editar,
.col-acciones-usuarios .btn-eliminar {
  background: none;   /* Quita fondo */
  border: none;       /* Quita borde */
  padding: 0;         /* Elimina espacio extra */
  margin: 0;
  cursor: pointer;    /* Mantiene puntero de clic */
  display: inline-flex; /* Importante para que el img no se rompa */
  align-items: center;
  justify-content: center;
}

.col-acciones-proveedores .btn-editar img,
.col-acciones-proveedores .btn-eliminar img,
.col-acciones-usuarios .btn-editar img,
.col-acciones-usuarios .btn-eliminar img {
  height: 30px;
  width: auto;
}


.col-acciones-proveedores .btn-editar:hover img,
.col-acciones-usuarios .btn-editar:hover img {
  filter: brightness(0.8);
}

.col-acciones-proveedores .btn-eliminar:hover img,
.col-acciones-usuarios .btn-eliminar:hover img {
  transform: scale(1.1);
}