/* ============================================
   PRESENÇA APP — style.css
   Tema: Light / White, acentos roxos
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700;800&display=swap');

/* ─── VARIÁVEIS ─── */
:root {
  --bg:         #f4f5f9;
  --surface:    #ffffff;
  --card:       #ffffff;
  --border:     #e8e8f0;
  --border-l:   #f0f0f8;

  --purple:     #6c48c5;
  --purple-l:   #8b6de0;
  --purple-d:   #4f2fa8;
  --purple-bg:  #f0ecff;
  --purple-mid: rgba(108,72,197,0.12);

  --green:      #1aab6d;
  --green-bg:   #edfbf4;
  --red:        #e53e3e;
  --red-bg:     #fff0f0;
  --yellow:     #d48806;
  --yellow-bg:  #fffbe6;
  --grey:       #8c9aad;
  --grey-bg:    #f4f5f7;
  --blue:       #2f86eb;
  --blue-bg:    #eaf3ff;

  --text:       #1a1a2e;
  --text-2:     #4a4a6a;
  --muted:      #9191aa;

  --radius-sm:  10px;
  --radius:     16px;
  --radius-lg:  22px;
  --radius-xl:  28px;

  --shadow-sm:  0 1px 4px rgba(80,60,160,0.06);
  --shadow:     0 4px 16px rgba(80,60,160,0.10);
  --shadow-lg:  0 8px 32px rgba(80,60,160,0.14);
}

/* ─── RESET ─── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { -webkit-text-size-adjust: none; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── TIPOGRAFIA ─── */
h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }

/* ─── HEADER ─── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-top {
  display: flex; align-items: center; gap: 12px;
}
.header-title { font-size: 20px; font-weight: 800; flex: 1; color: var(--text); }
.header-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.header-user  { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ─── AVATAR ─── */
.avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: white;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(108,72,197,0.25);
}

/* ─── BOTÕES HEADER ─── */
.btn-back, .btn-logout {
  background: var(--bg); border: 1.5px solid var(--border);
  color: var(--text-2); padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700; text-decoration: none;
  font-family: 'Sora', sans-serif; cursor: pointer;
  transition: all 0.15s;
}
.btn-back:active, .btn-logout:active  { background: var(--border); }

/* ─── CONTAINER ─── */
.container { padding: 16px; }

/* ─── NAV LINK ─── */
.nav-link {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  margin: 14px 16px 0;
  color: var(--purple); font-size: 14px; font-weight: 700;
  text-decoration: none; transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.nav-link:active { background: var(--purple-bg); }
.nav-link-arrow { margin-left: auto; opacity: 0.4; }

/* ─── SECTION CARD ─── */
.section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.section-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}

/* ─── INPUTS ─── */
select, input[type=text], input[type=date],
input[type=number], input[type=password] {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  appearance: none;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,72,197,0.10);
  background: var(--surface);
}
input::placeholder { color: var(--muted); font-weight: 400; }
select option      { background: var(--surface); }

/* ─── TABS ─── */
.tabs-wrap { padding: 14px 16px 0; }
.tabs {
  display: flex; gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.tab {
  flex: 1; min-width: 80px;
  padding: 11px 8px;
  font-size: 12px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; background: transparent;
  color: var(--muted); white-space: nowrap;
  transition: all 0.2s;
}
.tab.active {
  background: var(--purple);
  color: white;
  box-shadow: 0 4px 12px rgba(108,72,197,0.25);
}

/* ─── PANEL ─── */
.panel { display: none; }
.panel.active { display: block; }

/* ─── BTN NOVO ─── */
.btn-novo {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  font-size: 15px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  color: white; border: none; border-radius: var(--radius);
  cursor: pointer; margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(108,72,197,0.28);
  letter-spacing: 0.2px; transition: all 0.15s;
}
.btn-novo:active { transform: scale(0.98); opacity: 0.92; }

/* ─── SEARCH ROW ─── */
.search-row {
  display: flex; gap: 10px; margin-bottom: 12px;
}
.search-row select { flex: 0 0 auto; background: var(--surface); }
.search-row input  { flex: 1; background: var(--surface); }

/* ─── CARD (lista) ─── */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.25s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.card-top     { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.card-left    { display: flex; align-items: center; gap: 12px; }
.card-avatar  {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: white;
}
.card-nome    { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.card-sub     { font-size: 12px; color: var(--muted); font-weight: 500; }
.card-actions { display: flex; gap: 8px; }

/* ─── BADGES ─── */
.badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 7px; letter-spacing: 0.2px; white-space: nowrap;
}
.badge-ativo   { background: var(--green-bg);   color: var(--green); }
.badge-inativo { background: var(--red-bg);     color: var(--red); }
.badge-obra    { background: var(--blue-bg);    color: var(--blue); }
.badge-admin   { background: var(--purple-bg);  color: var(--purple); }
.badge-enc     { background: var(--blue-bg);    color: var(--blue); }

/* ─── BTN ACTION (editar/excluir nos cards) ─── */
.btn-action {
  padding: 8px 13px; font-size: 12px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-2);
  transition: all 0.15s;
}
.btn-action.edit { border-color: rgba(108,72,197,0.25); color: var(--purple); background: var(--purple-bg); }
.btn-action.del  { border-color: rgba(229,62,62,0.2);   color: var(--red);    background: var(--red-bg); }
.btn-action:active { transform: scale(0.95); }

/* ─── CONTADOR ─── */
.contador {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 10px; margin-bottom: 12px;
}
.cont-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.cont-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.cont-val   { font-size: 30px; font-weight: 800; letter-spacing: -1px; color: var(--text); }

/* ─── FUNCIONÁRIO CARD (apontamento) ─── */
.func-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.25s ease both;
}
.func-header  { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.func-avatar  {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: white;
}
.func-nome   { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.func-funcao {
  font-size: 11px; font-weight: 700; color: var(--purple);
  background: var(--purple-bg); border-radius: 6px;
  padding: 3px 8px; display: inline-block;
}

/* ─── STATUS BUTTONS ─── */
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.status-btn {
  padding: 11px 8px;
  font-size: 12px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--muted);
  text-align: center; transition: all 0.15s;
  user-select: none;
}
.status-btn:active { transform: scale(0.96); }

.sb-PRESENTE  { border-color: rgba(26,171,109,0.25); color: var(--green); }
.sb-FALTA     { border-color: rgba(229,62,62,0.25);  color: var(--red); }
.sb-MEIO      { border-color: rgba(212,136,6,0.25);  color: var(--yellow); }
.sb-FOLGA     { border-color: rgba(140,154,173,0.25);color: var(--grey); }
.sb-ATESTADO  { border-color: rgba(47,134,235,0.25); color: var(--blue); }

.sb-PRESENTE.active  { background: var(--green-bg);  border-color: var(--green);  color: var(--green); }
.sb-FALTA.active     { background: var(--red-bg);    border-color: var(--red);    color: var(--red); }
.sb-MEIO.active      { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow); }
.sb-FOLGA.active     { background: var(--grey-bg);   border-color: var(--grey);   color: var(--grey); }
.sb-ATESTADO.active  { background: var(--blue-bg);   border-color: var(--blue);   color: var(--blue); }

/* ─── BTN SALVAR (fixo) ─── */
.btn-salvar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  color: white; padding: 20px;
  font-size: 16px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  border: none; cursor: pointer;
  box-shadow: 0 -4px 24px rgba(108,72,197,0.22);
  z-index: 101; letter-spacing: 0.3px;
  transition: opacity 0.15s;
}
.btn-salvar:active   { opacity: 0.9; }
.btn-salvar:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── ALERTS ─── */
.alert, .alert-box {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
  animation: fadeUp 0.25s ease;
}
.alert-success { background: var(--green-bg);  border: 1.5px solid rgba(26,171,109,0.25); color: var(--green); }
.alert-error   { background: var(--red-bg);    border: 1.5px solid rgba(229,62,62,0.25);  color: var(--red); }
.alert-warning { background: var(--yellow-bg); border: 1.5px solid rgba(212,136,6,0.25);  color: var(--yellow); }

/* ─── MODAL ─── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(26,26,46,0.45);
  z-index: 200; align-items: flex-end;
  backdrop-filter: blur(3px);
}
.modal-bg.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px 48px;
  width: 100%; max-height: 92vh; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(.16,1,.3,1) both;
  box-shadow: 0 -8px 40px rgba(80,60,160,0.12);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px; margin: 0 auto 20px;
}
.modal h2 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 22px; }

/* ─── FORM FIELDS (modal) ─── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 7px;
}
.required { color: var(--red); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.divider {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin: 18px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border-l);
}

/* ─── BTN SAVE / CANCEL ─── */
.btn-save {
  width: 100%; padding: 16px;
  font-size: 15px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  color: white; border: none; border-radius: var(--radius);
  cursor: pointer; margin-bottom: 10px;
  box-shadow: 0 6px 18px rgba(108,72,197,0.25);
  transition: all 0.15s;
}
.btn-save:active   { transform: scale(0.98); }
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-cancel {
  width: 100%; padding: 14px;
  font-size: 14px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  background: var(--bg); color: var(--muted);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s;
}
.btn-cancel:active { background: var(--border); }

/* ─── LOADING / EMPTY ─── */
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }
.empty-icon { font-size: 44px; display: block; margin-bottom: 10px; opacity: 0.3; }

/* ─── UTILITY ─── */
.hidden { display: none !important; }
.pb-salvar { padding-bottom: 110px; }

/* ─── LOGIN ─── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #f0ecff 0%, #f4f5f9 50%, #eaf3ff 100%);
}
.login-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 28px 36px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s cubic-bezier(.16,1,.3,1) both;
}
.login-logo {
  display: flex; align-items: center; gap: 14px; margin-bottom: 32px;
}
.login-logo-icon {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 8px 20px rgba(108,72,197,0.28);
}
.login-logo h1 { font-size: 18px; font-weight: 800; color: var(--text); }
.login-logo p  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.login-title    { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 28px; }

.input-wrap { position: relative; }
.input-wrap input { background: var(--bg); }
.input-wrap input:focus { background: var(--surface); }
.input-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px; pointer-events: none;
}

.btn-login {
  width: 100%; padding: 16px;
  font-size: 15px; font-weight: 700;
  font-family: 'Sora', sans-serif;
  background: linear-gradient(135deg, var(--purple-l), var(--purple-d));
  color: white; border: none; border-radius: var(--radius);
  cursor: pointer; margin-top: 6px;
  box-shadow: 0 8px 24px rgba(108,72,197,0.28);
  transition: all 0.2s; letter-spacing: 0.3px;
}
.btn-login:active   { transform: scale(0.98); opacity: 0.9; }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.login-footer { margin-top: 20px; text-align: center; font-size: 12px; color: var(--muted); }


/* ============================================
   DESKTOP OVERRIDES
   ≥768px: container centralizado, modal central
   ≥1024px: sidebar + layout de duas colunas
   ============================================ */

/* ─── TABLET (≥768px) ─── */
@media (min-width: 768px) {

  /* Container centralizado com largura máxima */
  .container {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 32px;
  }

  .tabs-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px 32px 0;
  }

  .nav-link {
    max-width: 760px;
    margin: 16px auto 0;
  }

  /* Header com padding maior */
  .header { padding: 18px 32px; }
  .header-title { font-size: 22px; }

  /* Hover states (sem :active no desktop) */
  .btn-back:hover, .btn-logout:hover { background: var(--border); }
  .nav-link:hover { background: var(--purple-bg); }
  .btn-novo:hover { opacity: 0.92; transform: scale(0.99); }
  .btn-save:hover { opacity: 0.92; }
  .btn-cancel:hover { background: var(--border); }
  .btn-action:hover { opacity: 0.85; }
  .btn-login:hover { opacity: 0.9; transform: scale(0.99); }
  .tab:hover:not(.active) { background: var(--bg); color: var(--text-2); }
  .status-btn:hover:not(.active) { background: var(--grey-bg); }

  /* Modal vira dialog central */
  .modal-bg {
    align-items: center;
    justify-content: center;
  }
  .modal {
    border-radius: var(--radius-xl);
    max-width: 520px;
    max-height: 88vh;
    padding: 32px 32px 36px;
    animation: fadeUp 0.25s cubic-bezier(.16,1,.3,1) both;
  }
  .modal-handle { display: none; }

  /* Btn salvar sai do fixed, vira botão inline */
  .btn-salvar {
    position: static;
    border-radius: var(--radius);
    padding: 15px;
    max-width: 760px;
    display: block;
    margin: 0 auto 24px;
    box-shadow: 0 6px 20px rgba(108,72,197,0.28);
  }
  .pb-salvar { padding-bottom: 16px; }

  /* Contador com células maiores */
  .cont-val { font-size: 36px; }

  /* Status grid 5 colunas */
  .status-grid { grid-template-columns: repeat(5, 1fr); }

  /* Cards com cursor pointer */
  .card, .func-card { cursor: default; }

  /* Seção login — card mais elegante */
  .login-card { padding: 48px 40px 44px; }
  .login-title { font-size: 30px; }
}


/* ─── DESKTOP (≥1024px) ─── */
@media (min-width: 1024px) {

  /* Layout raiz: sidebar + conteúdo */
  body { display: flex; flex-direction: column; }

  /* Header full width */
  .header {
    padding: 16px 40px;
    position: sticky; top: 0;
  }

  /* Wrapper principal — deve envolver sidebar + main no HTML.
     Fallback: container empilha normalmente caso não exista .app-body */
  .app-body {
    display: flex;
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 0 40px;
    gap: 28px;
    align-items: flex-start;
  }

  /* Sidebar de navegação (se existir .sidebar no HTML) */
  .sidebar {
    flex: 0 0 220px;
    position: sticky;
    top: 73px; /* altura do header */
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    box-shadow: var(--shadow-sm);
    margin-top: 24px;
  }
  .sidebar .nav-link {
    margin: 0 0 6px;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
  }
  .sidebar .nav-link:last-child { margin-bottom: 0; }

  /* Área de conteúdo principal */
  .main-content {
    flex: 1;
    min-width: 0;
  }

  /* Container dentro do main-content não precisa de max-width próprio */
  .app-body .container {
    max-width: none;
    padding: 24px 0;
  }
  .app-body .tabs-wrap {
    max-width: none;
    padding: 16px 0 0;
  }

  /* Cards em grid 2 colunas na listagem */
  .cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .cards-grid .card,
  .cards-grid .func-card {
    margin-bottom: 0;
  }

  /* Contador 5 colunas se houver 5 itens */
  .contador-5 {
    grid-template-columns: repeat(5, 1fr);
  }

  /* Modal mais largo */
  .modal { max-width: 600px; }

  /* Tipografia levemente maior */
  h1 { font-size: 26px; }
  h2 { font-size: 22px; }

  /* Header title */
  .header-title { font-size: 24px; }
}


/* ─── WIDE (≥1440px) ─── */
@media (min-width: 1440px) {
  .app-body {
    max-width: 1400px;
    padding: 0 56px;
  }
  .sidebar { flex: 0 0 240px; }
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
}