/* Tidal — Portal Genesis design tokens & globals */

:root {
  /* Cream tones */
  --cream: #FBF7F0;
  --cream-2: #F5EFE3;
  --cream-3: #ECE3D0;

  /* Ink (text) */
  --ink: #1F2A2E;
  --ink-2: #2E3A3F;
  --muted: #6B6258;
  --muted-2: #948B7E;
  --muted-3: #C7BEAE;

  /* Lines — reforçadas para contraste */
  --line: rgba(31,42,46,0.20);
  --line-soft: rgba(31,42,46,0.12);
  --line-strong: rgba(31,42,46,0.30);

  /* Surfaces */
  --surface: #FFFFFF;
  --surface-2: #FBF7F0;
  --nav-bg: #1F2A2E;
  --nav-fg: #FBF7F0;

  /* Sombras — profundidade para cards e botões saltarem do fundo */
  --shadow-sm: 0 1px 2px rgba(31,42,46,0.06), 0 1px 3px rgba(31,42,46,0.08);
  --shadow-md: 0 2px 6px rgba(31,42,46,0.08), 0 4px 12px rgba(31,42,46,0.06);
  --shadow-lg: 0 8px 24px -8px rgba(31,42,46,0.18), 0 4px 8px rgba(31,42,46,0.06);

  /* Accent (coral) */
  --accent: #D9694B;
  --accent-2: #B14E36;
  --accent-soft: #F8DDD0;

  /* Semantic */
  --teal: #1F5755;
  --sky: #5C8DAE;
  --leaf: #5C7E4F;
  --sun: #C68A1F;
  --rose: #B14E5C;

  /* Berth tones */
  --berth-cmd: #1F5755;
  --berth-crew: #5C7E4F;
  --berth-ops: #5C8DAE;
  --berth-guest: #C68A1F;

  /* Type */
  --f: 'Inter', -apple-system, system-ui, sans-serif;
  --fs: 'Fraunces', Georgia, serif;
  --fm: 'JetBrains Mono', ui-monospace, monospace;

  /* Sizes */
  --pad: 32px;
  --pad-md: 24px;
  --pad-sm: 16px;
}

[data-theme="dark"] {
  --cream:   #1A2024;
  --cream-2: #14191D;
  --cream-3: #232B30;
  --ink:     #ECE3D0;
  --ink-2:   #D6CCB6;
  --muted:   #9C9484;
  --muted-2: #756E61;
  --muted-3: #4A4639;
  --teal: #5FA8A5;
  --sky:  #7FA8C9;
  --leaf: #85A876;
  --sun:  #D9A94A;
  --rose: #C97F8B;
  --line: rgba(236,227,208,0.18);
  --line-soft: rgba(236,227,208,0.10);
  --line-strong: rgba(236,227,208,0.28);
  --surface: #1F262B;
  --surface-2: #1A2024;
  --nav-bg: #101417;
  --nav-fg: #ECE3D0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px -8px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse  { 0%,100%{opacity:1} 50%{opacity:.45} }
@keyframes slideIn {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Microinterações — transições suaves globais em elementos interativos */
.btn, button, select, .input, input {
  transition: background .15s ease, color .15s ease, border-color .15s ease,
              box-shadow .15s ease, transform .12s ease;
}
.btn:active, button:active { transform: translateY(0.5px); }

/* Empty states — discretos e elegantes */
.empty {
  color: var(--muted);
  font-family: var(--fs);
  font-style: italic;
  font-size: 14px;
  text-align: center;
  opacity: 0.85;
}
.empty::before {
  content: '⚓';
  display: block;
  font-size: 28px;
  font-style: normal;
  opacity: 0.35;
  margin-bottom: 10px;
}

/* ─── Typography ─── */

.t-display {
  font-family: var(--fs);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.t-display em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.t-h1 {
  font-family: var(--fs);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
.t-h2 {
  font-family: var(--fs);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.t-h2 em { font-style: italic; color: var(--accent); font-weight: 400; }
.t-h3 {
  font-family: var(--f);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0;
}
.t-eyebrow {
  font-family: var(--fm);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.t-body {
  font-family: var(--f);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.t-body em { font-family: var(--fs); font-style: italic; color: var(--accent); }
.t-meta {
  font-family: var(--fm);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.t-num {
  font-family: var(--fm);
  font-feature-settings: 'tnum';
}

/* ─── Avatars ─── */
.av {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--fs);
  font-weight: 500;
  color: var(--cream);
  flex-shrink: 0;
}
.av.muted { background: var(--muted-3); color: var(--cream); }
.av.crew { background: var(--berth-crew); }
.av.cmd { background: var(--berth-cmd); }
.av.ops { background: var(--berth-ops); }
.av.guest { background: var(--berth-guest); }
.av.catering { background: #7A6EA6; }
.av.terceirizada { background: #5F7A8C; }
.av-xs { width: 22px; height: 22px; font-size: 11px; }
.av-sm { width: 28px; height: 28px; font-size: 13px; }
.av-md { width: 38px; height: 38px; font-size: 16px; }
.av-lg { width: 52px; height: 52px; font-size: 21px; }
.av-xl { width: 76px; height: 76px; font-size: 30px; }

/* ─── Pills ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--cream-3);
  color: var(--ink-2);
  font-family: var(--f);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.pill.accent { background: var(--accent-soft); color: var(--accent-2); }
.pill.teal { background: rgba(31,87,85,0.12); color: var(--teal); }
.pill.sky { background: rgba(92,141,174,0.15); color: var(--sky); }
.pill.leaf { background: rgba(92,126,79,0.15); color: var(--leaf); }
.pill.sun { background: rgba(198,138,31,0.15); color: var(--sun); }
.pill.rose { background: rgba(177,78,92,0.13); color: var(--rose); }
.pill.female { background: rgba(177,78,92,0.13); color: var(--rose); }
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.pill.live .dot { animation: pulse 2s infinite; background: var(--accent); }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border-radius: 18px;
  padding: var(--pad-md);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  transition: all .25s cubic-bezier(.2,.7,.3,1);
}
.card:hover { box-shadow: var(--shadow-md); }
.card.soft { background: var(--cream); }
.card.sunk { background: var(--cream-2); border-color: transparent; box-shadow: none; }

/* ─── Cards com acento coral (personalidade Tidal) ─── */
/* Faixa coral no topo do card */
.card-accent {
  position: relative;
  border-top: 3px solid var(--accent);
}
/* Borda lateral coral */
.card-edge {
  border-left: 3px solid var(--accent);
}
/* Card de destaque com fundo coral suave */
.card-coral {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 70%);
  border: 1px solid rgba(217,105,75,0.25);
}
/* Cabeçalho de seção com pílula coral */
.eyebrow-coral {
  color: var(--accent);
  font-family: var(--fm);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}
.card-h {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--pad-sm);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--f);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .2s;
}
.btn:hover { background: var(--cream-2); border-color: var(--ink-2); box-shadow: var(--shadow-md); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px rgba(217,105,75,0.3); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { color: var(--ink); background: var(--cream-3); box-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.icon { padding: 8px; }

/* Classes hifenizadas usadas no JSX (btn-primary, btn-sm) */
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(217,105,75,0.3);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Section header ─── */
.section-h {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin: 0 0 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  gap: 16px; flex-wrap: wrap;
}
.section-h h2 {
  font-family: var(--fs); font-weight: 400;
  font-size: 30px; letter-spacing: -0.015em;
  color: var(--ink); margin: 0;
}
.section-h h2 em { font-style: italic; color: var(--accent); font-weight: 400; }
.section-meta { font-family: var(--fm); font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }

/* ─── Inputs ─── */
.input, .select, textarea.input {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--fs);
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: all .2s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.label {
  font-family: var(--fm); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted);
  display: block; margin-bottom: 6px;
}

/* ─── Tabs ─── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  padding: 10px 16px; cursor: pointer;
  font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all .2s;
  font-family: var(--f);
  background: transparent; border-radius: 0; border-left: none; border-right: none; border-top: none;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Badge for berths ─── */
.berth-occ {
  width: 100%; padding: 12px;
  border-radius: 12px;
  display: flex; align-items: center; gap: 12px;
  cursor: grab;
  transition: all .2s;
}
.berth-occ:hover { background: var(--cream-2); }
.berth-occ:active { cursor: grabbing; }

/* ─── Mobile responsive ─── */
@media (max-width: 820px) {
  :root { --pad: 16px; --pad-md: 14px; --pad-sm: 10px; }

  /* Typography */
  .t-display { font-size: clamp(28px, 8vw, 40px) !important; }
  .section-h { margin-bottom: 14px; }
  .section-h h2 { font-size: 22px; }

  /* Main content padding */
  main { padding: 14px 14px 80px !important; }

  /* Cards */
  .card { border-radius: 16px !important; padding: 14px !important; }

  /* Grids — colapsa tudo para 1 coluna */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Tabelas — oculta colunas menos importantes */
  .table-row-desktop { display: none !important; }

  /* Drawers — full screen no mobile */
  [style*="width:480"] { width: 100% !important; }
  [style*="width: 480"] { width: 100% !important; }

  /* Botões de ação — empilha */
  .btn-group-desktop {
    flex-direction: column !important;
    width: 100%;
  }
  .btn-group-desktop .btn { width: 100%; justify-content: center; }

  /* Input full width */
  .input { width: 100% !important; box-sizing: border-box !important; }

  /* Topbar */
  .topbar { padding: 12px 16px 6px !important; }

  /* Sidebar overlay */
  .sidebar-desktop { display: none !important; }

  /* Fix overflow horizontal */
  body { overflow-x: hidden; }
  main > * { max-width: 100vw; box-sizing: border-box; }
}

/* Utilitários responsivos */
.mobile-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 821px) {
  .mobile-stack {
    flex-direction: row;
  }
}

/* Grid responsivo automático */
.rg-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.rg-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 820px) {
  .rg-2 { grid-template-columns: 1fr !important; }
  .rg-3 { grid-template-columns: 1fr !important; }
}


/* print */
@media print {
  body { background: white !important; }
  .no-print, aside, nav, .topbar { display: none !important; }
  .page-content, .main, main { padding: 0 !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ccc; }
}

/* ── Mobile: trava de overflow horizontal (evita scroll lateral fantasma) ── */
@media (max-width: 819px){
  html, body { overflow-x: hidden; max-width: 100%; }
  img, svg, table { max-width: 100%; }
}

/* ── Toggle / segmented control (Semana · Mês · Meus eventos) ── */
.toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--cream-2);
  border-radius: 12px;
  padding: 4px;
  flex-wrap: wrap;
}
.toggle button {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font-family: var(--fm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s ease;
  box-shadow: none;
}
.toggle button:hover { color: var(--ink); }
.toggle button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ── Pulso ao entrar num evento ── */
@keyframes joinPulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.22); }
  55%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
@keyframes cardPop {
  0%   { transform: scale(0.96); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Laranja sólido com cantos de card (o estilo que usei no Logbook,
   diferente do .btn.primary que é pílula) */
.btn.accent {
  background: var(--accent); color: #fff;
  border-color: var(--accent); border-radius: 10px;
  box-shadow: 0 2px 8px rgba(217,105,75,0.25);
}
.btn.accent:hover { background: var(--accent-2); border-color: var(--accent-2); }

/* Botão-ícone quadrado laranja (engrenagem, trocar-autor, etc.)
   — ícone branco dentro, sem texto */
.btn-ico {
  background: var(--accent); color: #fff; border: none;
  border-radius: 9px; padding: 0; width: 30px; height: 30px;
  display: inline-grid; place-items: center; cursor: pointer;
  transition: background .15s;
}
.btn-ico:hover { background: var(--accent-2); }
.btn-ico.sm { width: 26px; height: 26px; border-radius: 7px; }

/* Indicador de "filtro/algo ativo" — pontinho no canto do botão.
   Uso: <button class="btn accent btn-dot"> */
.btn-dot { position: relative; }
.btn-dot::after {
  content: ''; position: absolute; top: -3px; right: -3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--sun); border: 2px solid var(--surface);
}

/* ═══ Sistema Tidal de botões (padrão do barco) ═══
   [P] .btn-tidal    — primário: coral do tema + Fraunces branca
   [S] .btn-tidal-sec — secundário: neutro, texto curto
   [I] .btn-icone     — ícone 34×34 coral (28×28 com .sm)     */
.btn-tidal {
  height: 34px; padding: 0 16px; border-radius: 9px; border: none;
  background: var(--accent); color: #fff;
  font-family: var(--fs); font-size: 14.5px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; box-sizing: border-box; flex-shrink: 0; white-space: nowrap;
  transition: background .15s ease, transform .12s ease;
}
.btn-tidal:hover { background: var(--accent-2); }
.btn-tidal:disabled { opacity: .55; cursor: default; }
.btn-tidal.verde { background: var(--leaf); }
.btn-tidal.verde:hover { filter: brightness(0.92); background: var(--leaf); }
.btn-tidal.rose { background: var(--rose); }

.btn-tidal-sec {
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-family: var(--fm); font-size: 12.5px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  box-sizing: border-box; flex-shrink: 0; white-space: nowrap; transition: background .15s;
}
.btn-tidal-sec:hover { background: var(--cream-2); }
.btn-tidal-sec.rose { color: var(--rose); border-color: var(--rose); }

.btn-icone {
  width: 34px; height: 34px; border-radius: 9px; border: none;
  background: var(--accent); color: #fff;
  cursor: pointer; display: inline-grid; place-items: center;
  font-size: 15px; line-height: 1; flex-shrink: 0; padding: 0; position: relative;
  transition: background .15s ease;
}
.btn-icone:hover { background: var(--accent-2); }
.btn-icone.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.btn-icone.neutro { background: var(--cream-2); color: var(--ink); border: 1px solid var(--line-soft); }
.btn-icone.neutro:hover { background: var(--cream-3); }
.btn-icone.ativo { outline: 2px solid var(--accent-2); }
.btn-icone .badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--sun); color: #1F1A14; border-radius: 999px;
  font-family: var(--fm); font-size: 9px; font-weight: 700; padding: 1px 5px;
}
