/* ===============================
   Reset y estilo base
================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background-color: #f4f6f8;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
}

/* ===============================
   Contenedores
================================ */
.login-container,
.panel-container {
  background-color: #ffffff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 95%;
  max-width: 900px;
  text-align: center;
  margin: 1rem auto;
}

/* Títulos */
h1 {
  margin-bottom: 1.5rem;
  color: #1a73e8;
}

h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #1a73e8;
}

/* ===============================
   Inputs y botones
================================ */
.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

.input-field:focus {
  outline: none;
  border-color: #1a73e8;
}

.btn-primary {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  background-color: #a0c0f0;
  cursor: not-allowed;
}

/* ===============================
   Panel empleado: botones fichaje
================================ */
.fichaje-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.fichaje-buttons button {
  flex: 1;
  padding: 0.75rem 0;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #fff;
  background-color: #1a73e8;
}

.fichaje-buttons button.active,
.fichaje-buttons button:disabled {
  background-color: #a0c0f0;
  cursor: not-allowed;
}

/* ===============================
   Historial y contador
================================ */
#contadorHoras {
  margin-bottom: 1rem;
  font-weight: bold;
}

/* Contenedor historial (SIN scroll horizontal) */
.historial-container {
  width: 100%;
  margin: 1rem auto;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden; /* 🔑 eliminamos scroll lateral */
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background-color: #fff;
}

/* Tabla adaptable */
.historial-table {
  width: 100%;
  table-layout: fixed; /* 🔑 fuerza reparto de columnas */
  border-collapse: separate;
  border-spacing: 0;
}

.historial-table thead th {
  position: sticky;
  top: 0;
  background-color: #1a73e8;
  color: #fff;
  z-index: 2;
  padding: 0.6rem;
}

.historial-table th,
.historial-table td {
  padding: 0.6rem 0.4rem;
  text-align: center;
  word-break: break-word; /* 🔑 evita desbordes */
  white-space: normal;
  font-size: 0.95rem;
}

.historial-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* ===============================
   Mensajes de error
================================ */
.error {
  color: red;
  margin-top: 1rem;
}

/* ===============================
   Botón Cerrar sesión
================================ */
.btn-logout {
  width: 100%;
  padding: 0.75rem 0;
  margin-top: 2rem;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  background-color: #888888;
  color: #fff;
  cursor: pointer;
}

/* ===============================
   Responsive
================================ */
@media (max-width: 768px) {
  .panel-container {
    padding: 1.25rem;
  }

  .historial-table th,
  .historial-table td {
    font-size: 0.85rem;
    padding: 0.4rem;
  }

  .fichaje-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 500px) {
  .historial-table th,
  .historial-table td {
    font-size: 0.8rem;
    padding: 0.35rem;
  }
}

@media (min-width: 1200px) {
  .panel-container {
    max-width: 1000px;
  }
}

/* ===============================
Botón "Ver fichajes"
================================ */
.btn-ver {
padding: 0.45rem 0.9rem;
background: linear-gradient(135deg, #1a73e8, #4285f4);
color: #fff;
border: none;
border-radius: 999px;
font-size: 0.85rem;
font-weight: 600;
cursor: pointer;
box-shadow: 0 3px 8px rgba(26,115,232,0.25);
transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
}

.btn-ver:hover {
transform: translateY(-1px);
box-shadow: 0 5px 12px rgba(26,115,232,0.35);
opacity: 0.95;
}

.btn-ver:active {
transform: scale(0.97);
}

.contador-box {
margin: 20px auto;
padding: 14px 20px;
max-width: 320px;
background-color: #bdc3c7; /* gris por defecto */
color: #2c3e50;
font-size: 1.1rem;
font-weight: bold;
text-align: center;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
transition: background-color 0.3s ease, color 0.3s ease;
}

.contador-box.activo {
background-color: #2ecc71; /* verde cuando corre */
color: #fff;
}
