/**
 * JJTV — complementos de UI (cabeçalhos, ícones de ação, tabelas).
 * Pequenos ajustes de layout UBold: ver secção no fim (condensed + cadeia flex).
 */

/* ---------- Cabeçalho de página (título + subtítulo + ações) ---------- */
.jj-page-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
  min-width: 0;
}

@media (min-width: 640px) {
  .jj-page-header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
    column-gap: 1.5rem;
    row-gap: 1rem;
  }
}

.jj-page-header__text {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.jj-page-header__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: #101828;
  word-break: normal;
  overflow-wrap: break-word;
}

@media (min-width: 1280px) {
  .jj-page-header__title {
    font-size: 1.75rem;
    line-height: 1.3;
  }
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-page-header__title {
  color: rgba(255, 255, 255, 0.92);
}

.jj-page-header__sub {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #667085;
  max-width: 48rem;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-page-header__sub {
  color: #98a2b3;
}

.jj-page-header__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.625rem;
}

@media (min-width: 640px) {
  .jj-page-header__actions {
    justify-content: flex-end;
    padding-top: 0.15rem;
  }
}

/* Botão secundário (ex.: Configurações gerais) */
.jj-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: 0.75rem;
  border: 1px solid #e4e7ec;
  background: #ffffff;
  color: #344054;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.jj-btn-outline:hover {
  background: #f9fafb;
  border-color: #d0d5dd;
  color: #182230;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-btn-outline {
  border-color: #1f2937;
  background: rgba(255, 255, 255, 0.03);
  color: #e4e7ec;
  box-shadow: none;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #344054;
}

.jj-btn-outline svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  color: #465fff;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-btn-outline svg {
  color: #8098ff;
}

/* ---------- Ações em tabela: só ícone ---------- */
.jj-table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
}

.jj-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: #475467;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn {
  color: #98a2b3;
}

.jj-icon-btn:hover {
  background: #f2f4f7;
  color: #465fff;
  border-color: #e4e7ec;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #8098ff;
  border-color: #1f2937;
}

.jj-icon-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.jj-icon-btn--danger:hover {
  color: #d92d20;
  background: #fef3f2;
  border-color: #fecdca;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn--danger:hover {
  color: #f97066;
  background: rgba(240, 68, 56, 0.12);
  border-color: rgba(240, 68, 56, 0.3);
}

.jj-icon-btn--success:hover {
  color: #039855;
  background: #ecfdf3;
  border-color: #a6f4c5;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn--success:hover {
  color: #32d583;
  background: rgba(18, 183, 106, 0.14);
  border-color: rgba(18, 183, 106, 0.28);
}

/* Variante com borda visível (ex.: abrir link) */
.jj-icon-btn--lined {
  border-color: #e4e7ec;
  background: #ffffff;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn--lined {
  border-color: #374151;
  background: rgba(255, 255, 255, 0.02);
}

.jj-icon-btn--lined:hover {
  background: #f9fafb;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn--lined:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Excluir: estado suave sempre visível (armazenamento) */
.jj-icon-btn--danger-soft {
  color: #d92d20;
  background: #fef3f2;
  border-color: #fecdca;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-icon-btn--danger-soft {
  color: #f97066;
  background: rgba(240, 68, 56, 0.12);
  border-color: rgba(240, 68, 56, 0.28);
}

.jj-icon-btn--danger-soft:hover {
  background: #fee4e2;
  border-color: #fda29b;
}

/* ---------- Ações com borda + ícone + texto (planos, etc.) ---------- */
.jj-btn-icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.125rem;
  padding: 0 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e4e7ec;
  background: #ffffff;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475467;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.jj-btn-icon-label:hover {
  background: #f9fafb;
  border-color: #d0d5dd;
  color: #465fff;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-btn-icon-label {
  border-color: #1f2937;
  background: rgba(255, 255, 255, 0.02);
  color: #98a2b3;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-btn-icon-label:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(70, 95, 255, 0.35);
  color: #8098ff;
}

.jj-btn-icon-label svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.jj-btn-icon-label--danger:hover {
  border-color: #fecdca;
  background: #fef3f2;
  color: #d92d20;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-btn-icon-label--danger:hover {
  border-color: rgba(240, 68, 56, 0.35);
  background: rgba(240, 68, 56, 0.12);
  color: #f97066;
}

/* ---------- Área principal: evita overflow horizontal fantasma ---------- */
.jj-main-shell {
  min-width: 0;
}

.jj-content-area {
  box-sizing: border-box;
  width: 100%;
  max-width: min(100%, 96rem);
  margin-left: auto;
  margin-right: auto;
}

/* Tabelas largas: rolagem horizontal estável */
.jj-table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.jj-table-responsive > table {
  width: 100%;
  border-collapse: collapse;
}

/* Paginação consistente com o painel */
.jj-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #f2f4f7;
  font-size: 0.8125rem;
  color: #475467;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-pagination {
  border-top-color: #1f2937;
  color: #98a2b3;
}

.jj-pagination__meta {
  margin: 0;
  line-height: 1.4;
}

.jj-pagination__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.jj-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 0.625rem;
  border: 1px solid #e4e7ec;
  background: #ffffff;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #344054;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.jj-pagination__btn:hover {
  background: #f9fafb;
  border-color: #d0d5dd;
  color: #465fff;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-pagination__btn {
  border-color: #374151;
  background: rgba(255, 255, 255, 0.03);
  color: #e4e7ec;
  box-shadow: none;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-pagination__btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #465fff;
  color: #8098ff;
}

/* ---------- Meus arquivos ---------- */
.jj-files-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.75rem 1rem;
  border-radius: 1rem;
  border: 2px dashed #d0d5dd;
  background: linear-gradient(180deg, #f9fafb 0%, #f2f4f7 100%);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-files-dropzone {
  border-color: #374151;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.jj-files-dropzone:hover {
  border-color: #9cb4ff;
  background: #f5f8ff;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-files-dropzone:hover {
  border-color: #465fff;
  background: rgba(70, 95, 255, 0.08);
}

.jj-files-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.jj-upgrade-plans::-webkit-scrollbar {
  height: 6px;
}
.jj-upgrade-plans::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #d0d5dd;
}
:is(html.dark, html[data-bs-theme="dark"]) .jj-upgrade-plans::-webkit-scrollbar-thumb {
  background: #475467;
}

.jj-card-hover {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.jj-card-hover:hover {
  border-color: rgba(var(--bs-primary-rgb), 0.45) !important;
  box-shadow: 0 0.25rem 1rem rgba(16, 24, 40, 0.08);
  transform: translateY(-2px);
}

.jj-file-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 0.75rem;
  border: 1px solid #e4e7ec;
  background: #fff;
  padding: 0.75rem 0.875rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-file-card {
  border-color: #1f2937;
  background: rgba(255, 255, 255, 0.03);
}

.jj-file-card:hover {
  border-color: #d0d5dd;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.06);
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-file-card:hover {
  border-color: #344054;
}

.jj-file-card__url {
  font-size: 0.75rem;
  line-height: 1.4;
  word-break: break-all;
  color: #465fff;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-file-card__url {
  color: #8098ff;
}

/* ---------- Admin storage donut ---------- */
.jj-storage-donut {
  position: relative;
  width: min(18rem, 100%);
  aspect-ratio: 1;
}

.jj-storage-donut__ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--jj-donut-bg, conic-gradient(#e5e7eb 0% 100%));
  box-shadow: inset 0 2px 10px rgba(15, 23, 42, 0.08);
}

.jj-storage-donut__center {
  position: absolute;
  inset: 21%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-radius: 999px;
  background: #fff;
  text-align: center;
  padding: 1rem;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-storage-donut__center {
  background: #101828;
}

.jj-storage-donut__label,
.jj-storage-donut__meta {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #667085;
}

.jj-storage-donut__value {
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.2;
  color: #101828;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-storage-donut__label,
:is(html.dark, html[data-bs-theme="dark"]) .jj-storage-donut__meta {
  color: #98a2b3;
}

:is(html.dark, html[data-bs-theme="dark"]) .jj-storage-donut__value {
  color: rgba(255, 255, 255, 0.92);
}

/* Logotipo em login/registro/erros (marca do sistema) */
.jj-auth-brand-logo {
  max-height: 52px;
  width: auto;
}

/* Painel: logo expandida um pouco maior que o default UBold (~22px) */
.sidenav-menu .logo .logo-lg img {
  height: auto;
  max-height: 40px;
  width: auto;
}

.app-topbar .logo-topbar .logo-lg img {
  height: auto;
  max-height: 60px;
  width: auto;
}

.sidenav-menu {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidenav-menu .scrollbar {
  flex: 1 1 auto;
  min-height: 0;
}

.sidenav-menu .scrollbar .simplebar-wrapper,
.sidenav-menu .scrollbar .simplebar-mask,
.sidenav-menu .scrollbar .simplebar-offset,
.sidenav-menu .scrollbar .simplebar-content-wrapper {
  height: 100%;
}

/* Menu colapsado / topbar compacto: favicon visível e proporcional */
.sidenav-menu .logo .logo-sm img,
.app-topbar .logo-topbar .logo-sm img {
  max-height: 34px;
  max-width: 34px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ---------- UBold: layout painel ---------- */
/* Condensed: o stock usa position:absolute no .sidenav-menu — altura segue o .wrapper e fica vão em baixo. Voltar a fixed + viewport como no menu largo. */
html[data-sidenav-size="condensed"] .sidenav-menu {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  inset-inline-start: 0 !important;
}

html[data-sidenav-size="condensed"] .sidenav-menu .scrollbar {
  overflow: hidden;
}

/* O tema define min-height: 1900px só em condensed — torre vazia; manter altura útil. */
html[data-sidenav-size="condensed"] .content-page {
  min-height: calc(100vh - calc(var(--theme-topbar-height) + 1px));
}

/* Respiro entre topbar e títulos/conteúdo (stock só tem padding lateral na .content-page). */
.content-page {
  padding-top: 1.25rem;
}

/* Conteúdo principal dentro da .content-page (flex column do tema). */
.content-page > .container-fluid {
  flex: 1 1 auto;
  min-width: 0;
}
