/* =========================================================
   ESTILO VISUAL MODERNO & ACESSÍVEL - HOSPITAL MUNICIPAL
   Design Visual-First | Pouco Texto | Cores Vivas | Botões Gigantes
   Otimizado para máxima leveza e compatibilidade em qualquer celular
   ========================================================= */

:root {
  /* Paleta Hospitalar Moderna & Confiável */
  --primary: #0284c7;         /* Azul Cirúrgico */
  --primary-dark: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.35);

  --success: #10b981;         /* Verde Esmeralda (Entrada) */
  --success-dark: #059669;
  --success-glow: rgba(16, 185, 129, 0.4);

  --warning: #f59e0b;         /* Âmbar / Laranja (Almoço) */
  --warning-dark: #d97706;
  --warning-glow: rgba(245, 158, 11, 0.4);

  --danger: #ef4444;          /* Vermelho Rubi (Saída) */
  --danger-dark: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.4);

  --purple: #8b5cf6;          /* Roxo Plantão Noturno */
  --purple-dark: #7c3aed;
  --purple-glow: rgba(139, 92, 246, 0.4);

  --bg-app: #f1f5f9;          /* Fundo suave e limpo */
  --card-bg: #ffffff;
  --text-main: #0f172a;       /* Alto contraste legível */
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
  overflow-x: hidden;
}

/* =========================================================
   1. TOPO DA APLICAÇÃO (MODERNO E COMPACTO)
   ========================================================= */
.app-header {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  padding: 14px 18px;
  box-shadow: 0 4px 20px var(--primary-glow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.hospital-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hospital-emblem {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.hospital-names h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.hospital-names p {
  font-size: 11px;
  color: #e0f2fe;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-action {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-header-action:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.3);
}

/* =========================================================
   2. CONTAINER PRINCIPAL (LAYOUT VISUAL)
   ========================================================= */
.main-container {
  flex: 1;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Card do Servidor (Visual e Amigável) */
.hero-user-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.user-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-avatar {
  font-size: 42px;
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.user-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: #10b981;
  border: 3px solid #ffffff;
  border-radius: 50%;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-greeting {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-name-big {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-top: 4px;
  border: 1px solid #e2e8f0;
}

/* =========================================================
   3. RELÓGIO DIGITAL MODERNO
   ========================================================= */
.clock-display-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.clock-live-time {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #38bdf8;
}

.clock-date-area {
  text-align: right;
}

.clock-day-week {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  color: #f8fafc;
}

.clock-full-date {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

/* =========================================================
   4. JORNADA DO PLANTÃO (LINHA DO TEMPO 100% VISUAL)
   Ideal para quem tem pouca leitura: vê onde está na escala!
   ========================================================= */
.timeline-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 16px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.timeline-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-shift-badge {
  font-size: 12px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* As etapas visuais */
.visual-steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  position: relative;
}

.visual-step {
  background: #f8fafc;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.visual-step.step-concluido {
  background: #ecfdf5;
  border-color: #10b981;
}

.visual-step.step-ativo {
  background: #f0fdf4;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  animation: pulseCard 2s infinite ease-in-out;
}

@keyframes pulseCard {
  0%, 100% { border-color: #10b981; }
  50% { border-color: #34d399; }
}

.step-icon-badge {
  font-size: 26px;
  line-height: 1;
}

.step-label {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  text-transform: uppercase;
}

.step-time-recorded {
  font-size: 13px;
  font-weight: 800;
  color: #059669;
}

.step-status-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.tag-feito { background: #d1fae5; color: #065f46; }
.tag-agora { background: #10b981; color: #ffffff; }
.tag-aguardando { background: #e2e8f0; color: #64748b; }

/* =========================================================
   5. O BOTÃO GIGANTE DE AÇÃO (HERO PUNCH BUTTON)
   Massivo, tátil, visual e impossível de errar
   ========================================================= */
.action-hero-area {
  margin: 4px 0;
}

.btn-punch-hero {
  width: 100%;
  min-height: 104px;
  padding: 16px 20px;
  border-radius: 28px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #ffffff;
  text-align: left;
  box-shadow: 0 10px 28px var(--success-glow);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
  touch-action: manipulation;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn-punch-hero:active {
  transform: scale(0.96);
  box-shadow: 0 4px 14px var(--success-glow);
}

/* Ícone de Destaque Grande */
.punch-hero-icon {
  width: 68px;
  height: 68px;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: softBob 2.5s infinite ease-in-out;
}

@keyframes softBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.punch-hero-texts {
  flex: 1;
}

.punch-hero-title {
  font-size: 24px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.punch-hero-sub {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.punch-hero-arrow {
  font-size: 28px;
  line-height: 1;
  opacity: 0.8;
  padding-right: 4px;
}

/* Estilos de Cores para o Botão Principal */
.btn-style-entrada {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 10px 28px var(--success-glow);
}

.btn-style-saida {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 10px 28px var(--danger-glow);
}

.btn-style-intervalo {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 10px 28px var(--warning-glow);
}

.btn-style-retorno {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  box-shadow: 0 10px 28px var(--primary-glow);
}

.btn-style-folga {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  box-shadow: 0 10px 28px rgba(71, 85, 105, 0.25);
}

/* =========================================================
   6. BOTÃO DE AJUDA POR VOZ (AMIGÁVEL & VISÍVEL)
   ========================================================= */
.voice-help-card {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-voice-help {
  background: #ffffff;
  border: 2px solid #bae6fd;
  color: #0369a1;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-voice-help:active {
  transform: scale(0.96);
  background: #f0f9ff;
}

.voice-help-wave {
  font-size: 22px;
  animation: pulseIcon 1.5s infinite ease-in-out;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* =========================================================
   7. LISTA DE COMPROVANTES DO DIA (LIMPO E VISUAL)
   ========================================================= */
.today-summary-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 16px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.summary-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.receipt-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.receipt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border-left: 6px solid #10b981;
}

.receipt-item.tipo-saida { border-left-color: #ef4444; }
.receipt-item.tipo-intervalo { border-left-color: #f59e0b; }

.receipt-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.receipt-icon {
  font-size: 24px;
}

.receipt-type {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.receipt-protocol {
  font-size: 11px;
  color: var(--text-muted);
}

.receipt-time {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}

.empty-receipts {
  text-align: center;
  padding: 20px 10px;
  color: var(--text-muted);
}

/* =========================================================
   8. SCANNER DE CÂMERA (ESTILO MODERNO & VISUAL GUIA)
   ========================================================= */
.scanner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000;
  z-index: 100;
  display: none;
  flex-direction: column;
}

.scanner-overlay.active {
  display: flex;
}

.scanner-header-bar {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  z-index: 10;
}

.scanner-header-bar span {
  font-size: 17px;
  font-weight: 800;
}

.btn-close-scanner {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: white;
  min-width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
}

.scanner-view-box {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Mira do Scanner com cantos iluminados */
.scanner-target-frame {
  position: absolute;
  width: 270px;
  height: 270px;
  border: 4px solid #10b981;
  border-radius: 28px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), 0 0 30px rgba(16, 185, 129, 0.5);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-beam {
  width: 100%;
  height: 4px;
  background: #10b981;
  box-shadow: 0 0 16px #10b981;
  animation: laserScan 2s infinite alternate ease-in-out;
}

@keyframes laserScan {
  0% { transform: translateY(-115px); }
  100% { transform: translateY(115px); }
}

.scanner-bottom-hint {
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.scanner-bottom-hint .hint-big {
  font-size: 18px;
  font-weight: 800;
}

.scanner-bottom-hint .hint-sub {
  font-size: 13px;
  color: #94a3b8;
}

/* =========================================================
   9. MODAL DE SUCESSO (CELEBRAÇÃO VISUAL VERDE GIGANTE)
   ========================================================= */
.success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.success-modal.active {
  display: flex;
}

.success-card {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: 32px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-check-bubble {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-radius: 50%;
  font-size: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 10px 24px var(--success-glow);
}

.success-card h2 {
  font-size: 26px;
  font-weight: 900;
  color: #059669;
  line-height: 1.2;
}

.success-employee-text {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 6px;
}

.success-stamp-box {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  padding: 16px;
  margin: 18px 0;
}

.stamp-time {
  font-size: 42px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -1px;
}

.stamp-label {
  font-size: 16px;
  font-weight: 800;
  color: #059669;
  text-transform: uppercase;
  margin-top: 4px;
}

.stamp-code {
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
}

.btn-repeat-sound {
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  color: #166534;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-confirm-close {
  width: 100%;
  min-height: 60px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--success-glow);
}

/* =========================================================
   10. TELA DE SELEÇÃO DE SERVIDOR (CARDS GRANDES & FÁCEIS)
   ========================================================= */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-app);
  z-index: 90;
  display: none;
  flex-direction: column;
  padding: 24px 16px;
  overflow-y: auto;
}

.login-overlay.active {
  display: flex;
}

.login-title-box {
  text-align: center;
  max-width: 480px;
  margin: 0 auto 20px;
}

.login-title-box h2 {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-dark);
}

.login-title-box p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.search-box-wrap {
  max-width: 480px;
  margin: 0 auto 16px;
  width: 100%;
}

.search-box-input {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  box-sizing: border-box;
}

.search-box-input:focus {
  outline: none;
  border-color: var(--primary);
}

.employee-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 40px;
}

.employee-card-select {
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.employee-card-select:active {
  transform: scale(0.97);
  border-color: var(--primary);
  background: #f0f9ff;
}

.employee-avatar-select {
  font-size: 36px;
  width: 60px;
  height: 60px;
  background: #e0f2fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.employee-info-select h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.employee-info-select p {
  font-size: 13px;
  color: var(--primary-dark);
  font-weight: 700;
  margin-top: 2px;
}

.employee-dept-pill {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

/* Modal PIN */
.pin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.8);
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pin-modal.active {
  display: flex;
}

.pin-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 26px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.pin-input {
  width: 100%;
  height: 60px;
  font-size: 32px;
  letter-spacing: 12px;
  text-align: center;
  margin: 16px 0;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-lg);
  font-family: inherit;
}
