/* ═══════════════════════════════════════════════════════════
   global.css — FitLab
   Reset, variáveis de tema, componentes base compartilhados
   entre todos os painéis (professor e aluno).
═══════════════════════════════════════════════════════════ */

/* ── VARIÁVEIS — TEMA ESCURO (padrão) ─────────────────── */
:root {
  /* Paleta de marca */
  --pri:        #1B4458;
  --pri-d:      #0D2233;
  --pri-l:      #2A5870;
  --acc:        #E8732E;
  --acc-h:      #C45A1E;
  --acc-l:      #F0956A;
  --suc:        #3ABA80;
  --dan:        #E05030;
  --warn:       #E8B030;
  --info:       #378ADD;

  /* Superfícies — dark */
  --bg:         #0D2233;
  --bg-deep:    #091E2C;
  --surface:    #132D3F;
  --surface2:   #091E2C;
  --border:     #1E4560;
  --border2:    #2A5870;

  /* Texto — dark */
  --txt:        #D8EEF8;
  --txt2:       #5A8FA8;
  --txt3:       #2A5870;

  /* Topbar / sidebar — dark */
  --topbar-bg:  #091E2C;
  --side-bg:    #091E2C;
  --side-item:  rgba(255,255,255,.06);
  --side-act:   rgba(232,115,46,.12);
  --side-txt:   rgba(255,255,255,.6);
  --side-act-txt: #E8732E;

  /* Tipografia */
  --font:       system-ui, -apple-system, sans-serif;

  /* Tamanhos de fonte acessíveis */
  --fs-xs:      13px;
  --fs-sm:      14px;
  --fs-base:    15px;
  --fs-md:      16px;
  --fs-lg:      18px;
  --fs-xl:      21px;

  /* Alturas mínimas (acessibilidade touch) */
  --touch-min:  48px;

  /* Bordas */
  --radius-sm:  8px;
  --radius:     11px;
  --radius-lg:  15px;
  --radius-xl:  20px;
}

/* ── TEMA CLARO ────────────────────────────────────────── */
[data-theme="light"] {
  --bg:         #EEF3F6;
  --bg-deep:    #E2ECF2;
  --surface:    #FFFFFF;
  --surface2:   #F2F7FA;
  --border:     #C8DDE8;
  --border2:    #B0CADA;
  --txt:        #1A2E3B;
  --txt2:       #5A7888;
  --txt3:       #A0BFCC;
  --topbar-bg:  #1B4458;
  --side-bg:    #1B4458;
}

/* ── RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  /* Impede zoom automático em inputs no iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  background: var(--bg);
  color: var(--txt);
  transition: background .25s, color .25s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button    { cursor: pointer; font-family: inherit; font-size: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: var(--fs-base); /* evita zoom no iOS (precisa de 16px+) */
}
a         { color: var(--acc); text-decoration: none; }
a:hover   { text-decoration: underline; }
code      { font-family: monospace; }

/* ── SCROLLBAR PERSONALIZADO ────────────────────────────── */
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

/* Chrome / Safari / Edge */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 6px;
  transition: background .2s;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--txt2);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* ── UTILITÁRIOS ────────────────────────────────────────── */
.hidden       { display: none !important; }
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-6        { gap: 6px; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.flex-1       { flex: 1; }
.ml-auto      { margin-left: auto; }
.text-sm      { font-size: var(--fs-sm); }
.text-xs      { font-size: var(--fs-xs); }
.font-500     { font-weight: 500; }
.p-0          { padding: 0 !important; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cores semânticas */
.c-acc  { color: var(--acc); }
.c-suc  { color: var(--suc); }
.c-dan  { color: var(--dan); }
.c-txt2 { color: var(--txt2); }
.c-txt3 { color: var(--txt3); }

/* ── BOTÕES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--touch-min);
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity .2s, background .15s;
  text-decoration: none !important;
  white-space: nowrap;
  /* Toque mais fácil */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover  { opacity: .88; }
.btn:active { opacity: .72; transform: scale(.98); }
.btn i      { font-size: 18px; flex-shrink: 0; }

.btn-primary { background: var(--acc);  color: #fff; }
.btn-ghost   {
  background: transparent;
  color: var(--txt2);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover  { background: var(--surface2); }
.btn-danger       { background: var(--dan);  color: #fff; }
.btn-info         { background: var(--info); color: #fff; }

/* Tamanho menor — dentro de modais, toolbars desktop */
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}
.btn-sm i { font-size: 15px; }

/* Botão ícone (quadrado) */
.btn-icon {
  width: var(--touch-min);
  height: var(--touch-min);
  min-height: unset;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--txt2);
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { background: var(--surface2); }
.btn-icon i     { font-size: 20px; }

/* ── INPUTS ─────────────────────────────────────────────── */
.inp {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 14px;
  background: transparent;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  color: var(--txt);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  /* Evita zoom iOS */
  font-size: max(var(--fs-base), 16px);
}
.inp:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(232,115,46,.15);
}
.inp::placeholder { color: var(--txt3); }
.inp:read-only    { opacity: .6; cursor: default; }

/* Textarea */
textarea.inp {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

/* Select */
.sel {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 36px 0 14px;
  background: transparent;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  font-size: max(var(--fs-base), 16px);
  color: var(--txt);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%235A7888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color .2s;
}
.sel:focus { border-color: var(--acc); }
.sel option { background: var(--surface); color: var(--txt); }

/* Label */
.lbl {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--txt2);
  margin-bottom: 5px;
  letter-spacing: .02em;
}
.lbl small { font-size: 12px; color: var(--txt3); }

/* Campo + label em coluna */
.field { display: flex; flex-direction: column; gap: 4px; }

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: background .25s, border-color .25s;
}
.card-sm { border-radius: var(--radius); padding: 12px 14px; }

.card-inner-title {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--txt);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
}
.card-head i    { font-size: 18px; color: var(--acc); }
.card-head span { font-size: var(--fs-sm); font-weight: 500; color: var(--txt); flex: 1; }

.card-list { padding: 8px; display: flex; flex-direction: column; gap: 5px; }

.card-footer-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── BADGES / PILLS ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.badge-suc  { background: rgba(58,186,128,.12);  color: var(--suc);  border: 1px solid rgba(58,186,128,.25); }
.badge-dan  { background: rgba(224,80,48,.12);   color: var(--dan);  border: 1px solid rgba(224,80,48,.25); }
.badge-acc  { background: rgba(232,115,46,.12);  color: var(--acc);  border: 1px solid rgba(232,115,46,.25); }
.badge-neu  { background: var(--surface2);       color: var(--txt2); border: 1px solid var(--border); }
.badge-info { background: rgba(55,138,221,.12);  color: var(--info); border: 1px solid rgba(55,138,221,.25); }

/* Status dot */
.s-dot     { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.s-dot.on  { background: var(--suc); }
.s-dot.off { background: var(--txt3); }

/* ── AVATAR ─────────────────────────────────────────────── */
.ava {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--acc);
  user-select: none;
}
.ava-sm  { width: 34px; height: 34px; font-size: 13px; }
.ava-md  { width: 42px; height: 42px; font-size: 15px; }
.ava-lg  { width: 54px; height: 54px; font-size: 18px; }

/* ── SWITCH TOGGLE ──────────────────────────────────────── */
.sw-toggle {
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--border2);
  position: relative;
  cursor: pointer;
  transition: background .25s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.sw-toggle.on { background: var(--acc); }
.sw-toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.sw-toggle.on::after { transform: translateX(20px); }

/* ── COLOR PICKER ────────────────────────────────────────── */
.color-pick {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  padding: 3px;
  background: transparent;
  flex-shrink: 0;
}

/* ── DIVISOR ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── GRIDS DE FORMULÁRIO ─────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field.full  { grid-column: 1 / -1; }

/* ── TABELA ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table         { width: 100%; border-collapse: collapse; }
thead tr      { border-bottom: 1px solid var(--border); }
thead th      {
  padding: 11px 14px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--txt2);
  text-align: left;
  letter-spacing: .06em;
  text-transform: uppercase;
}
tbody tr      { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td      { padding: 13px 14px; font-size: var(--fs-sm); color: var(--txt); }
.table-empty  { text-align: center; padding: 32px; color: var(--txt2); font-size: var(--fs-sm); }

/* ── UPLOAD AREA ─────────────────────────────────────────── */
.upload-area {
  border: 1.5px dashed var(--acc);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.upload-area:hover   { background: rgba(232,115,46,.05); }
.upload-area i       { font-size: 30px; color: var(--acc); display: block; margin-bottom: 8px; }
.upload-area p       { font-size: var(--fs-sm); color: var(--txt2); }
.upload-area small   { font-size: var(--fs-xs); color: var(--acc); }
.upload-area input   { display: none; }

/* ── RADIO LABEL ─────────────────────────────────────────── */
.radio-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--txt2);
  cursor: pointer;
  min-height: var(--touch-min);
}
.radio-lbl input { accent-color: var(--acc); width: 18px; height: 18px; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: flex-end;   /* mobile: sobe de baixo */
  justify-content: center;
  padding: 0;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: 20px; }
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,1,.6,1);
}
@media (min-width: 600px) {
  .modal-box {
    border-radius: var(--radius-lg);
    transform: translateY(14px);
    transition: transform .2s;
  }
}
.modal-backdrop.open .modal-box { transform: translateY(0); }

/* Drag handle mobile */
.modal-box::before {
  content: "";
  display: block;
  width: 36px; height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin: 10px auto 0;
}
@media (min-width: 600px) {
  .modal-box::before { display: none; }
}

.modal-head {
  background: var(--pri);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.modal-head i    { font-size: 20px; color: #fff; }
.modal-head span { font-size: var(--fs-md); font-weight: 500; color: #fff; flex: 1; }
.modal-close {
  background: none; border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 22px;
  display: flex;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  align-items: center; justify-content: center;
}
.modal-close:hover { color: #fff; }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  align-items: center;
}

/* ── TOAST ───────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 80px; /* acima da bottom nav */
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--pri);
  color: #fff;
  padding: 13px 22px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  border: 1px solid var(--pri-l);
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.ok  { background: #1B6040; border-color: #2A8A60; }
#toast.err { background: var(--dan); border-color: #C04020; }

/* ── ONLINE BADGE / PULSE ────────────────────────────────── */
.online-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(58,186,128,.08);
  border: 1px solid rgba(58,186,128,.2);
}
.online-badge span { font-size: var(--fs-xs); color: var(--suc); font-weight: 500; }

.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--suc);
  flex-shrink: 0;
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

/* ── FILTRO PILLS ────────────────────────────────────────── */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.fpill {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  color: var(--txt2);
  background: transparent;
  transition: all .15s;
  min-height: 38px;
  display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.fpill:hover  { border-color: var(--acc); color: var(--acc); }
.fpill.active { background: var(--surface); border-color: var(--acc); color: var(--acc); }

/* ── SEC HEAD ────────────────────────────────────────────── */
.sec-head  { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.sec-title { font-size: var(--fs-md); font-weight: 500; color: var(--txt); }

/* ── TOOLBAR ─────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  flex: 1;
  max-width: 320px;
  min-height: var(--touch-min);
}
.search-wrap i { font-size: 18px; color: var(--txt3); flex-shrink: 0; }
.search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  font-size: max(var(--fs-base), 16px);
  color: var(--txt);
  width: 100%;
}
.search-wrap input::placeholder { color: var(--txt3); }

/* ── GRID UTILITÁRIO ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.grid-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 48px 20px;
  color: var(--txt2);
  font-size: var(--fs-sm);
}
.list-empty { font-size: var(--fs-sm); color: var(--txt2); padding: 10px; }

/* ── DANGER ZONE ─────────────────────────────────────────── */
.danger-zone { border-color: rgba(224,80,48,.3); }

/* ── GRUPOS DE CHIPS ─────────────────────────────────────── */
.grupo-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.grupo-chip {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--txt2);
  cursor: pointer;
  background: transparent;
  transition: all .15s;
  min-height: 38px;
  display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.grupo-chip:hover { border-color: var(--acc); color: var(--acc); }
.grupo-chip.sel   { background: var(--acc); border-color: var(--acc); color: #fff; }

/* ── ANIMAÇÕES ───────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideIn { from { transform:translateX(100%); } to { transform:translateX(0); } }

.spin { animation: spin .8s linear infinite; }
.fade-in { animation: fadeIn .25s ease forwards; }

/* ── RESPONSIVO ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 14px 15px; }
  table { font-size: var(--fs-xs); }
  thead th, tbody td { padding: 10px 11px; }
}

@media (max-width: 400px) {
  .form-grid-3 { grid-template-columns: 1fr; }
}
