/* Fecha: 2026-03-23 */
/* Ruta: /opt/fichajes/public/css/app.css */
/* Estilos de FichajesDNNS — Control Horario HomeVillas */

:root {
    --primario: #2C3E50;
    --primario-claro: #34495E;
    --acento: #3498DB;
    --acento-hover: #2980B9;
    --verde: #27AE60;
    --rojo: #E74C3C;
    --naranja: #F39C12;
    --gris-bg: #F5F7FA;
    --gris-borde: #E1E8ED;
    --gris-texto: #7F8C8D;
    --blanco: #FFFFFF;
    --texto: #2C3E50;
    --sombra: 0 2px 8px rgba(0,0,0,0.08);
    --radio: 8px;
    --sidebar-ancho: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gris-bg); color: var(--texto); font-size: 14px; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

/* === LOGIN === */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primario) 0%, var(--primario-claro) 100%); }
.login-card { background: var(--blanco); padding: 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 360px; text-align: center; }
.login-logo { font-size: 48px; margin-bottom: 10px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--gris-texto); margin-bottom: 24px; font-size: 13px; }
.login-card input { width: 100%; padding: 12px 16px; margin-bottom: 12px; border: 1px solid var(--gris-borde); border-radius: var(--radio); outline: none; transition: border-color 0.2s; }
.login-card input:focus { border-color: var(--acento); }
.login-card button { width: 100%; padding: 12px; background: var(--acento); color: white; border: none; border-radius: var(--radio); cursor: pointer; font-weight: 600; transition: background 0.2s; }
.login-card button:hover { background: var(--acento-hover); }
.login-footer { margin-top: 20px; color: var(--gris-texto); font-size: 12px; }
.error-msg { color: var(--rojo); font-size: 13px; margin-top: 8px; min-height: 20px; }

/* === LAYOUT === */
#sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-ancho); height: 100vh; background: var(--primario); color: white; display: flex; flex-direction: column; z-index: 100; overflow-y: auto; }
.nav-logo { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 16px; font-weight: 700; }
.nav-menu { list-style: none; flex: 1; padding: 8px 0; }
.nav-link { display: flex; align-items: center; padding: 10px 20px; color: rgba(255,255,255,0.7); transition: all 0.2s; font-size: 13px; cursor: pointer; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,0.1); }
.nav-link.active { border-left: 3px solid var(--acento); }
.badge { background: var(--rojo); color: white; font-size: 11px; padding: 2px 6px; border-radius: 10px; margin-left: 8px; }
.nav-user { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
.btn-small { padding: 4px 12px; background: rgba(255,255,255,0.15); border: none; color: white; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-small:hover { background: rgba(255,255,255,0.25); }

#contenido { margin-left: var(--sidebar-ancho); padding: 24px; min-height: 100vh; }

/* === CARDS KPI === */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--blanco); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra); display: flex; align-items: center; gap: 16px; }
.kpi-icon { font-size: 32px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.kpi-icon.azul { background: rgba(52,152,219,0.12); }
.kpi-icon.verde { background: rgba(39,174,96,0.12); }
.kpi-icon.rojo { background: rgba(231,76,60,0.12); }
.kpi-icon.naranja { background: rgba(243,156,18,0.12); }
.kpi-valor { font-size: 28px; font-weight: 700; }
.kpi-label { font-size: 12px; color: var(--gris-texto); margin-top: 2px; }

/* === TABLAS === */
.tabla-container { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; margin-bottom: 24px; }
.tabla-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gris-borde); }
.tabla-header h2 { font-size: 16px; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--gris-bg); padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--gris-texto); text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 10px 16px; border-bottom: 1px solid var(--gris-borde); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(52,152,219,0.04); }

/* === BOTONES === */
.btn { padding: 8px 16px; border: none; border-radius: var(--radio); cursor: pointer; font-weight: 500; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.btn-primary { background: var(--acento); color: white; }
.btn-primary:hover { background: var(--acento-hover); }
.btn-success { background: var(--verde); color: white; }
.btn-danger { background: var(--rojo); color: white; }
.btn-warning { background: var(--naranja); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--gris-borde); color: var(--texto); }
.btn-outline:hover { border-color: var(--acento); color: var(--acento); }
.btn-xs { padding: 4px 8px; font-size: 12px; }

/* === FORMULARIOS === */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gris-texto); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gris-borde); border-radius: 6px; outline: none; }
.form-group input:focus, .form-group select:focus { border-color: var(--acento); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* === ESTADO TAGS === */
.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.tag-normal { background: rgba(39,174,96,0.12); color: var(--verde); }
.tag-retraso { background: rgba(243,156,18,0.12); color: var(--naranja); }
.tag-ausencia { background: rgba(231,76,60,0.12); color: var(--rojo); }
.tag-incompleto { background: rgba(155,89,182,0.12); color: #8E44AD; }
.tag-festivo { background: rgba(52,152,219,0.12); color: var(--acento); }
.tag-vacaciones { background: rgba(26,188,156,0.12); color: #1ABC9C; }
.tag-baja { background: rgba(149,165,166,0.12); color: #95A5A6; }
.tag-conectado { background: rgba(39,174,96,0.12); color: var(--verde); }
.tag-desconectado { background: rgba(149,165,166,0.12); color: #95A5A6; }
.tag-error { background: rgba(231,76,60,0.12); color: var(--rojo); }
.tag-entrada { background: rgba(39,174,96,0.12); color: var(--verde); }
.tag-salida { background: rgba(231,76,60,0.12); color: var(--rojo); }

/* === TOAST === */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 12px 20px; border-radius: var(--radio); color: white; font-size: 13px; z-index: 9999; transition: all 0.3s; opacity: 0; transform: translateY(10px); pointer-events: none; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--verde); }
.toast.error { background: var(--rojo); }
.toast.info { background: var(--acento); }

/* === MODAL === */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: var(--blanco); border-radius: 12px; width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gris-borde); }
.modal-header h3 { font-size: 16px; }
.modal-cerrar { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gris-texto); padding: 0 4px; }
#modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gris-borde); display: flex; justify-content: flex-end; gap: 8px; }

/* === FILTROS === */
.filtros { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px; background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); }
.filtros input, .filtros select { padding: 6px 10px; border: 1px solid var(--gris-borde); border-radius: 6px; font-size: 13px; }
.filtros label { font-size: 12px; font-weight: 600; color: var(--gris-texto); }

/* === TIEMPO REAL === */
.live-feed { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px 20px; margin-bottom: 24px; }
.live-feed h3 { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; background: var(--verde); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.live-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--gris-borde); }
.live-item:last-child { border-bottom: none; }
.live-hora { font-weight: 600; min-width: 60px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #sidebar { width: 60px; }
    .logo-text, .nav-link span, .nav-user span { display: none; }
    .nav-link { justify-content: center; padding: 12px; }
    #contenido { margin-left: 60px; padding: 12px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filtros { flex-direction: column; }
    .tabla-container { overflow-x: auto; }
}
