/*
 * Portal Custom CSS
 * Overrides and extensions on top of Vuexy HTML Admin Template.
 *
 * Source: CUSTOM (not from Vuexy vendor directory)
 */

/* ── Critical layout fixes (equivalent to Vuexy's demo.css) ────────────────── */

/* Sidebar brand area height must match the detached navbar total height */
.menu .app-brand.demo {
  height: 64px;
}

/* layout-navbar-fixed: push layout-page down so content is not hidden behind
 * the sticky navbar. The detached navbar takes:
 *   1rem top margin + 3.5rem height = 4.5rem ≈ 72px for vertical layouts.
 */
.layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page {
  padding-top: 64px !important;
}
.layout-navbar-fixed .layout-wrapper:not(.layout-horizontal):not(.layout-without-menu) .layout-page {
  padding-top: 72px !important;
}

/* Prevent nested navbars from inheriting z-index stacking issues */
.content-wrapper .navbar {
  z-index: auto;
}

/* ── Timeline component (Vuexy-compatible) ─────────────────────────────────── */
.timeline {
  list-style: none;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(var(--bs-primary-rgb), .14);
}
.timeline-item {
  position: relative;
  padding: 0 0 1.5rem 2.5rem;
}
.timeline-point {
  position: absolute;
  left: 0.375rem;
  top: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--bs-primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .2);
}
.timeline-point-secondary { background: #a1acb8; box-shadow: 0 0 0 3px #f0f0f0; }
.timeline-point-primary   { background: var(--bs-primary); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .2); }

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .5rem;
  flex-wrap: wrap;
  gap: .25rem;
}
.timeline-event {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: .375rem;
  padding: .75rem 1rem;
}

/* Auth layout is handled entirely by vendor/css/pages/page-auth.css */

/* ── Badge label helpers (Vuexy compatible) ───────────────────────────────── */
.bg-label-primary   { background-color: rgba(var(--bs-primary-rgb), .16) !important; color: var(--bs-primary) !important; }
.bg-label-success   { background-color: rgba(113, 221, 55, .16)  !important; color: #71dd37 !important; }
.bg-label-info      { background-color: rgba(3, 195, 236, .16)   !important; color: #03c3ec !important; }
.bg-label-warning   { background-color: rgba(255, 171, 0, .16)   !important; color: #ffab00 !important; }
.bg-label-danger    { background-color: rgba(255, 62, 29, .16)   !important; color: #ff3e1d !important; }
.bg-label-secondary { background-color: rgba(161, 172, 184, .16) !important; color: #8592a3 !important; }
.bg-label-dark      { background-color: rgba(75, 70, 92, .16)    !important; color: #4b465c !important; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }

/* Avatar initial font sizing */
.avatar-initial { font-size: .875rem; font-weight: 600; }

/* ── Icon sizing helpers (Tabler Icons via iconify) ───────────────────────── */
.icon-sm { font-size: 1rem !important; }
.icon-md { font-size: 1.25rem !important; }
.icon-lg { font-size: 1.5rem !important; }
.icon-20px { font-size: 1.25rem !important; }

/* ── Ticket timeline: colors keyed to status ──────────────────────────────── */
.timeline-item.border-primary .timeline-event { border-left: 3px solid var(--bs-primary); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--bs-secondary-color, #8592a3);
  text-align: center;
}
.empty-state i { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }

/* ── Profile avatar large ────────────────────────────────────────────────── */
.avatar-xl .avatar-initial { font-size: 2rem; }

/* ── Markdown rendered content ───────────────────────────────────────────── */
.markdown-content { font-size: .9rem; line-height: 1.6; }
.markdown-content p { margin-bottom: .5rem; }
.markdown-content p:last-child { margin-bottom: 0; }
.markdown-content ul, .markdown-content ol { padding-left: 1.25rem; margin-bottom: .5rem; }
.markdown-content pre { background: var(--bs-tertiary-bg); border-radius: .375rem; padding: .75rem; overflow-x: auto; }
.markdown-content code { font-size: .85em; background: var(--bs-tertiary-bg); border-radius: .25rem; padding: .1em .3em; }
.markdown-content pre code { background: none; padding: 0; }
.markdown-content blockquote { border-left: 3px solid var(--bs-border-color); padding-left: .75rem; color: var(--bs-secondary-color); margin: .5rem 0; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 { font-size: 1rem; font-weight: 600; margin-top: .75rem; margin-bottom: .25rem; }
.markdown-content a { color: var(--bs-primary); }

/* ── EasyMDE overrides (adapta ao tema Vuexy) ────────────────────────────── */
.EasyMDEContainer .CodeMirror { border: 1px solid var(--bs-border-color); border-radius: 0 0 .375rem .375rem; font-size: .875rem; }
.editor-toolbar { border: 1px solid var(--bs-border-color); border-bottom: none; border-radius: .375rem .375rem 0 0; background: var(--bs-tertiary-bg); }
.editor-toolbar button { color: var(--bs-body-color) !important; }
.editor-toolbar button:hover, .editor-toolbar button.active { background: var(--bs-secondary-bg) !important; }

/* ── Impressão — oculta tudo exceto o documento da fatura ────────────────── */
@media print {
  /* Fundo branco e cor preta */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Oculta toda a estrutura de navegação do Vuexy */
  #layout-navbar,
  #layout-menu,
  .layout-navbar,
  .layout-menu,
  .layout-overlay,
  .layout-menu-toggle,
  .menu-toggle,
  .content-backdrop,
  .alert,
  button,
  .btn-toolbar,
  .flash-messages {
    display: none !important;
  }

  /* Oculta sidebar de ações/comentários da fatura */
  .invoice-actions { display: none !important; }

  /* Oculta breadcrumb e cabeçalho da página */
  .py-3.mb-4 { display: none !important; }

  /* Remove margens do layout geradas pelo sidebar fixo */
  .layout-wrapper,
  .layout-container,
  .layout-page,
  .content-wrapper,
  .container-xxl,
  .container-p-y {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-left: 0 !important;
  }

  /* Expande linha da fatura e coluna do documento para largura total */
  .row.invoice-preview {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .row.invoice-preview > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Remove sombra e bordas do card */
  .invoice-preview-card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  /* Evita quebra de página dentro de linhas da tabela */
  .table tr { page-break-inside: avoid; }
  thead     { display: table-header-group; }
  tfoot     { display: table-footer-group; }
}
