﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f5f7fa;
  color: #1e293b;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f2b4b;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-logo img {
  max-height: 40px;
  max-width: 180px;
  object-fit: contain;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #64748b;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item:hover { background: #f1f5f9; color: #0f2b4b; }
.nav-item.active { background: #0f2b4b; color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  padding: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-title { font-size: 1.125rem; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary { background: #0f2b4b; color: #fff; }
.btn-primary:hover { background: #1a3f63; }

.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }

.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
  background: transparent;
  border-color: #e2e8f0;
  color: #64748b;
}
.btn-outline:hover { background: #f1f5f9; color: #1e293b; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

.btn-block { width: 100%; }

/* Form */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus { border-color: #0f2b4b; box-shadow: 0 0 0 3px rgba(15, 43, 75, 0.1); }

.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-position: right 0.5rem center; background-repeat: no-repeat; background-size: 1.5em 1.5em; padding-right: 2.5rem; }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2b4b 0%, #1a3f63 100%);
}

.login-card {
  background: #fff;
  border-radius: 1rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f2b4b;
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: #64748b;
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

/* Fichaje buttons */
.fichaje-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.fichaje-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border-radius: 1rem;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s;
  gap: 0.5rem;
}

.fichaje-btn:hover { border-color: #0f2b4b; background: #f8fafc; }
.fichaje-btn .icon { font-size: 2rem; }
.fichaje-btn.entrada { color: #059669; }
.fichaje-btn.entrada:hover { border-color: #059669; background: #f0fdf4; }
.fichaje-btn.pausa { color: #d97706; }
.fichaje-btn.pausa:hover { border-color: #d97706; background: #fffbeb; }
.fichaje-btn.reanudar { color: #2563eb; }
.fichaje-btn.reanudar:hover { border-color: #2563eb; background: #eff6ff; }
.fichaje-btn.salida { color: #dc2626; }
.fichaje-btn.salida:hover { border-color: #dc2626; background: #fef2f2; }

/* Estado badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-aprobado, .badge-aprobada, .badge-signed, .badge-firmado, .badge-aprobado, .badge-firmado { background: #d1fae5; color: #065f46; }
.badge-denegado, .badge-denegada, .badge-rechazado, .badge-denegado { background: #fee2e2; color: #991b1b; }
.badge-entrada { background: #d1fae5; color: #065f46; }
.badge-pausa { background: #fef3c7; color: #92400e; }
.badge-reanudacion { background: #dbeafe; color: #1e40af; }
.badge-salida { background: #fee2e2; color: #991b1b; }

/* Table */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
}

td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
}

tr:hover td { background: #f8fafc; }

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Stat card */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.stat-label { font-size: 0.75rem; color: #64748b; font-weight: 500; text-transform: uppercase; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: #0f2b4b; margin-top: 0.25rem; }

/* QR Page */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #0f2b4b;
  padding: 2rem;
}

.qr-card {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.qr-code {
  width: 250px;
  height: 250px;
  margin: 1.5rem auto;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #e2e8f0;
  border-radius: 0.75rem;
}

.qr-code canvas, .qr-code img { max-width: 100%; max-height: 100%; }

.qr-expira {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.5rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

/* Notification bell */
.notif-bell {
  position: relative;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.15s;
}
.notif-bell:hover { background: #f1f5f9; }

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transform: translate(4px, -4px);
}

.notif-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 480px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  z-index: 100;
  display: none;
}

.notif-panel.open { display: block; }

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
  cursor: pointer;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.no-leida { background: #eff6ff; }
.notif-item:last-child { border-bottom: none; }

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.notif-icon.solicitud { background: #dbeafe; }
.notif-icon.firma { background: #d1fae5; }
.notif-icon.correccion { background: #fef3c7; }
.notif-icon.alerta { background: #fee2e2; }
.notif-icon.info { background: #e2e8f0; }

.notif-content { flex: 1; min-width: 0; }
.notif-titulo { font-size: 0.8125rem; font-weight: 600; color: #1e293b; }
.notif-mensaje { font-size: 0.75rem; color: #64748b; margin-top: 0.125rem; }
.notif-fecha { font-size: 0.625rem; color: #94a3b8; margin-top: 0.25rem; }

/* Vacation calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
  border-radius: 0.375rem;
  min-height: 60px;
  background: #fff;
  border: 1px solid #f1f5f9;
}

.calendar-day.other-month { opacity: 0.3; }
.calendar-day.today { background: #eff6ff; border-color: #2563eb; }
.calendar-day.festivo { background: #fef2f2; border-color: #dc2626; }
.calendar-day.festivo .day-num { color: #dc2626; font-weight: 700; }
.calendar-day .day-num { font-weight: 600; font-size: 0.75rem; color: #475569; }

.calendar-event {
  font-size: 0.625rem;
  padding: 1px 4px;
  border-radius: 2px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.calendar-event.vacaciones { background: #dbeafe; color: #1e40af; }
.calendar-event.baja { background: #fee2e2; color: #991b1b; }
.calendar-event.asuntos { background: #fef3c7; color: #92400e; }

/* Tabs */
.tab-btn {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}
.tab-btn:hover { color: #0f2b4b; }
.tab-btn.active {
  border-bottom-color: #0f2b4b;
  font-weight: 600;
  color: #0f2b4b;
}
.tab-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 0.25rem;
}
.tab-btn.active .tab-count { color: #64748b; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: fixed; bottom: 0; z-index: 40; flex-direction: row; padding: 0.5rem; border-right: none; border-top: 1px solid #e2e8f0; }
  .sidebar-logo, .sidebar-footer { display: none; }
  .sidebar-nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav-item { flex-direction: column; padding: 0.5rem; font-size: 0.625rem; }
  .main-content { padding: 1rem; padding-bottom: 5rem; }
  .fichaje-grid { grid-template-columns: 1fr; }
  .notif-panel { position: fixed; left: 1rem; right: 1rem; width: auto; top: 4rem; max-height: 70vh; }
}
