/* ══════════════════════════════════════════════════════════════
   PONTO DIGITAL — DESIGN SYSTEM v10.0 (Apple Premium & Clean)
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #000000;
  --surface-1: rgba(28, 28, 30, .72);
  --surface-2: rgba(44, 44, 46, .52);
  --surface-3: rgba(58, 58, 60, .38);
  --surface-elevated: rgba(36, 36, 38, .82);
  --border: rgba(255, 255, 255, .08);
  --blue: #0a84ff;
  --blue-soft: rgba(10, 132, 255, .15);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, .15);
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, .15);
  --orange: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, .15);
  --purple: #bf5af2;
  --purple-soft: rgba(191, 90, 242, .15);
  --text-primary: #f5f5f7;
  --text-secondary: rgba(235, 235, 245, .6);
  --text-tertiary: rgba(235, 235, 245, .3);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  --font-rounded: 'SF Pro Rounded', -apple-system, 'Inter', sans-serif;
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-full: 100px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: 0.3s; /* Correção: Variável de duração adicionada */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text-primary); background: var(--bg); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }

/* ══════════════ BACKGROUND ══════════════ */
.bg-scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #000; }
.bg-scene::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,159,10,.06) 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 100% 100%, rgba(10,132,255,.05) 0%, transparent 50%); }
.bg-scene .orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: .06; animation: orbFloat 30s ease-in-out infinite; }
.bg-scene .orb:nth-child(1) { width: 600px; height: 600px; background: var(--orange); top: -20%; left: -10%; }
.bg-scene .orb:nth-child(2) { width: 400px; height: 400px; background: var(--blue); bottom: -10%; right: -10%; animation-delay: -10s; }
@keyframes orbFloat { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,-40px) scale(1.05); } }

/* ══════════════ LOGIN & TOP BAR ══════════════ */
#loginScreen { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: #000; }
#loginScreen.hidden { display: none; }
.login-card { position: relative; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 50px 36px; width: min(400px, 90vw); text-align: center; backdrop-filter: blur(80px); box-shadow: 0 32px 80px rgba(0,0,0,.5); }
.login-card .brand-icon { width: 72px; height: 72px; border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; font-size: 32px; color: #fff; box-shadow: 0 12px 40px rgba(255,159,10,.3); }
.login-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.login-card .sub { font-size: .84rem; color: var(--text-tertiary); margin-bottom: 30px; }
.login-field { width: 100%; padding: 15px 18px; margin-bottom: 12px; background: rgba(118,118,128,.12); border: 1px solid transparent; border-radius: var(--r-sm); color: var(--text-primary); font-size: .94rem; outline: none; transition: all var(--dur) var(--ease); }
.login-field:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
select.login-field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='none' stroke='rgba(235,235,245,.4)' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
select.login-field option { background: #1c1c1e; }
.login-btn { width: 100%; padding: 15px; margin-top: 6px; border: none; border-radius: var(--r-sm); color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer; }
.login-error { color: var(--red); font-size: .82rem; font-weight: 500; min-height: 20px; margin-top: 14px; }

#ldScreen { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px; background: #000; transition: opacity .5s ease; }
#ldScreen.hidden { opacity: 0; pointer-events: none; }
.ld-spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255,255,255,.08); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ld-text { color: var(--text-tertiary); font-size: .82rem; font-weight: 500; }
#ldBarTop { position: fixed; top: 0; left: 0; height: 2px; z-index: 9998; width: 0; transition: width .4s ease; }

.top-bar { position: sticky; top: 0; z-index: 100; background: rgba(0,0,0,.72); backdrop-filter: blur(40px); border-bottom: .5px solid var(--border); padding: 14px 20px 10px; }
.top-bar-row1 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.top-bar .brand { display: flex; align-items: center; gap: 12px; }
.top-bar .brand-dot { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.top-bar .brand-text h1 { font-size: 1rem; font-weight: 700; color: var(--text-white); }
.top-bar .brand-text span { font-size: .65rem; color: var(--text-tertiary); text-transform: uppercase; font-weight: 500; }
.btn-logout { background: rgba(255,69,58,.12); color: var(--red); border: none; border-radius: var(--r-full); padding: 7px 16px; font-size: .72rem; font-weight: 600; cursor: pointer; }
.top-bar-row2 { display: flex; align-items: center; gap: 6px; }
.badge { padding: 4px 12px; border-radius: var(--r-full); font-size: .6rem; font-weight: 600; text-transform: uppercase; }
.badge-online { background: var(--green-soft); color: var(--green); }
.badge-offline { background: var(--red-soft); color: var(--red); }
.user-badge { padding: 4px 12px; border-radius: var(--r-full); font-size: .68rem; font-weight: 600; }

/* Correção: Remove a duplicidade da tag Gestor no topo */
.badge-gestor + .user-badge { display: none !important; }

.container { max-width: 600px; margin: 0 auto; padding: 20px 16px 60px; position: relative; z-index: 1; }
.section-label { font-size: .75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 10px 8px; }

/* ══════════════ APPLE iOS CARDS ══════════════ */
.ios-card { background: var(--surface-1); border: .5px solid var(--border); border-radius: var(--r-lg); margin-bottom: 24px; overflow: hidden; backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); }
.ios-card-row { display: flex; align-items: center; padding: 14px 18px; border-bottom: .5px solid var(--border); transition: background 0.2s ease; }
.ios-card-row.hidden { display: none !important; }
.ios-card-row:last-child { border-bottom: none; }
.ios-card-row:active { background: var(--surface-2); }
.ios-icon-bg { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.ios-row-content { flex: 1; margin-left: 14px; min-width: 0; }
.ios-row-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); }
.ios-row-sub { font-size: .75rem; color: var(--text-tertiary); margin-top: 3px; font-weight: 500; }

/* Switches Apple */
.apple-switch { cursor: pointer; -webkit-tap-highlight-color: transparent; flex-shrink: 0; margin-left: 10px; }
.apple-switch-track { width: 51px; height: 31px; border-radius: 15.5px; background: rgba(118, 118, 128, .32); position: relative; transition: background .3s ease; }
.apple-switch.on .apple-switch-track { background: var(--green); }
.apple-switch-thumb { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .3s ease; }
.apple-switch.on .apple-switch-thumb { transform: translateX(20px); }

/* Rádios Customizados Apple */
.radio-row { cursor: pointer; }
.radio-row input { display: none; }
.radio-custom { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); position: relative; flex-shrink: 0; margin-left: 10px; transition: all 0.2s ease; }
.radio-row input:checked + .radio-custom { border-color: var(--blue); background: var(--blue); }
.radio-row input:checked + .radio-custom::after { content: ''; position: absolute; top: 6px; left: 6px; width: 8px; height: 8px; background: #fff; border-radius: 50%; }

/* Campos de Texto Minimalistas */
.form-field { width: 100%; padding: 12px 0; background: transparent; border: none; color: var(--text-primary); font-size: .95rem; outline: none; }
.form-field::placeholder { color: var(--text-tertiary); }

/* ══════════════ BOTÕES E TIMELINE ══════════════ */
.submit-btn { width: 100%; padding: 16px; border: none; border-radius: var(--r-sm); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; transition: all 0.2s ease; }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(100%); }
.submit-btn:not(:disabled):active { transform: scale(0.98); }
.cam-btn { padding: 12px 20px; border-radius: var(--r-full); border: none; font-size: .85rem; font-weight: 600; cursor: pointer; background: rgba(118,118,128,.15); color: var(--text-primary); }

.timeline-container { background: var(--surface-1); border: .5px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.timeline-item { display: flex; align-items: center; padding: 10px 0; border-bottom: .5px solid var(--border); }
.timeline-item:last-child { border-bottom: none; padding-bottom: 0; }
.tl-hora { font-family: var(--font-rounded); font-weight: 700; color: var(--text-secondary); width: 60px; font-size: .85rem; }
.tl-nome { flex: 1; font-weight: 600; font-size: .9rem; }
.tl-tipo { padding: 4px 10px; border-radius: 8px; font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.tl-ENTRADA { background: var(--green-soft); color: var(--green); }
.tl-SAÍDA_ALMOÇO { background: var(--orange-soft); color: var(--orange); }
.tl-RETORNO_ALMOÇO { background: var(--blue-soft); color: var(--blue); }
.tl-SAÍDA { background: var(--red-soft); color: var(--red); }

/* ══════════════ GESTOR & MODAIS ══════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--surface-1); border: .5px solid var(--border); border-radius: var(--r-md); padding: 16px 12px; text-align: center; cursor: pointer; }
.stat-card .s-icon { font-size: 1.2rem; display: block; margin-bottom: 8px; }
.stat-card .s-label { font-size: .6rem; color: var(--text-tertiary); text-transform: uppercase; font-weight: 600; margin-bottom: 4px; }
.stat-card .s-value { font-size: 1.4rem; font-weight: 800; font-family: var(--font-rounded); }

.relatorio-switch-row { display: flex; align-items: center; justify-content: space-between; background: var(--surface-1); border: .5px solid var(--border); border-radius: var(--r-lg); padding: 16px 20px; margin-bottom: 24px; }
.relatorio-switch-label { font-size: .9rem; font-weight: 600; color: var(--text-primary); }

/* Textos de estado vazio nas listas */
.empty-text { color: var(--text-tertiary); font-size: .85rem; text-align: center; padding: 40px 20px; }

/* Ajuste Glassmorphism para as listas rápidas */
.modal-full { display: none; position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.8) !important; backdrop-filter: blur(50px) !important; -webkit-backdrop-filter: blur(50px) !important; overflow-y: auto; }
.modal-full.show { display: block; animation: modalSlide .35s var(--ease); }
@keyframes modalSlide { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.modal-bar { position: sticky; top: 0; z-index: 10; background: rgba(0,0,0,.8); backdrop-filter: blur(40px); border-bottom: .5px solid var(--border); padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; }
.modal-bar h2 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-close { background: rgba(118,118,128,.15); color: var(--text-secondary); border: none; border-radius: var(--r-full); padding: 8px 18px; font-weight: 600; cursor: pointer; }
.modal-body { max-width: 600px; margin: 0 auto; padding: 24px 16px; }

/* ══════════════ OVERLAYS & TOASTS ══════════════ */
.success-overlay { display: none; position: fixed; inset: 0; z-index: 8000; background: rgba(0,0,0,.85); backdrop-filter: blur(30px); align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
.success-overlay.show { display: flex; animation: successPop .3s ease; }
@keyframes successPop { from { opacity: 0; } to { opacity: 1; } }
.success-icon { font-size: 4rem; }
.success-msg { font-size: 1.15rem; font-weight: 700; color: var(--text-white); }
.success-detail { font-size: .84rem; color: var(--text-tertiary); font-family: var(--font-rounded); }

.toast { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--surface-elevated); border: .5px solid var(--border); border-radius: var(--r-full); padding: 12px 28px; color: var(--text-primary); font-size: .84rem; font-weight: 600; z-index: 11000; opacity: 0; transition: all .4s ease; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════ IMPRESSÃO ══════════════ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; color: #000 !important; }
  .modal-bar, .bg-scene, .top-bar { display: none !important; }
  .rel-card { page-break-inside: avoid; border: 1px solid #ccc; margin-bottom: 15px; padding: 10px; }
  .rel-grid { display: flex; justify-content: space-between; }
}

/* ══════════════════════════════════════════════════════════════
   TOOLTIP — Balões de Ajuda (Controlado 100% pelo app.js)
   ══════════════════════════════════════════════════════════════ */
.help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(10, 132, 255, 0.15); color: var(--blue);
  font-size: 0.7rem; font-weight: 700; font-family: var(--font-rounded);
  cursor: pointer; margin-left: 6px; vertical-align: middle; 
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.help-icon:active, .help-icon.active { 
  transform: scale(0.85); 
  background: var(--blue); 
  color: #ffffff; 
}

/* O balão que o JS vai criar e jogar na tela */
.tooltip-balloon {
  position: fixed; /* Fixed garante que nada na tela vai cortar o balão */
  z-index: 20000; 
  width: max-content; max-width: 260px; 
  padding: 12px 16px; text-align: center;
  background: rgba(28, 28, 30, 0.85); 
  backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  border: 0.5px solid rgba(255, 255, 255, 0.15); 
  border-radius: 12px; color: #f5f5f7;
  font-family: var(--font); font-size: 0.8rem; font-weight: 500; line-height: 1.4;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  animation: tooltipIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  pointer-events: none; /* Evita que o balão roube o clique de outros botões */
}

@keyframes tooltipIn { 
  from { opacity: 0; transform: translate(-50%, 10px) scale(0.95); } 
  to { opacity: 1; transform: translate(-50%, 0) scale(1); } 
}

/* Suaviza entrada do app após splash do PWA */
body {
  animation: fadeInApp 0.3s ease-out;
}

@keyframes fadeInApp {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Evita flash branco em iOS/Android antes do CSS carregar */
html {
  background: #0a0a0a;
}

/* Esconde tudo no primeiro milissegundo */
body {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

/* O JS vai adicionar essa classe quando estiver tudo pronto */
body.pronto {
  opacity: 1;
}

/* ══════════════ BANNER DE FERIADO PREMIUM ══════════════ */
.feriado-banner {
  background: linear-gradient(145deg, rgba(255, 69, 58, 0.12), rgba(255, 159, 10, 0.12));
  border: 1px solid rgba(255, 69, 58, 0.25);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeInApp 0.4s ease-out;
}
.feriado-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 4px 12px rgba(255, 69, 58, 0.4));
}
.feriado-text { flex: 1; }
.feriado-title {
  color: var(--red);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.feriado-sub {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
}
.tag-extra {
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  margin-left: 8px;
  text-transform: uppercase;
  vertical-align: middle;
}
