/* ==========================================================================
   1. VARIABLES Y BASE
   ========================================================================== */
:root {
  --logo-red: #a32a29;
  --logo-teal: #4db3a2;
  --logo-yellow: #fdf5c4;
  --primary-blue: #3b82f6;
  --bg-light: #f8fafc;
  --text-main: #334155;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-light);
  font-family: var(--font-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

input, button { font-family: inherit; }

/* ==========================================================================
   2. ESTRUCTURA DE LOGIN (AISLADA)
   ========================================================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  box-sizing: border-box;
}

.login-card {
  background: white;
  padding: 48px 40px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-card .logo {
  margin-bottom: 36px;
  max-width: 200px; /* Ajustado para que no sea gigante */
  height: auto;
}

/* Campos de Login con Label Flotante */
.form-field {
  position: relative;
  margin-bottom: 24px;
  text-align: left;
}

.form-field input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 16px;
  background: #fafbfc;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.form-field input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: white;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}

.form-field label {
  position: absolute;
  left: 20px;
  top: 18px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.25s ease;
  background: transparent;
}

.form-field input:focus ~ label,
.form-field input:not(:placeholder-shown) ~ label {
  top: -10px;
  left: 12px;
  font-size: 12px;
  color: var(--primary-blue);
  background: white;
  padding: 0 8px;
  font-weight: 700;
}

.btn-login {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(59,130,246,0.3);
  transition: all 0.25s;
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(59,130,246,0.4); }

/* ==========================================================================
   3. CABECERA Y TABLA (MIS FICHAJES)
   ========================================================================== */
.main-header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  height: 80px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  padding: 0 24px;
}

.header-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-logo { height: 50px; width: auto; }

.header-nav { display: flex; gap: 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: 0.2s;
}

.nav-link:hover { background: #eff6ff; color: var(--primary-blue); }
.nav-link.logout:hover { background: #fef2f2; color: #ef4444; }

/* Contenedor de la Tabla */
.main-content { padding: 40px 20px; }
.container { max-width: 1000px; margin: 0 auto; }

.styled-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.styled-table th {
  text-align: left;
  padding: 16px;
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border-color);
}

.styled-table td { padding: 16px; border-bottom: 1px solid #f1f5f9; }

.day-icon {
  color: var(--logo-teal);
  border: 2px solid var(--logo-teal);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-weight: 800;
  line-height: 1; /* Evita que el texto flote hacia arriba */
    display: inline-flex; /* Ayuda con el centrado total */
}

.td-total { font-weight: 700; color: var(--logo-red) !important; }

.row-total { background-color: var(--logo-yellow) !important; }

/* Responsive */
@media (max-width: 768px) {
  .header-container { flex-direction: column; height: auto; padding: 10px; }
  .nav-link span { display: none; }
}

/* ==========================================================================
   5. PÁGINA MIS FICHAJES (Ajustes de Filtros y Tabla)
   ========================================================================== */

/* Contenedor de filtros como una tarjeta elegante */
.filter-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

/* Estilo moderno para los inputs de tipo fecha */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input[type="date"] {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-main);
    background-color: #fafbfc;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.input-group input[type="date"]:focus {
    border-color: var(--primary-blue);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}

/* Botón de filtrar más integrado */
.btn-filter {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    height: 45px; /* Alineado con los inputs */
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

/* Recuperar filas alternas (Zebra) */
.styled-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important; /* Gris muy suave */
}

.styled-table tbody tr:hover {
    background-color: #f1f5f9 !important; /* Resalte al pasar el ratón */
}

/* ==========================================================================
   5. PÁGINA MIS FICHAJES (Ajustado a tu HTML real)
   ========================================================================== */

.main-content {
    padding: 30px 20px;
}

/* Tarjeta de filtros */
.filter-card {
    margin-bottom: 24px;
}

.filter-form {
    display: flex;
    gap: 20px;
    align-items: flex-end; /* Alinea el botón con los inputs */
    flex-wrap: wrap;
}

/* Grupos de input (label + input) */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.input-group input[type="date"] {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-main);
    background-color: #fafbfc;
    outline: none;
    transition: all 0.2s;
}

.input-group input:focus {
    border-color: var(--primary-blue);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}

/* Botón de filtrar (reutilizando tu clase) */
.btn-primary-small {
    height: 42px; /* Altura para igualar a los inputs */
    padding: 0 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

/* Tabla y Filas Alternas */
.table-card {
    padding: 0; /* Para que la tabla llegue a los bordes de la tarjeta */
    overflow: hidden;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
}

.styled-table th {
    background-color: #f8fafc;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.styled-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}

/* Esto aplica un gris casi blanco a las filas pares */
.styled-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
}

/* Y esto hace que al pasar el ratón se ilumine la fila */
.styled-table tbody tr:hover {
    background-color: #f1f5f9 !important;
}

/* Estilos de celdas especiales */
.td-day-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-right: 1px solid var(--border-color); /* Separador visual */
    margin-right: 8px;
}

.user-display i {
    font-size: 18px;
    color: var(--logo-teal); /* Usamos el verde del logo para el icono de usuario */
}

/* En móviles ocultamos el email largo para que no rompa la cabecera */
@media (max-width: 768px) {
    .user-display {
        border-right: none;
        margin-right: 0;
        padding: 8px;
    }
    .user-display span {
        display: none; /* Solo queda el icono en móvil */
    }
}

/* PÁGINA FICHAR */
.fichar-card {
    max-width: 500px !important;
}

.clock-container {
    margin-bottom: 30px;
    padding: 20px;
    background: #f1f5f9;
    border-radius: 15px;
}

#clock-time {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

#clock-date {
    margin-top: 10px;
    color: var(--logo-teal);
    font-weight: 600;
    text-transform: capitalize;
}

.status-text {
    margin-bottom: 30px;
    color: var(--text-muted);
}

.btn-fichar {
    width: 100%;
    padding: 30px;
    border: none;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-fichar i {
    font-size: 3rem;
}

/* Colores de estado */
.btn-entrar {
    background: linear-gradient(135deg, var(--logo-teal) 0%, #2d8a7a 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(77, 179, 162, 0.3);
}

.btn-salir {
    background: linear-gradient(135deg, var(--logo-red) 0%, #7a1f1e 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(163, 42, 41, 0.3);
}

.btn-fichar:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

.login-card h2 {
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 800;
}
.text-muted {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

/* Estilo para la fila completa */
tr.fila-olvido td {
    background-color: #fff1f2 !important; /* Rojo muy tenue de fondo */
    color: #991b1b !important;            /* Texto granate */
}

/* El badge rojo */
.badge-olvido {
    background-color: #ef4444 !important;
    color: white !important;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* Opcional: que el icono del día también cambie si es olvido */
tr.fila-olvido .day-icon {
    background-color: #f87171 !important;
    color: white !important;
}

.timezone-badge {
    font-size: 0.75rem;
    color: #64748b; /* Gris azulado */
    margin-top: 10px;
    letter-spacing: 0.3px;
}

.timezone-badge i {
    color: #4db3a2;
    margin-right: 4px;
}