/* ============================
   Estilos globales 
   ============================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: #F5F6FA;
  color: #333333;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: 'Poppins', sans-serif;
  color: #003B73;
  font-weight: 600;
}

p,
span,
label {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: #555555;
}

/* Botones generales */

.text-primary {
  color: #016462 !important;
}

button {
  background-color: #016462;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 500;
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1);
  transition: 0.3s;
  cursor: pointer;
}

button:hover {
  background-color: #016462;
}

/* Inputs */
input,
select,
textarea {
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  font-size: 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0099FF;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.2);
}

/* Tarjetas */
.card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  border: none;
}

/* Navbar */
.navbar {
  background-color: #ffffff !important;
  padding: 0.8rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.navbar .navbar-brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: #003B73 !important;
}

.navbar .navbar-brand .brand-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #003B73;
}

.navbar .nav-link {
  font-weight: 500;
  color: #444 !important;
  margin: 0 6px;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  background-color: #016462;
  color: #ffffff !important;
}

.navbar .nav-item {
  position: relative;
}

.navbar .nav-item:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background-color: #ddd;
}

.navbar .dropdown-menu {
  border-radius: 12px;
  border: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.navbar .dropdown-item {
  padding: 10px 16px;
  font-size: 0.95rem;
}

.navbar .dropdown-item:hover {
  background-color: #f0f8ff;
  color: #003B73 !important;
}

.navbar .user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 1rem;
  line-height: 1.2;
}

.navbar .user-info .name {
  font-weight: 600;
  color: #016462;
}

.navbar .user-info .role {
  font-size: 0.8rem;
  color: #888;
}

.login-wrapper {
  max-height: 80vh;
}

/* Login refinado */
.login-title {
  font-size: 1.4rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 1.5rem;
}

.alert-danger {
  background-color: #ffe5e5;
  color: #b02a37;
  border: 1px solid #f5c2c7;
  font-weight: 500;
  border-radius: 8px;
}

/* ============================
   Estilos Registro de Horario
   ============================ */
#fichaje-form input {
  font-size: 1.2rem;
  padding: 12px;
  border-radius: 12px;
}

.card.h-100 {
  display: flex;
  flex-direction: column;
}

.table {
  border-collapse: separate;
  border-spacing: 0 0px;
}

.table thead th {
  font-weight: 600;
  color: #555;
  border: none;
}

.table tbody tr {
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.table tbody td {
  border: none;
  padding: 12px 16px;
}

/* ============================
   Tabla de últimos fichajes (compacta)
   ============================ */
.fichajes-table {
  font-size: 0.85rem;
}

.fichajes-table th,
.fichajes-table td {
  padding: 6px 10px;
}

.fichajes-table .badge {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
}

/* Solo afecta a la vista de horario */
.horario-view {
  height: calc(75vh);
}

.horario-view .card.h-100 {
  height: 100%;
}

.badge-fijo {
  display: inline-block;
  min-width: 90px;
  text-align: center;
}

/* ============================
   Vista Gestión de Festivos
   ============================ */
.festivos-view {
  padding: 1rem;
}

.festivos-view h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: #003B73;
}

.festivos-view .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.festivos-view .controls label {
  font-weight: 500;
  color: #003B73;
}

.festivos-view #btnGuardar {
  background-color: #28a745;
  border-radius: 12px;
  font-weight: 600;
}

.festivos-view #btnGuardar:hover {
  background-color: #218838;
}

.festivos-view #contador {
  font-weight: bold;
  color: #fff;
}

.festivos-view #calendario {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* 4 meses por fila */
  gap: 1.5rem;
}

.festivos-view .mes {
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
  font-size: 0.9rem;
  transition: transform 0.2s;
}

.festivos-view .mes:hover {
  transform: translateY(-3px);
}

.festivos-view .mes h4 {
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 10px;
  color: #0099FF;
}

.festivos-view .dias-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-weight: 600;
  font-size: 0.7rem;
  color: #666;
  margin-bottom: 4px;
}

.festivos-view .mes-dias {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  /* 7 días de la semana */
  gap: 4px;
  justify-items: center;
  width: 100%;
}

.festivos-view .dia {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  margin: 2px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  transition: 0.2s;
}

.festivos-view .dia:hover {
  background-color: #f0f8ff;
  transform: scale(1.05);
}

.festivos-view .festivo {
  background-color: #E63946;
  color: #fff;
  font-weight: 600;
  box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
}

.festivos-view .dia.vacio {
  background: transparent;
  cursor: default;
  pointer-events: none;
}


/* ============================
   Vista Gestión de Contratos
   ============================ */
#contratosModal .modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.15);
}

#contratosModal .modal-header {
  background: linear-gradient(135deg, #0099FF, #007ACC);
  color: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

#contratosModal .modal-title {
  font-weight: 600;
  font-size: 1.2rem;
}

#contratosModal .form-label {
  font-weight: 500;
  color: #003B73;
}

#contratosModal .form-control {
  border-radius: 10px;
  font-size: 0.9rem;
}

#contratosModal #btnGuardarContrato {
  background-color: #0099FF;
  border-radius: 12px;
  font-weight: 600;
  padding: 10px 18px;
  transition: 0.3s;
}

#contratosModal #btnGuardarContrato:hover {
  background-color: #007ACC;
}

#contratosModal #btnCancelarEdicion {
  border-radius: 12px;
  font-weight: 500;
  padding: 10px 16px;
}

/* Tabla de contratos */
#contratosModal table {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.05);
}

#contratosModal thead {
  background-color: #F5F6FA;
}

#contratosModal thead th {
  font-weight: 600;
  font-size: 0.9rem;
  color: #003B73;
  border-bottom: 2px solid #e5e5e5;
}

#contratosModal tbody td {
  vertical-align: middle;
  font-size: 0.9rem;
  color: #555;
}

#contratosModal tbody tr:hover {
  background-color: #f8fbff;
}

/* Botones de acción */
#contratosModal .btn-warning {
  background-color: #ffc107;
  border: none;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 8px;
}

#contratosModal .btn-danger {
  background-color: #dc3545;
  border: none;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 8px;
}

#contratosModal .btn-warning:hover {
  background-color: #e0a800;
}

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

/* Modal confirmación eliminación */
#confirmDeleteModal .modal-content {
  border-radius: 14px;
  box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.15);
}

#confirmDeleteModal .modal-header {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  padding: 0.75rem 1rem;
}

#confirmDeleteModal .modal-body {
  font-size: 0.95rem;
  color: #444;
}

#confirmDeleteModal .btn-sm {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
}


/* ============================
   Vista Usuarios
   ============================ */
.usuarios-view h2 {
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
  font-weight: 600;
  color: #003B73;
}

.usuarios-view table {
  border-radius: 12px;
  overflow: hidden;
}

.usuarios-view thead {
  background-color: #F5F6FA;
}

.usuarios-view th {
  font-weight: 600;
  font-size: 0.9rem;
  color: #003B73;
}

.usuarios-view td {
  font-size: 0.9rem;
  color: #555;
}

.usuarios-view .btn-sm {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 8px;
}

#empleadoModal .modal-content {
  border-radius: 16px;
  box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.15);
}

#empleadoModal .modal-header {
  background: linear-gradient(135deg, #0099FF, #007ACC);
  color: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

#empleadoModal .modal-title {
  font-weight: 600;
}

#empleadoModal .form-label {
  font-weight: 500;
  color: #003B73;
}

/* ============================
   Vista de Usuarios
   ============================ */
.usuarios-view {
  padding: 1rem;
}

.usuarios-view h2 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #003B73;
}

.usuarios-view .nav-pills .nav-link {
  background-color: #0099FF;
  color: #fff;
  border-radius: 12px;
  font-weight: 500;
  transition: 0.3s;
}

.usuarios-view .nav-pills .nav-link:hover {
  background-color: #007ACC;
  color: #fff;
}

.usuarios-view #buscadorUsuarios {
  min-width: 240px;
  border-radius: 10px;
  font-size: 0.9rem;
}

/* Tabla */
.usuarios-view table {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.05);
}

.usuarios-view thead {
  background-color: #F5F6FA;
}

.usuarios-view thead th {
  font-weight: 600;
  color: #003B73;
  border: none;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.usuarios-view tbody td {
  vertical-align: middle;
  font-size: 0.9rem;
  color: #555;
  border: none;
}

.usuarios-view tbody tr {
  transition: background-color 0.2s;
}

.usuarios-view tbody tr:hover {
  background-color: #f8fbff;
}

/* Botones */
.usuarios-view .btn {
  border-radius: 8px;
  font-size: 0.8rem;
  padding: 6px 12px;
  font-weight: 500;
}

.usuarios-view .btn-warning {
  background-color: #ffc107;
  border: none;
}

.usuarios-view .btn-warning:hover {
  background-color: #e0a800;
}

.usuarios-view .btn-danger {
  background-color: #dc3545;
  border: none;
}

.usuarios-view .btn-danger:hover {
  background-color: #bb2d3b;
}

.usuarios-view .btn-info {
  background-color: #17a2b8;
  border: none;
}

.usuarios-view .btn-info:hover {
  background-color: #138496;
}

/* Modal confirmación eliminación */
#confirmDeleteUserModal .modal-content {
  border-radius: 14px;
  box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.15);
}

#confirmDeleteUserModal .modal-body {
  font-size: 0.95rem;
  color: #444;
}

#confirmDeleteUserModal .modal-footer .btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
}

/* ==== Gestión Horaria (estilos específicos) ==== */

/* Autocomplete */
#sugerencias {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-radius: .5rem;
  overflow: hidden;
}

#sugerencias .list-group-item {
  cursor: pointer;
}

#sugerencias .list-group-item:hover {
  background-color: rgba(13, 110, 253, .08);
}

/* Editables en modo readonly (roles no admin) */
.editable.readonly {
  cursor: default !important;
  color: inherit !important;
  text-decoration: none !important;
}

/* Tablas más limpias en esta vista */
#contenedorVista table th,
#contenedorVista table td {
  vertical-align: middle;
}

/* Botón borrar día */
.btn-borrar-dia {
  white-space: nowrap;
}

.btn-verde-registro {
  background-color: #318b87;
  color: #000000;
}

.btn-verde-entrada {
  background-color: #006661;
  color: #fff;
  transition: background-color 0.3s;
}

.btn-verde-entrada:hover {
  background-color: #003a3a;
  color: #fff;
  /* un tono más oscuro para el hover */
}

.btn-verde-salida {
  background-color: #00d9d9;
  color: #fff;
  transition: background-color 0.3s;
}

.btn-verde-salida:hover {
  background-color: #009e9e;
  color: #fff;
  /* un tono más oscuro para el hover */
}



/* Tabla de gestión: filas más bajas */
.table.tabla-gestion td,
.table.tabla-gestion th {
  padding-top: .35rem;
  padding-bottom: .35rem;
}

/* Botones compactos dentro de la tabla */
.tabla-gestion .btn-compact {
  --bs-btn-padding-y: .175rem;
  --bs-btn-padding-x: .5rem;
  --bs-btn-font-size: .85rem;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
}

/* Botón icono (papelera) súper estrecho */
.tabla-gestion .btn-icon {
  --bs-btn-padding-y: .175rem;
  --bs-btn-padding-x: .375rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Icono hereda color y tamaño proporcional */
.tabla-gestion .btn .bi {
  color: currentColor;
  font-size: .9em;
}

/* Quitar subrayado cuando .editable es botón */
.btn.editable,
.btn.editable:hover,
.btn.editable:focus {
  text-decoration: none !important;
}

/* Mantener subrayado solo en el caso antiguo (span) */
.editable:not(.btn) {
  text-decoration: underline;
}

.tabla-gestion .col-fecha .dow {
  display: inline-block;
  min-width: 1.2ch;
  /* ancho justo para una letra */
  text-align: center;
  font-weight: 600;
  margin-right: .35rem;
  color: #6c757d;
  /* gris suave Bootstrap */
}

/* ========== Submenú Gestión Horaria (scopeado) ========== */
.gh-submenu {
  --gh-accent: #006662;
  /* color de acento */
  --gh-bg: #ffffff;
  --gh-border: rgba(0, 0, 0, .12);
  --gh-hover: rgba(0, 0, 0, .04);
  --gh-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.gh-submenu .gh-pills {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  background: var(--gh-bg);
  padding: .5rem;
  border: 1px solid var(--gh-border);
  border-radius: .75rem;
  box-shadow: var(--gh-shadow);
  /* móvil: scroll horizontal suave si no cabe */
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x mandatory;
}

/* “Píldoras” */
.gh-submenu .gh-pill {
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .75rem;
  border: 1px solid var(--gh-border);
  border-radius: 9999px;
  background: #fff;
  color: #2b2b2b;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.gh-submenu .gh-pill:hover {
  background: var(--gh-hover);
}

.gh-submenu .gh-pill:focus {
  outline: none;
  box-shadow: 0 0 0 .2rem rgba(0, 102, 98, .15);
}

/* Variante primaria (acción principal) */
.gh-submenu .gh-pill.gh-primary {
  border-color: var(--gh-accent);
  color: var(--gh-accent);
}

.gh-submenu .gh-pill.gh-primary:hover {
  background: var(--gh-accent);
  border-color: var(--gh-accent);
  color: #fff;
}

/* Icono y texto dentro de la píldora */
.gh-submenu .gh-ico {
  font-size: 1rem;
  line-height: 1;
}

.gh-submenu .gh-text {
  line-height: 1;
}

/* Compactación progresiva en pantallas pequeñas */
@media (max-width: 576px) {
  .gh-submenu .gh-pill {
    padding: .4rem .6rem;
  }
}

@media (max-width: 420px) {

  /* ultra compacto: solo iconos; el tooltip visual lo da el texto accesible si lo añades con title="" */
  .gh-submenu .gh-text {
    display: none;
  }

  .gh-submenu .gh-pill {
    padding: .4rem .5rem;
  }
}

/* Mejor barra de scroll (opcional) en navegadores WebKit */
.gh-submenu .gh-pills::-webkit-scrollbar {
  height: 6px;
}

.gh-submenu .gh-pills::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
  border-radius: 6px;
}

.gh-submenu .gh-pills::-webkit-scrollbar-track {
  background: transparent;
}