/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.4s ease-in-out;
  color: #222;
}

/* Logo superior */
header {
  position: absolute;
  top: 20px;
  left: 0;
  z-index: 10;
  background: transparent;
}

.loading-state {
    opacity: 0.3;
}

.ocultar {
    opacity: 0;
    visibility: hidden;
}

#logo-container {
  position: relative;
  background-color: rgba(49, 45, 85, 0.95);
  padding: 1rem;
  border-top-right-radius: 2rem;
  border-bottom-right-radius: 2rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
}

#logo {
  max-width: 80%;
  max-height: 80%;
}

/* Login screen */
.screen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: calc(100vh - 100px);
}

.form-block-login {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.form-block-login h2 {
  margin-bottom: 1rem;
}

.form-block-login img {
  height: 60px;
  margin: 1rem 0;
}

.form-fields {
  margin-top: 1rem;
}

.form-fields-row {
  margin-bottom: 1rem;
}

.form-fields-row input {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
}

.form-btn {
  padding: 0.8rem;
  width: 100%;
  background-color: #3c3d91;
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.form-btn:hover {
  background-color: #2a2b6d;
}

.error {
  color: red;
  margin-top: 0.5rem;
}

/* Layout después del login */
.layout {
  display: flex;
  height: calc(110vh - 100px);
  overflow: hidden;
}

/* Menú lateral */
.sidebar {
  width: 240px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10rem 2rem;
}

.sidebar h2 {
  font-size: 1.2rem;
  color: #ffc107;
  margin-bottom: 1.5rem;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar li {
  margin-bottom: 1rem;
}

.sidebar a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  display: block;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.sidebar a:hover {
  background-color: #444;
}

/* Contenedor dinámico */
.content {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.95);
  transition: opacity 0.3s ease;
}

.campanias-list {
  list-style: none;
  padding: 0;
}

.campania-item {
  padding: 1rem;
  background: #eee;
  margin-bottom: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.campania-item:hover {
  background: #ddd;
}

body.login-fondo {
  background-image: url('/img/bglosgallos.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.4s ease-in-out;
}

body.campania-fondo {
  background-image: url('/img/bglosgallos.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.4s ease-in-out;
}



/*Sorteos*/
main#content {
  padding: 2rem;
  font-family: Arial, sans-serif;
}

.sorteo-container {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 500px;
  margin: auto;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.sorteo-container h2 {
  text-align: center;
  margin-bottom: 1rem;
}

.sorteo-container select,
.sorteo-container input {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.sorteo-container button {
  background-color: #28a745;
  color: white;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
}

.sorteo-container button:hover {
  background-color: #218838;
}

.hidden {
  display: none;
}


/*Canje*/
main#content {
  padding: 2rem;
  font-family: Arial, sans-serif;
}

.canje-container {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 500px;
  margin: auto;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.canje-container h2 {
  text-align: center;
  margin-bottom: 1rem;
}

.canje-container select,
.canje-container input {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.canje-container button {
  background-color: #28a745;
  color: white;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
}

.canje-container button:hover {
  background-color: #218838;
}

.hidden {
  display: none;
}


/*Cambio contraseña*/
/* Estilos del botón */
.btn-primary {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.btn-primary:hover {
  background-color: #0056b3;
}

/* Estilos del modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  font-family: Arial, sans-serif;
}

.modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.close-modal {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

.form-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.modal-footer {
  border-top: 1px solid #ddd;
  padding-top: 15px;
  text-align: right;
}

.btn-guardar {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.btn-guardar:hover {
  background-color: #218838;
}

.mensaje-error {
  color: red;
  font-weight: bold;
  margin-top: 10px;
}

.mensaje-exito {
  color: green;
  font-weight: bold;
  margin-top: 10px;
}

.hidden {
  display: none;
}


/*Gestion de Cartillas*/
.estilo-input {
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.screen-cartilla
{
  width: auto;
  height: auto;
  margin: auto;
  padding: 10px;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border: none;
  text-align: center;
  -webkit-user-select: none;
  -moz-user-select: moz-none;
  -ms-user-select: none;
  user-select: none;
}

.stock-resumen-container {
  display: flex;
  justify-content: space-between;
  margin: 6px auto;
  max-width: 800px;
  gap: 12px;
  font-family: 'Segoe UI', sans-serif;
  transition: opacity 0.3s ease;
}

.stock-box {
  flex: 1;
  color: #fff;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}


.stock-box.azul {
    background-color: #314781;
}

.stock-box.verde {
    background-color: #157432;
}

.stock-box.rojo {
    background-color: #C02617;
}

.stock-box.silver {
  background-color: #6b6667;
}

.mensaje-asignacion {
  margin-top: 10px;
  color: green;
  font-weight: bold;
}

#asignacion-cartillas {
  margin-top: 1px;
  overflow-x: auto; 
  margin-left: auto;
  margin-right: auto;
  padding: 10px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cartilla-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px; 
  font-size: 14px;
  color: #333;
  border: 1px;
    border-color: #1d20d8a1;
}

.cartilla-table thead tr {
  background-color: #0078d7; 
  color: white;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
}

.cartilla-table thead th {
  padding: 12px 8px;
}

.cartilla-table tbody tr {
  background-color: #f9f9f9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 6px;
  transition: background-color 0.3s ease;
}

.cartilla-table tbody tr:hover {
  background-color: #e6f0fa;
}

.cartilla-table tbody td {
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
  border: none;
  word-break: break-word;
}

.cartilla-table input[type="number"],
.cartilla-table select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 120px;
  box-sizing: border-box;
  font-size: 13px;
  transition: border-color 0.2s ease;
}

.cartilla-table input[type="number"]:focus,
.cartilla-table select:focus {
  outline: none;
  border-color: #0078d7;
  box-shadow: 0 0 4px rgba(0,120,215,0.5);
}

@media (max-width: 480px) {
  .cartilla-table thead {
    display: none;
  }
  .cartilla-table tbody tr {
    display: block;
    margin-bottom: 15px;
  }
  .cartilla-table tbody td {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
  }
  .cartilla-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #555;
  }
  .cartilla-table tbody td:last-child {
    border-bottom: 0;
  }
}

.color-cartilla.estilizado {
  padding: 6px 10px;
  border: 2px solid #007bff;
  border-radius: 6px;
  font-weight: bold;
  background-color: #fff;
  color: #333;
}
.color-cartilla.estilizado option[value="azul"] { color: #007bff; }
.color-cartilla.estilizado option[value="verde"] { color: #28a745; }
.color-cartilla.estilizado option[value="rojo"] { color: #dc3545; }

.btn-detalle-canjeados {
  padding: 6px 12px;
  background-color: #343a40; 
  color: #fff;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-detalle-canjeados:hover {
  background-color: #495057; 
}


.btn-asignar-cartilla {
  margin-top: 5px;
  padding: 6px 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.btn-asignar-cartilla:hover {
  background-color: #0056b3;
}


/* --- Estilos para ver_canjes.php y canje_reporte.php --- */

.canje-container {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    margin: 2rem auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

#btn-ver-canje {
    background-color: #007bff;
    color: white;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    margin-top: 1rem;
}

#btn-ver-canje:hover {
    background-color: #0056b3;
}


/* Estilos para canje_reporte.php */
.vercanjes-titulo {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.kpi-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.table-vercanjes {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.table-vercanjes thead tr {
    background-color: #3c3d91;
    color: white;
}

.table-vercanjes th,
.table-vercanjes td {
    padding: 10px;
    text-align: left;
    border: 1px solid #ddd;
}

.table-vercanjes th {
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-vercanjes tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

.table-vercanjes tbody tr:hover {
    background-color: #e9ecef;
}

@media (max-width: 768px) {
    .kpi-container {
        flex-direction: column;
        align-items: center;
    }
    .table-vercanjes, .table-vercanjes thead, .table-vercanjes tbody, .table-vercanjes th, .table-vercanjes td, .table-vercanjes tr {
        display: block;
    }
    .table-vercanjes thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .table-vercanjes tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }
    .table-vercanjes td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    .table-vercanjes td::before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
    }
}

.reporte-canjes-container {
    padding: 2rem;
}

.vercanjes-titulo {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 2rem;
}

.filtros-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filtros-container label {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.filtros-container input[type="date"],
.filtros-container select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

#aplicar-filtros {
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

#aplicar-filtros:hover {
    background-color: #0056b3;
}

.kpi-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.kpi-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    color: #ffffff;
    font-weight: 600;
}

.kpi-box.titulo {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.kpi-box.kpi-azul {
    background-color: #314781;
}

.kpi-box.kpi-verde {
    background-color: #157432;
}

.kpi-box.kpi-rojo {
    background-color: #C02617;
}

.table-container {
    overflow-x: auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-vercanjes {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-vercanjes thead tr {
    background-color: #3c3d91;
    color: white;
}

.table-vercanjes th,
.table-vercanjes td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
    min-width: 120px;
}

.table-vercanjes th {
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-vercanjes tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

.table-vercanjes tbody tr:hover {
    background-color: #e9ecef;
}

@media (max-width: 768px) {
    .filtros-container {
        flex-direction: column;
        align-items: stretch;
    }
    .kpi-container {
        flex-direction: column;
        align-items: center;
    }
    .table-vercanjes, .table-vercanjes thead, .table-vercanjes tbody, .table-vercanjes th, .table-vercanjes td, .table-vercanjes tr {
        display: block;
    }
    .table-vercanjes thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .table-vercanjes tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }
    .table-vercanjes td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    .table-vercanjes td::before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
    }
}


/*Stock Admin*/
/* FORMULARIO HORIZONTAL */

.admin-stock-form-container form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.admin-stock-form-container .form-group {
    flex: 1 1 45%; /* dos columnas */
    display: flex;
    flex-direction: column;
}

.admin-stock-form-container .form-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.admin-stock-form-container .form-group input,
.admin-stock-form-container .form-group select {
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box;
}

/* Botones alineados horizontalmente */
.admin-stock-form-container .button-group {
    flex: 1 1 100%;
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 10px;
}

.btn-guardar,
.btn-primary,
.btn-nuevo {
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

.btn-guardar {
    background-color: #28a745;
    color: white;
}

.btn-guardar:hover {
    background-color: #218838;
}

/* MENSAJES */
.mensaje-exito {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    margin-bottom: 15px;
    border-left: 5px solid #28a745;
    border-radius: 4px;
}

.mensaje-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    margin-bottom: 15px;
    border-left: 5px solid #dc3545;
    border-radius: 4px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .admin-stock-form-container .form-group {
        flex: 1 1 100%;
    }

    .admin-stock-form-container .button-group {
        flex-direction: column;
        align-items: stretch;
    }
}
