﻿/* ================================================================
   Webpart: Timeline Home  (ax-tl-home)

   Segue o padrão visual das demais webparts da home (Avisos): itens em
   blocos arredondados sobre --bs-tertiary-bg, botões btn-light/btn-custom
   e cor de destaque sempre vinda do tema (--btn-padrao-bg).

   Escala tipográfica (body = 14px):
     --tl-fs-texto  1rem      14px  texto do post, nome do autor
     --tl-fs-ui     .9286rem  13px  botões, texto do modo compacto
     --tl-fs-meta   .8571rem  12px  data, canal, legendas (mínimo)
   ================================================================ */

.ax-tl-home-wrapper {
    --tl-fs-texto: 1rem;
    --tl-fs-ui: .9286rem;
    --tl-fs-meta: .8571rem;
    --tl-gutter: 1rem;
    --tl-gap: .75rem;
    --tl-item-bg: var(--bs-tertiary-bg, #f8f9fa);
    --tl-item-bg-hover: var(--bs-secondary-bg, #e9ecef);
    --tl-radius: var(--bs-border-radius, .6rem);
    --tl-destaque: var(--btn-padrao-bg, #6c757d);

    position: relative; /* necessario para o overlay de zoom (position:absolute inset:0) */
    background: var(--bs-body-bg, #fff);
    border-radius: var(--bs-border-radius-lg, .5rem);
    overflow: hidden;
    font-size: var(--tl-fs-texto);
    color: var(--bs-body-color);
}

/* Webpart em coluna estreita: classe aplicada pelo componente (ResizeObserver),
   pela largura da própria webpart e não da viewport. */
.ax-tl-home-wrapper.ax-tl-estreito {
    --tl-gutter: .75rem;
    --tl-gap: .625rem;
}

/* ── Cabeçalho ─────────────────────────────────────────────────── */
.ax-tl-home-header {
    display: flex; align-items: center; gap: .5rem;
    min-height: 2.75rem;
    padding: .625rem var(--tl-gutter) 0;
}
/* Sem a moldura (EscondeTitulo), a engrenagem do layout flutua no canto superior direito */
.ax-tl-home-header.sem-moldura { padding-right: 2.75rem; }
.ax-tl-home-header.detalhe {
    padding-bottom: .625rem;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,.07));
}
.ax-tl-home-titulo { min-width: 0; }

.ax-tl-header-btn,
.ax-tl-header-link {
    display: inline-flex; align-items: center; gap: .3rem;
    background: none; border: 0;
    padding: .3rem .5rem; margin: 0 -.5rem;
    border-radius: var(--tl-radius);
    color: var(--bs-secondary-color, #6c757d);
    font-size: var(--tl-fs-ui); font-weight: 500;
    text-decoration: none; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.ax-tl-header-btn .mdi,
.ax-tl-header-link .mdi { font-size: 1.1em; }
.ax-tl-header-btn:hover,
.ax-tl-header-link:hover {
    background: var(--tl-item-bg);
    color: var(--bs-emphasis-color, #000);
}
.ax-tl-estreito .ax-tl-header-link-texto { display: none; }

/* ── Filtro e lista ────────────────────────────────────────────── */
.ax-tl-filtro {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem var(--tl-gutter) 0;
}
.ax-tl-filtro .form-select { flex: 1 1 auto; min-width: 0; }
/* Link encostado na margem: compensa o padding interno do botão */
.ax-tl-filtro .ax-tl-header-link { margin-right: -.5rem; }

.ax-tl-lista {
    display: flex; flex-direction: column; gap: var(--tl-gap);
    padding: .75rem var(--tl-gutter) var(--tl-gutter);
}
.ax-tl-lista-mais { display: flex; justify-content: center; padding-top: .25rem; }
.ax-tl-lista-mais .btn { font-size: var(--tl-fs-ui); padding-inline: 1.25rem; }

/* ── Post (modo padrão) ────────────────────────────────────────── */
.ax-tl-post {
    background: var(--tl-item-bg);
    border-radius: var(--tl-radius);
    overflow: hidden;
}
.ax-tl-post-corpo {
    display: flex; flex-direction: column; gap: .625rem;
    padding: .875rem 1rem;
}
.ax-tl-estreito .ax-tl-post-corpo { padding: .75rem; }

.ax-tl-post-autor { display: flex; align-items: center; gap: .625rem; min-width: 0; }
.ax-tl-autor-nome {
    font-size: var(--tl-fs-texto); font-weight: 600;
    line-height: 1.3; color: var(--bs-emphasis-color, #212529);
}

/* Linha de metadados: canal, data, destaque */
.ax-tl-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem;
    margin-top: .2rem;
    font-size: var(--tl-fs-meta); line-height: 1.35;
    color: var(--bs-secondary-color, #6c757d);
}
.ax-tl-canal {
    display: inline-flex; align-items: center; gap: .35rem;
    max-width: 100%;
    color: var(--bs-body-color, #212529); font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Ponto na cor do tema: identifica o canal sem depender do contraste da cor do cliente */
.ax-tl-canal::before {
    content: ''; flex-shrink: 0;
    width: .45rem; height: .45rem; border-radius: 50%;
    background: var(--tl-destaque);
}
.ax-tl-badge-fixado {
    display: inline-flex; align-items: center; gap: .2rem;
    padding: .05rem .45rem;
    border-radius: 999px;
    background: var(--bs-warning-bg-subtle, #fff3cd);
    color: var(--bs-warning-text-emphasis, #664d03);
    font-weight: 600;
}
.ax-tl-badge-fixado .mdi { font-size: .95em; }

/* Texto */
.ax-tl-post-texto {
    font-size: var(--tl-fs-texto); line-height: 1.55;
    white-space: pre-line; overflow-wrap: anywhere;
}
.ax-tl-ver-mais {
    background: none; border: 0; padding: 0; margin-left: .25rem;
    font: inherit; font-weight: 600;
    color: var(--bs-emphasis-color, #000);
    text-decoration: underline; text-underline-offset: .2em;
    vertical-align: baseline; cursor: pointer;
}
.ax-tl-ver-mais:hover { text-decoration-thickness: 2px; }

/* HTML rico (card): recortado com esmaecimento para o fundo do item */
.ax-tl-html {
    line-height: 1.55; max-height: 100px;
    overflow: hidden; position: relative;
}
.ax-tl-html::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 30px;
    background: linear-gradient(transparent, var(--tl-item-bg));
    pointer-events: none;
}
.ax-tl-html-completo { line-height: 1.55; overflow-wrap: anywhere; }

/* Imagens — celula base com aspect-ratio (adapta a qualquer largura de coluna) */
.ax-tl-img-grade { display: flex; gap: .5rem; }
.ax-tl-img-cell {
    display: block; flex: 1 1 0; min-width: 0;
    overflow: hidden; cursor: pointer;
    padding: 0; border: 0;
    background: var(--bs-secondary-bg, #e9ecef);
    border-radius: calc(var(--tl-radius) * .75);
    aspect-ratio: 4 / 3;
    min-height: 80px;
}
.ax-tl-img-cell img {
    display: block; width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}
.ax-tl-img-cell:hover img { transform: scale(1.03); }

/* Terceira imagem com overlay "+N" */
.ax-tl-img-plus { position: relative; }
.ax-tl-img-plus-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.45);
    color: #fff; font-size: 1.5rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* Video: thumbnail YouTube com botao play */
.ax-tl-video-thumb {
    position: relative; display: block; width: 100%;
    padding: 0; border: 0; cursor: pointer;
    border-radius: calc(var(--tl-radius) * .75); overflow: hidden;
    background: #000;
}
.ax-tl-video-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ax-tl-play-btn {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem; color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.6);
    pointer-events: none;
}
.ax-tl-video-arquivo {
    display: block; width: 100%; max-height: 220px;
    border-radius: calc(var(--tl-radius) * .75); background: #000;
}
.ax-tl-audio { display: block; width: 100%; height: 40px; }

/* Video iframe 16:9 */
.ax-tl-video-wrap {
    position: relative; aspect-ratio: 16 / 9;
    overflow: hidden; border-radius: calc(var(--tl-radius) * .75);
    background: #000;
}
.ax-tl-video-frame {
    position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}

/* Documentos */
.ax-tl-docs { display: flex; flex-direction: column; gap: .5rem; }
.ax-tl-doc {
    display: flex; align-items: center; gap: .625rem;
    padding: .5rem .75rem;
    border: 1px solid var(--bs-border-color, #ededed);
    border-radius: calc(var(--tl-radius) * .75);
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}
.ax-tl-doc:hover {
    border-color: var(--tl-destaque);
    color: var(--bs-body-color, #212529);
}
.ax-tl-doc-icon { display: flex; align-items: center; font-size: 1.5rem; color: var(--tl-destaque); }
.ax-tl-doc-nome {
    flex: 1 1 auto; min-width: 0;
    font-size: var(--tl-fs-ui); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ax-tl-doc-baixar {
    display: flex; align-items: center; gap: .2rem;
    font-size: var(--tl-fs-meta); font-weight: 500;
    color: var(--bs-secondary-color, #6c757d); white-space: nowrap;
}
.ax-tl-estreito .ax-tl-doc-baixar span { display: none; }

/* ── Rodapé social ─────────────────────────────────────────────── */
.ax-tl-rodape {
    display: flex; align-items: flex-start; gap: .5rem;
    padding: .25rem .5rem;
    border-top: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,.07));
}
.ax-tl-social-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    background: none; border: none;
    padding: .35rem .5rem;
    border-radius: var(--bs-border-radius, .375rem);
    color: var(--bs-secondary-color, #6c757d);
    font-size: var(--tl-fs-ui); font-weight: 500; cursor: pointer;
    transition: background-color .15s ease, color .15s ease; white-space: nowrap;
}
.ax-tl-social-btn:hover {
    background: var(--tl-item-bg-hover);
    color: var(--bs-body-color, #212529);
}
.ax-tl-social-btn:disabled { opacity: .6; cursor: default; }
/* No rodapé do post e do detalhe, os botões da webpart ficam com a mesma altura dos botões
   do AxVueSocial (min-height 27.45px em social.css) e o rodapé alinha tudo no topo: assim
   Curtir/Comentar não mudam de posição quando os comentários expandem. */
.ax-tl-rodape .ax-tl-social-btn {
    min-height: 27.45px;
    padding-top: .15rem;
    padding-bottom: .15rem;
}
.ax-tl-social-btn .mdi { font-size: 1.05rem; }
.ax-tl-favoritar.ativo,
.ax-tl-favoritar.ativo:hover { color: var(--bs-warning-text-emphasis, #997404); }
.ax-tl-favoritar.ativo .mdi { color: var(--bs-warning, #ffc107); }
.ax-tl-estreito .ax-tl-social-btn-texto { display: none; }

/* ── Avatar ────────────────────────────────────────────────────── */
.ax-tl-avatar { width: 40px; height: 40px; flex-shrink: 0; }
.ax-tl-avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.ax-tl-avatar-placeholder {
    width: 100%; height: 100%; border-radius: 50%;
    background: var(--bs-secondary-bg, #e9ecef);
    color: var(--bs-secondary-color, #6c757d);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
}
.ax-tl-estreito .ax-tl-avatar { width: 34px; height: 34px; }

/* ── Modo compacto — lista de itens clicáveis ──────────────────── */
.ax-tl-compacto {
    display: flex; align-items: center; gap: .75rem;
    padding: .625rem .875rem;
    background: var(--tl-item-bg);
    border-radius: var(--tl-radius);
    cursor: pointer;
    transition: background-color .15s ease;
}
.ax-tl-compacto:hover { background: var(--tl-item-bg-hover); }
.ax-tl-compacto .ax-tl-meta { margin: 0 0 .2rem; }
.ax-tl-compacto .ax-tl-autor-nome { font-size: var(--tl-fs-meta); }
.ax-tl-compacto-texto {
    font-size: var(--tl-fs-ui); line-height: 1.45;
    overflow-wrap: anywhere;
}
.ax-tl-compacto-tipo { color: var(--bs-secondary-color, #6c757d); font-style: italic; }
.ax-tl-compacto-midia {
    display: flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; flex-shrink: 0;
    border-radius: 50%;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-secondary-color, #6c757d);
    font-size: 1.05rem;
}

/* ── Estados: vazio e erro ─────────────────────────────────────── */
.ax-tl-estado {
    display: flex; flex-direction: column; align-items: center; gap: .375rem;
    padding: 2rem var(--tl-gutter);
    text-align: center;
}
.ax-tl-estado > .mdi { font-size: 2rem; line-height: 1; color: var(--bs-secondary-color, #6c757d); opacity: .6; }
.ax-tl-estado > .mdi.text-danger { opacity: 1; }
.ax-tl-estado-titulo { margin: .25rem 0 0; font-weight: 600; color: var(--bs-emphasis-color, #212529); }
.ax-tl-estado-texto {
    margin: 0; max-width: 32ch;
    font-size: var(--tl-fs-ui); color: var(--bs-secondary-color, #6c757d);
}
.ax-tl-estado .btn { margin-top: .5rem; font-size: var(--tl-fs-ui); }

/* ── Skeleton (escopo da webpart: este CSS é carregado em toda página do IntranetNL.Master) */
.ax-tl-home-wrapper .sk-item {
    display: flex; flex-direction: column; gap: .5rem;
    padding: .875rem 1rem;
    background: var(--tl-item-bg); border-radius: var(--tl-radius);
}
.ax-tl-home-wrapper .sk-item.compacto { padding: .75rem .875rem; gap: .4rem; }
.ax-tl-home-wrapper .sk-circle {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--tl-item-bg-hover); flex-shrink: 0;
    animation: ax-pulse 1.4s ease-in-out infinite;
}
.ax-tl-home-wrapper .sk-line {
    height: 10px; border-radius: 4px;
    background: var(--tl-item-bg-hover);
    animation: ax-pulse 1.4s ease-in-out infinite;
}
.ax-tl-home-wrapper .sk-line.w-20 { width: 20%; }
.ax-tl-home-wrapper .sk-line.w-40 { width: 40%; }
.ax-tl-home-wrapper .sk-line.w-70 { width: 70%; }
@keyframes ax-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ================================================================
   DETALHE INLINE — exibe o post completo dentro da propria webpart.
   Sem dialog, sem position:fixed, sem z-index.
   O wrapper usa overflow:hidden, entao o detalhe rola junto com a
   pagina — sem conflito com o layout WebForms.
   ================================================================ */
.ax-tl-detalhe { overflow-y: auto; }
.ax-tl-detalhe .ax-tl-post-corpo { padding: 1rem var(--tl-gutter); gap: .75rem; }
.ax-tl-detalhe .ax-tl-rodape {
    padding-inline: calc(var(--tl-gutter) - .5rem);
    border-top-color: var(--bs-border-color-translucent, rgba(0,0,0,.07));
}
.ax-tl-detalhe-voltar {
    display: flex; justify-content: center;
    padding: .75rem var(--tl-gutter) var(--tl-gutter);
}
.ax-tl-detalhe-voltar .btn { font-size: var(--tl-fs-ui); padding-inline: 1.25rem; }
.ax-tl-legenda {
    display: flex; align-items: center; gap: .3rem;
    margin: .375rem 0 0;
    font-size: var(--tl-fs-meta); color: var(--bs-secondary-color, #6c757d);
}

/* Imagem principal no detalhe — clicavel abre zoom full-viewport */
.ax-tl-detalhe-main {
    position: relative; display: block; width: 100%;
    overflow: hidden; cursor: zoom-in;
    padding: 0; border: 0;
    border-radius: calc(var(--tl-radius) * .75);
    background: var(--tl-item-bg);
    aspect-ratio: 16 / 9;
}
.ax-tl-estreito .ax-tl-detalhe-main { aspect-ratio: 4 / 3; }
.ax-tl-detalhe-main-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ax-tl-detalhe-main-zoom {
    position: absolute; bottom: .5rem; right: .5rem;
    background: rgba(0,0,0,.55); color: #fff;
    font-size: 1.1rem; width: 2rem; height: 2rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s ease;
    pointer-events: none;
}
.ax-tl-detalhe-main:hover .ax-tl-detalhe-main-zoom,
.ax-tl-detalhe-main:focus-visible .ax-tl-detalhe-main-zoom { opacity: 1; }

/* Tira de miniaturas abaixo da imagem principal */
.ax-tl-detalhe-strip { display: flex; gap: .375rem; flex-wrap: wrap; margin-top: .5rem; }
.ax-tl-detalhe-strip-btn {
    width: 64px; height: 48px; overflow: hidden; cursor: pointer; flex-shrink: 0;
    padding: 0; border: 2px solid transparent;
    border-radius: calc(var(--tl-radius) * .5);
    background: none; transition: border-color .15s ease, opacity .15s ease;
    opacity: .7;
}
.ax-tl-detalhe-strip-btn:hover { opacity: 1; }
.ax-tl-detalhe-strip-btn.ativo { border-color: var(--tl-destaque); opacity: 1; }
.ax-tl-detalhe-strip-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ax-tl-estreito .ax-tl-detalhe-strip-btn { width: 48px; height: 36px; }

/* ================================================================
   OVERLAY DE ZOOM — cobre toda a viewport (position:fixed).
   Nao causa PostBack: e apenas uma <div>, nao um <dialog>.
   Os botoes todos tem type="button" portanto nao submetem o form.
   ================================================================ */
.ax-tl-zoom-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.92);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.ax-tl-zoom-img-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    width: 100%; overflow: hidden; padding: 3.5rem 3.5rem .5rem;
}
.ax-tl-zoom-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.ax-tl-zoom-btn {
    position: absolute; background: rgba(255,255,255,.15); color: #fff; border: none;
    border-radius: 50%; width: 2.5rem; height: 2.5rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.25rem; transition: background-color .15s ease;
}
.ax-tl-zoom-btn:hover { background: rgba(255,255,255,.3); }
.ax-tl-zoom-close { top: .75rem; right: .75rem; }
.ax-tl-zoom-prev  { left: .75rem; top: 50%; transform: translateY(-50%); }
.ax-tl-zoom-next  { right: .75rem; top: 50%; transform: translateY(-50%); }
.ax-tl-zoom-counter {
    position: absolute; top: 1.25rem; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.5); color: #fff;
    font-size: var(--tl-fs-meta); font-variant-numeric: tabular-nums;
    padding: .15rem .6rem; border-radius: 999px;
    pointer-events: none;
}
.ax-tl-zoom-thumbs {
    display: flex; gap: .375rem; padding: .75rem; flex-wrap: wrap; justify-content: center;
    max-height: 90px; overflow-y: auto;
}
.ax-tl-zoom-thumb {
    width: 56px; height: 42px; overflow: hidden; cursor: pointer; flex-shrink: 0;
    padding: 0; border-radius: 4px; border: 2px solid transparent;
    background: none; opacity: .6; transition: border-color .15s ease, opacity .15s ease;
}
.ax-tl-zoom-thumb:hover { opacity: 1; }
.ax-tl-zoom-thumb.ativo { border-color: #fff; opacity: 1; }
.ax-tl-zoom-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 575.98px) {
    .ax-tl-zoom-img-wrap { padding: 3.5rem .5rem .5rem; }
    .ax-tl-zoom-thumb    { width: 44px; height: 33px; }
}

/* ================================================================
   MENCOES (@usuario) — mesmo visual da Timeline completa.
   O botao .mention nao tem type="submit" (tem type="button" no template).
   ================================================================ */
.ax-tl-home-wrapper .mention {
    font-weight: 600;
    cursor: pointer;
    background-color: #cacaca;
    border-radius: 4px;
    padding: 0 4px;
    border: none;
    font-size: inherit;
    line-height: inherit;
    vertical-align: baseline;
    display: inline;
    color: inherit;
}
.ax-tl-home-wrapper .mention:hover { background-color: #b5b5b5; }

/* Card de perfil do usuario mencionado — position:fixed: escapa do overflow:hidden */
.ax-tl-mention-card {
    position: fixed;
    z-index: 10000;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #ededed);
    border-radius: var(--bs-border-radius-lg, .5rem);
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    width: 280px;
    max-width: calc(100vw - 16px);
    overflow: hidden;
}
.ax-tl-mention-card-corpo { display: flex; align-items: center; gap: .75rem; padding: 1rem 2.25rem .75rem 1rem; }
.ax-tl-mention-card-corpo .ax-tl-avatar { width: 48px; height: 48px; }
.ax-tl-mention-card .ax-tl-meta { display: block; margin-top: .15rem; }
.ax-tl-mention-card-acoes { padding: 0 1rem 1rem; }
.ax-tl-mention-card-acoes .btn { font-size: var(--tl-fs-ui); }
.ax-tl-mention-card-close {
    position: absolute; top: .5rem; right: .5rem;
    display: flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem;
    background: none; border: none; cursor: pointer;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 1rem; padding: 0;
    border-radius: 50%;
}
.ax-tl-mention-card-close:hover { background: var(--bs-secondary-bg, #e9ecef); }

/* ── Foco visível nos controles próprios da webpart ────────────── */
.ax-tl-home-wrapper :is(.ax-tl-social-btn, .ax-tl-header-btn, .ax-tl-header-link, .ax-tl-ver-mais,
    .ax-tl-img-cell, .ax-tl-video-thumb, .ax-tl-doc, .ax-tl-compacto, .ax-tl-detalhe-main,
    .ax-tl-detalhe-strip-btn):focus-visible,
.ax-tl-zoom-overlay button:focus-visible,
.ax-tl-mention-card-close:focus-visible {
    outline: 2px solid var(--tl-destaque, #6c757d);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .ax-tl-home-wrapper .sk-circle,
    .ax-tl-home-wrapper .sk-line { animation: none; }
    .ax-tl-img-cell img { transition: none; }
    .ax-tl-img-cell:hover img { transform: none; }
}
