/* ============================================================
   Guivia — tema do portal
   Identidade: guivia.com.br (navy #0A2540, teal #0FB5A6 → verde
   #4ADE80, Sora nos títulos, Inter no texto)
   ============================================================ */

:root {
  --gv-ink: #0A2540;
  --gv-ink-soft: #33475B;
  --gv-muted: #5B7083;
  --gv-surface: #F4F7F9;
  --gv-line: #E3EAEF;
  --gv-accent: #10B981;
  --gv-teal: #0FB5A6;
  --gv-teal-ink: #0C9488;
  --gv-green: #4ADE80;
  --gv-navy: #0A2540;
  --gv-navy-deep: #071C30;
  --gv-navy-ink: #EAF2F8;
  --gv-navy-muted: #B9CCDB;
  --gv-gradient: linear-gradient(120deg, var(--gv-teal), var(--gv-green));
  --gv-radius: 12px;
  --gv-shadow: 0 1px 2px rgba(10, 37, 64, 0.04), 0 8px 24px rgba(10, 37, 64, 0.05);
  --gv-sidebar-w: 236px;
  --gv-focus-ring: 0 0 0 0.25rem rgba(15, 181, 166, 0.22);
}

html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--gv-ink);
  background: var(--gv-surface);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .wordmark {
  font-family: "Sora", "Inter", system-ui, sans-serif;
  letter-spacing: -0.015em;
  color: var(--gv-ink);
}

a {
  color: var(--gv-teal-ink);
}

a:hover {
  color: #0A7C72;
}

code {
  color: #B02A6E;
}

/* ---------- Wordmark ---------- */
.wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gv-ink);
  line-height: 1;
}

.wordmark span {
  background: var(--gv-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================
   Shell do app: sidebar fixa + conteúdo
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 2rem 0;
}

@media (min-width: 992px) {
  .app-main {
    margin-left: var(--gv-sidebar-w);
  }
}

@media (max-width: 991.98px) {
  .app-main {
    padding: 1.25rem 1rem 0;
  }
}

.app-content {
  flex: 1 0 auto;
}

.app-foot {
  flex-shrink: 0;
  padding: 1.4rem 0 1.1rem;
  color: var(--gv-muted);
  font-size: 0.8rem;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1045;
  width: var(--gv-sidebar-w);
  display: flex;
  flex-direction: column;
  color: var(--gv-navy-ink);
  background:
    radial-gradient(ellipse 420px 260px at 100% -8%, rgba(16, 185, 129, 0.14), transparent),
    linear-gradient(180deg, var(--gv-navy) 0%, var(--gv-navy-deep) 100%);
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.15rem 1.25rem 1rem;
  text-decoration: none;
}

.sidebar-brand img {
  width: 30px;
  height: 30px;
}

.sidebar-brand .wordmark {
  color: #fff;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.35rem 0.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-group {
  margin-top: 1.05rem;
}

.sidebar-group-label {
  padding: 0 0.55rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #7E97A8;
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.55rem 0.5rem 0.8rem;
  margin-bottom: 2px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--gv-navy-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.sidebar-link i {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.85;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(15, 181, 166, 0.16);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: var(--gv-gradient);
}

.sidebar-link.active i {
  opacity: 1;
  color: var(--gv-green);
}

/* ---------- Rodapé da sidebar (usuário) ---------- */
.sidebar-foot {
  flex-shrink: 0;
  padding: 0.85rem 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.user-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #06281F;
  background: var(--gv-gradient);
}

.user-info {
  min-width: 0;
  line-height: 1.25;
}

.user-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 0.7rem;
  color: #7E97A8;
}

.sidebar-user-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.sidebar-user-actions .btn-user {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  padding: 0.32rem 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: transparent;
  color: var(--gv-navy-muted);
  font-size: 0.76rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.sidebar-user-actions .btn-user:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Topbar mobile ---------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--gv-navy);
  color: var(--gv-navy-ink);
}

.app-topbar .topbar-toggle {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
}

.app-topbar .topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.app-topbar .topbar-brand img {
  width: 24px;
  height: 24px;
}

.app-topbar .topbar-brand .wordmark {
  color: #fff;
  font-size: 1.05rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(7, 28, 48, 0.55);
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(3, 12, 22, 0.5);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
}

/* ============================================================
   Overrides Bootstrap — cores da marca
   ============================================================ */

/* ---------- Botões ---------- */
.btn {
  font-weight: 500;
  border-radius: 8px;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus, .form-select:focus {
  box-shadow: var(--gv-focus-ring);
}

.btn-primary {
  background: var(--gv-gradient);
  border: 0;
  color: #06281F;
  font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: linear-gradient(120deg, #0DA294, #3CCB70);
  color: #06281F;
}

.btn-primary:disabled {
  background: var(--gv-gradient);
  color: #06281F;
  opacity: 0.55;
}

.btn-outline-primary {
  color: var(--gv-teal-ink);
  border-color: #9ED8D1;
}

.btn-outline-primary:hover, .btn-outline-primary:active {
  background: var(--gv-teal-ink);
  border-color: var(--gv-teal-ink);
  color: #fff;
}

.btn-secondary {
  background: var(--gv-ink-soft);
  border-color: var(--gv-ink-soft);
}

.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active {
  background: #24364A;
  border-color: #24364A;
}

.btn-outline-secondary {
  color: var(--gv-ink-soft);
  border-color: #C9D5DE;
}

.btn-outline-secondary:hover, .btn-outline-secondary:active {
  background: #EBF1F5;
  border-color: #B7C6D2;
  color: var(--gv-ink);
}

.btn-link {
  color: var(--gv-teal-ink);
}

/* ---------- Formulários ---------- */
.form-control, .form-select {
  border-color: #D5DEE6;
  border-radius: 8px;
  color: var(--gv-ink);
}

.form-control:focus, .form-select:focus {
  border-color: var(--gv-teal);
}

.form-control::placeholder {
  color: #9FB0BE;
}

.form-check-input:checked {
  background-color: var(--gv-teal);
  border-color: var(--gv-teal);
}

.form-label {
  color: var(--gv-ink-soft);
}

.form-text {
  color: var(--gv-muted);
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--gv-line);
  border-radius: var(--gv-radius);
  box-shadow: var(--gv-shadow);
}

.card.shadow-sm {
  box-shadow: var(--gv-shadow) !important;
}

.card-hover {
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(10, 37, 64, 0.12) !important;
}

/* ---------- Tabelas ---------- */
.table {
  color: var(--gv-ink);
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  border-bottom-color: #EDF2F6;
  padding: 0.6rem 0.75rem;
}

.table thead th, .table .table-light th {
  --bs-table-bg: #F8FAFC;
  background-color: #F8FAFC;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gv-muted);
  border-bottom: 1px solid var(--gv-line);
  white-space: nowrap;
}

.table-hover > tbody > tr:hover {
  --bs-table-hover-bg: #F6F9FA;
  background-color: #F6F9FA;
}

.table-success {
  --bs-table-bg: #EFFAF4;
  background-color: #EFFAF4;
}

.table-success > * {
  --bs-table-bg: #EFFAF4;
}

.table-danger {
  --bs-table-bg: #FDF1F1;
  background-color: #FDF1F1;
}

.table-danger > * {
  --bs-table-bg: #FDF1F1;
}

.table-hover > tbody > tr.table-success:hover {
  --bs-table-hover-bg: #E4F5EC;
  background-color: #E4F5EC;
}

.table-hover > tbody > tr.table-danger:hover {
  --bs-table-hover-bg: #FAE7E7;
  background-color: #FAE7E7;
}

/* A primeira/última célula das tabelas dentro de card respeitam o raio */
.card .table-responsive {
  border-radius: calc(var(--gv-radius) - 1px);
}

/* ---------- Badges (pills de status) ---------- */
.badge {
  border-radius: 999px;
  font-weight: 600;
  padding: 0.34em 0.7em;
  letter-spacing: 0.01em;
}

/* Bootstrap 5.1 não traz as classes -subtle usadas nas views — definidas aqui no tom da marca */
.bg-success-subtle   { background-color: #E5F7EE !important; }
.bg-danger-subtle    { background-color: #FDECEC !important; }
.bg-warning-subtle   { background-color: #FFF3DC !important; }
.bg-info-subtle      { background-color: #E3F3FB !important; }
.bg-secondary-subtle { background-color: #EEF2F5 !important; }
.bg-primary-subtle   { background-color: #DFF4F1 !important; }

.border-success-subtle   { border-color: #BEE9D3 !important; }
.border-danger-subtle    { border-color: #F4C7C7 !important; }
.border-warning-subtle   { border-color: #F3DCA8 !important; }
.border-info-subtle      { border-color: #BFE0F0 !important; }
.border-secondary-subtle { border-color: #DCE4EB !important; }
.border-primary-subtle   { border-color: #B7E2DC !important; }

.badge.text-success   { color: #14804A !important; }
.badge.text-danger    { color: #B02A37 !important; }
.badge.text-warning   { color: #A15C07 !important; }
.badge.text-info      { color: #266E93 !important; }
.badge.text-secondary { color: var(--gv-muted) !important; }
.badge.text-primary   { color: #0B7C71 !important; }

.text-primary {
  color: var(--gv-teal-ink) !important;
}

/* ---------- Alerts ---------- */
.alert-accent {
  border-radius: 0 10px 10px 0;
  border: 0;
  border-left: 3px solid;
  box-shadow: var(--gv-shadow);
}

.alert-accent.alert-success { border-color: var(--gv-accent); }
.alert-accent.alert-danger  { border-color: #DC3545; }
.alert-accent.alert-warning { border-color: #F59E0B; }
.alert-accent.alert-info    { border-color: var(--gv-teal); }

.alert-success { background-color: #E5F7EE; color: #14663E; }
.alert-danger  { background-color: #FDECEC; color: #96242F; }
.alert-warning { background-color: #FFF3DC; color: #8A4F06; }
.alert-info    { background-color: #E1F2F1; color: #0B5F57; }

/* ---------- Modais e toasts ---------- */
.modal-content {
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(7, 28, 48, 0.3);
}

.toast {
  border-radius: 10px;
  border: 1px solid var(--gv-line);
  background: #fff;
  box-shadow: 0 10px 32px rgba(10, 37, 64, 0.14);
}

/* ---------- Dropdowns ---------- */
.dropdown-menu {
  border: 1px solid var(--gv-line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(10, 37, 64, 0.12);
}

/* ---------- Paginação / misc ---------- */
.text-muted {
  color: var(--gv-muted) !important;
}

/* ============================================================
   Cabeçalho de página e KPIs
   ============================================================ */
.app-content > .d-flex h5,
.app-content h5.fw-semibold {
  font-size: 1.14rem;
}

.kpi-card .card-body {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
}

.kpi-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: linear-gradient(135deg, rgba(15, 181, 166, 0.13), rgba(74, 222, 128, 0.13));
  color: var(--gv-teal-ink);
}

.kpi-icon.kpi-success { background: #E5F7EE; color: #14804A; }
.kpi-icon.kpi-danger  { background: #FDECEC; color: #B02A37; }
.kpi-icon.kpi-muted   { background: #EEF2F5; color: var(--gv-muted); }

.kpi-value {
  font-family: "Sora", "Inter", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gv-ink);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gv-muted);
}

/* ============================================================
   Páginas de autenticação (fundo navy + card branco)
   ============================================================ */
.auth-body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  background:
    radial-gradient(ellipse 900px 420px at 70% -10%, rgba(16, 185, 129, 0.18), transparent),
    radial-gradient(ellipse 700px 380px at 10% 110%, rgba(15, 181, 166, 0.12), transparent),
    var(--gv-navy-deep);
}

.auth-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}

.auth-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.1rem 2rem 1.9rem;
  box-shadow: 0 24px 70px rgba(3, 12, 22, 0.5);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.auth-brand img {
  width: 34px;
  height: 34px;
}

.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-sub {
  font-size: 0.88rem;
  color: var(--gv-muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-foot {
  margin-top: 1.25rem;
  text-align: center;
  color: #7E97A8;
  font-size: 0.78rem;
}

/* Summary de validação sem erros não deve ocupar espaço */
.validation-summary-valid {
  display: none;
}

/* ---------- Toggle de senha (login/reset) ---------- */
.password-wrapper {
  position: relative;
}

.password-wrapper .form-control {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #9FB0BE;
  line-height: 0;
}

.password-toggle:hover {
  color: var(--gv-ink-soft);
}
