/* ==============================================================================
   HORARIOS WC — Portal de Marcación de Asistencias (Dark & Gold Theme)
   ============================================================================== */

:root {
  --marcar-bg: #09090b;
  --marcar-card-bg: rgba(24, 24, 27, 0.95);
  --marcar-card-border: rgba(245, 158, 11, 0.25);
  --marcar-gold: #f59e0b;
  --marcar-gold-light: #fef08a;
  --marcar-gold-hover: #d97706;
  --marcar-gold-glow: rgba(245, 158, 11, 0.35);
  --marcar-emerald: #10b981;
  --marcar-emerald-glow: rgba(16, 185, 129, 0.35);
  --marcar-rose: #f43f5e;
  --marcar-text: #f8fafc;
  --marcar-text-muted: #94a3b8;
}

html {
  height: 100%;
}

body.marcar-body {
  margin: 0;
  padding: 1.5rem 1rem;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at center, #1c1917 0%, #09090b 85%);
  color: var(--marcar-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow-x: hidden;
}

.marcar-container {
  width: 100%;
  max-width: 450px;
  background: var(--marcar-card-bg);
  border: 1px solid var(--marcar-card-border);
  border-radius: 1.5rem;
  padding: 2.25rem 1.75rem;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 45px rgba(245, 158, 11, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  margin: auto;
}

/* BANNER DE INSTALACIÓN PWA */
.pwa-install-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
  animation: fadeIn 0.3s ease-out;
}

.pwa-install-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pwa-install-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.pwa-install-text strong {
  display: block;
  font-size: 0.85rem;
  color: #fff;
  font-weight: 800;
}

.pwa-install-text span {
  font-size: 0.72rem;
  color: var(--marcar-gold-light);
}

.btn-pwa-install {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #09090b;
  border: none;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.5rem 0.9rem;
  border-radius: 0.6rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  transition: transform 0.15s, filter 0.15s;
  flex-shrink: 0;
  text-transform: uppercase;
}

.btn-pwa-install:hover {
  filter: brightness(1.1);
  transform: scale(1.03);
}

.marcar-header {
  margin-bottom: 1.5rem;
}

.marcar-header img {
  filter: drop-shadow(0 2px 12px rgba(245, 158, 11, 0.35));
  max-height: 65px;
  height: auto;
  object-fit: contain;
}

.marcar-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0.75rem 0 0.25rem 0;
  color: #fff;
  letter-spacing: -0.02em;
}

.marcar-subtitle {
  font-size: 0.88rem;
  color: var(--marcar-gold-light);
  margin: 0;
  opacity: 0.9;
}

/* TABS DE SELECCIÓN */
.marcar-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.35rem;
  border-radius: 0.85rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.marcar-tab-btn {
  flex: 1;
  padding: 0.65rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--marcar-text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.marcar-tab-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #09090b;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* CAJA DE CÓDIGO QR GENERADO PARA ESCANEAR CON CELULAR */
.marcar-qr-display-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.marcar-qr-box-generated {
  background: #ffffff;
  padding: 1rem;
  border-radius: 1.25rem;
  display: inline-block;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(245, 158, 11, 0.2);
  border: 2px solid rgba(245, 158, 11, 0.3);
}

.marcar-qr-box-generated canvas,
.marcar-qr-box-generated img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.marcar-qr-instructions {
  font-size: 0.88rem;
  color: var(--marcar-text-muted);
  line-height: 1.45;
  max-width: 340px;
}

.marcar-qr-instructions strong {
  color: #fef08a;
}

/* CÁMARA & RETÍCULA */
.camera-scanner-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 280px;
  margin: 0 auto 1.25rem auto;
  background: #000;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 2px solid rgba(245, 158, 11, 0.4);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 8px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-reticle {
  position: absolute;
  top: 15%;
  left: 15%;
  right: 15%;
  bottom: 15%;
  border: 2px dashed rgba(245, 158, 11, 0.8);
  border-radius: 1rem;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.camera-laser-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #f59e0b, #fef08a, #f59e0b, transparent);
  box-shadow: 0 0 12px #f59e0b;
  animation: laserScan 2.2s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 5%; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: 92%; opacity: 0.3; }
}

/* FORMULARIO CÉDULA */
.doc-input-wrapper {
  margin: 1.5rem 0 1rem 0;
}

.doc-input-field {
  width: 100%;
  padding: 0.95rem 1.2rem;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(245, 158, 11, 0.35);
  border-radius: 0.85rem;
  color: #fff;
  outline: none;
  box-sizing: border-box;
  letter-spacing: 0.05em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.doc-input-field:focus {
  border-color: var(--marcar-gold);
  box-shadow: 0 0 20px var(--marcar-gold-glow);
}

.doc-input-field.has-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.4) !important;
  animation: shakeInput 0.35s ease-in-out;
}

@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ALERTA DE DOCUMENTO ERRÓNEO O NO ENCONTRADO */
.doc-error-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.6);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1.25rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
  animation: fadeIn 0.25s ease-out;
}

.doc-error-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}

.doc-error-body strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: #f87171;
  margin-bottom: 0.2rem;
}

.doc-error-body p {
  margin: 0;
  font-size: 0.78rem;
  color: #fca5a5;
  line-height: 1.35;
}

/* ALERTA DE TURNO (SIN TURNO AGENDADO / FUERA DE HORARIO) */
.turno-alerta-box {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  margin: 0.85rem 0 1rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
  animation: fadeIn 0.25s ease-out;
}

.turno-alerta-box.alerta-error {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.65);
}

.turno-alerta-box.alerta-info {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.65);
}

.turno-alerta-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}

.turno-alerta-body strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 0.2rem;
}

.turno-alerta-box.alerta-error .turno-alerta-body strong {
  color: #f87171;
}

.turno-alerta-box.alerta-info .turno-alerta-body strong {
  color: #38bdf8;
}

.turno-alerta-body p {
  margin: 0;
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.35;
}

/* BOTONES DE ACCIÓN */
.btn-marcar-action {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: 0.85rem;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.btn-primary-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #09090b;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}
.btn-primary-gold:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-start-session {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 25px var(--marcar-emerald-glow);
}
.btn-start-session:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-start-session:disabled, .btn-start-session.is-disabled {
  background: #334155 !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  transform: none !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  opacity: 0.8;
}

.btn-end-session {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.35);
}
.btn-end-session:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-break-session {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #fff;
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.35);
  margin-bottom: 0.75rem;
}
.btn-break-session:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-resume-session {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #fff;
  box-shadow: 0 6px 22px rgba(6, 182, 212, 0.35);
  margin-bottom: 0.75rem;
}
.btn-resume-session:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.live-stopwatch-box.is-break {
  border-color: rgba(245, 158, 11, 0.65) !important;
  background: radial-gradient(circle at center, rgba(245, 158, 11, 0.2) 0%, rgba(15, 23, 42, 0.85) 100%) !important;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.3) !important;
}
.live-stopwatch-box.is-break .live-stopwatch-label {
  color: #fbbf24 !important;
}
.live-stopwatch-box.is-break .live-stopwatch-time {
  color: #fde68a !important;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.6) !important;
}

/* CARD DE MODELO IDENTIFICADA */
.model-info-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 1.25rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  margin-bottom: 1.25rem;
}

.model-info-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--marcar-gold);
  flex-shrink: 0;
}

.model-info-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.model-info-shift {
  font-size: 0.85rem;
  color: var(--marcar-gold-light);
  margin-top: 0.15rem;
}

.model-info-room-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.4);
  padding: 0.2rem 0.55rem;
  border-radius: 0.45rem;
  margin-top: 0.35rem;
}

/* CRONÓMETRO EN VIVO */
.live-stopwatch-box {
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.12) 0%, rgba(0, 0, 0, 0.6) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.15);
}

.live-stopwatch-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--marcar-emerald);
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
  animation: pulseLabel 1.5s infinite;
}

@keyframes pulseLabel {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.live-stopwatch-time {
  font-family: 'Courier New', Courier, monospace;
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.08em;
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

/* FOOTER */
.marcar-footer {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--marcar-text-muted);
}

.marcar-link-admin {
  color: var(--marcar-gold-light);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s;
}

.marcar-link-admin:hover {
  color: #fff;
  text-decoration: underline;
}

/* MODAL DE ALERTA INTERACTIVO (100% RESPONSIVE) */
.marcar-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
  overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}

.marcar-modal-dialog {
  background: #18181b;
  border: 1.5px solid rgba(245, 158, 11, 0.6);
  border-radius: 1.25rem;
  padding: 1.65rem 1.35rem;
  max-width: 360px;
  width: 100%;
  margin: auto;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(245, 158, 11, 0.25);
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.marcar-modal-dialog.modal-error {
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(239, 68, 68, 0.3);
}

.marcar-modal-dialog.modal-warning {
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(245, 158, 11, 0.35);
}

.marcar-modal-icon {
  font-size: 2.75rem;
  margin-bottom: 0.65rem;
  line-height: 1;
}

.marcar-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.5rem 0;
}

.marcar-modal-msg {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin: 0;
  word-break: break-word;
}

@keyframes scaleUp {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* MÉTRICAS QUINCENALES DE LA MODELO */
.model-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1.25rem;
  margin-bottom: 1rem;
}

.model-stat-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  padding: 0.65rem 0.4rem;
  text-align: center;
}

.model-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.model-stat-label {
  font-size: 0.68rem;
  color: var(--marcar-text-muted);
  text-transform: uppercase;
  margin-top: 0.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* SUBTABS HISTORIAL / PRÓXIMOS TURNOS */
.app-subtabs {
  display: flex;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.3rem;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.app-subtab-btn {
  flex: 1;
  padding: 0.5rem 0.4rem;
  background: transparent;
  border: none;
  color: var(--marcar-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 0.55rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-subtab-btn.active {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.app-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--marcar-gold-light);
  margin-bottom: 0.5rem;
  text-align: left;
  padding: 0 0.25rem;
}

.app-history-list {
  max-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
  padding-right: 0.2rem;
}

.app-history-list::-webkit-scrollbar {
  width: 4px;
}
.app-history-list::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.3);
  border-radius: 4px;
}

.app-history-item, .app-upcoming-item {
  background: rgba(24, 24, 27, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  transition: background 0.15s ease;
}

.app-history-item:hover, .app-upcoming-item:hover {
  background: rgba(39, 39, 42, 0.85);
}

.app-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-item-date {
  font-weight: 700;
  color: #f8fafc;
  font-size: 0.82rem;
}

.app-item-room {
  font-size: 0.72rem;
  color: var(--marcar-text-muted);
}

.app-item-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
}

.app-item-duration {
  font-weight: 800;
  color: #38bdf8;
  font-size: 0.82rem;
}

.app-item-hours {
  font-size: 0.7rem;
  color: var(--marcar-text-muted);
}

.app-badge-future {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.15rem 0.45rem;
  border-radius: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
}

.app-empty-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--marcar-text-muted);
  padding: 1.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.65rem;
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

/* RESPONSIVE MOBILE TWEAKS */
@media (max-width: 480px) {
  body.marcar-body {
    padding: 0.75rem;
  }

  .marcar-container {
    padding: 1.5rem 1rem;
    border-radius: 1.25rem;
  }

  .marcar-title {
    font-size: 1.3rem;
  }

  .marcar-modal-overlay {
    padding: 1rem;
  }

  .marcar-modal-dialog {
    padding: 1.35rem 1rem;
    max-width: 100%;
    border-radius: 1.15rem;
  }

  .marcar-modal-title {
    font-size: 1.15rem;
  }

  .marcar-modal-msg {
    font-size: 0.85rem;
  }

  .doc-error-alert, .turno-alerta-box {
    padding: 0.75rem;
    font-size: 0.82rem;
  }
}
