/* Anexos de chamados SAC — preview, lightbox imagem, modal vídeo e PDF */
.ch-anexos {
    margin-top: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ch-anexo--img {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-width: 220px;
}

.ch-anexo-img-btn {
    display: block;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    cursor: zoom-in;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ch-anexo-img-btn:hover {
    border-color: #0068ff;
    box-shadow: 0 4px 16px rgba(0, 104, 255, 0.18);
}

.ch-anexo-img-thumb {
    display: block;
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    vertical-align: middle;
}

.ch-anexo-caption {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.3;
    word-break: break-word;
}

.ch-anexo--video {
    max-width: 220px;
}

.ch-anexo-video-btn {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.ch-anexo-video-preview {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ch-anexo-video-btn:hover .ch-anexo-video-preview {
    border-color: #0068ff;
    box-shadow: 0 4px 16px rgba(0, 104, 255, 0.18);
}

.ch-anexo-video-thumb {
    display: block;
    width: 100%;
    max-height: 140px;
    min-height: 88px;
    object-fit: cover;
    background: #0f172a;
    pointer-events: none;
}

.ch-anexo-video-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 104, 255, 0.92);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
    pointer-events: none;
}

.ch-anexo-video-play i {
    margin-left: 2px;
}

.ch-anexo--pdf {
    max-width: 220px;
}

.ch-anexo-pdf-btn {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.ch-anexo-pdf-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 88px;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: linear-gradient(180deg, #fef2f2 0%, #fff 100%);
    color: #b91c1c;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ch-anexo-pdf-preview i {
    font-size: 1.75rem;
}

.ch-anexo-pdf-preview span {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ch-anexo-pdf-btn:hover .ch-anexo-pdf-preview {
    border-color: #ef4444;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
}

.ch-anexo--file {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.35rem 0.55rem 0.35rem 0.45rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(0, 104, 255, 0.22);
    background: rgba(0, 104, 255, 0.06);
    color: #1d4ed8;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ch-anexo--file:hover {
    background: rgba(0, 104, 255, 0.11);
    border-color: rgba(0, 104, 255, 0.35);
}

.ch-anexo-file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ch-anexo-file-dl {
    margin-left: auto;
    opacity: 0.65;
    font-size: 0.72rem;
}

/* Tema claro (mensagens enviadas pelo usuário) */
.ch-anexos--light .ch-anexo-caption {
    color: rgba(255, 255, 255, 0.85);
}

.ch-anexos--light .ch-anexo--file {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.ch-anexos--light .ch-anexo--file:hover {
    background: rgba(255, 255, 255, 0.22);
}

.ch-anexos--light .ch-anexo-img-btn {
    border-color: rgba(255, 255, 255, 0.35);
}

.ch-anexos--light .ch-anexo-video-preview {
    border-color: rgba(255, 255, 255, 0.35);
}

/* Lightbox imagem */
.ch-anexo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.88);
}

.ch-anexo-lightbox[hidden] {
    display: none !important;
}

.ch-anexo-lightbox__img {
    max-width: min(96vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.ch-anexo-lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ch-anexo-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Modal PDF */
.ch-anexo-pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 100060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ch-anexo-pdf-modal[hidden] {
    display: none !important;
}

.ch-anexo-pdf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
}

.ch-anexo-pdf-modal__box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(960px, 100%);
    max-height: min(92vh, 900px);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.ch-anexo-pdf-modal__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.ch-anexo-pdf-modal__title {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ch-anexo-pdf-modal__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ch-anexo-pdf-modal__download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    background: #0068ff;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease;
}

.ch-anexo-pdf-modal__download:hover {
    background: #0050cc;
    color: #fff;
}

.ch-anexo-pdf-modal__close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #e5e7eb;
    color: #334155;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ch-anexo-pdf-modal__close:hover {
    background: #cbd5e1;
}

.ch-anexo-pdf-modal__frame {
    flex: 1;
    width: 100%;
    min-height: 420px;
    border: none;
    background: #525659;
}

/* Modal vídeo */
.ch-anexo-video-modal {
    position: fixed;
    inset: 0;
    z-index: 100060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ch-anexo-video-modal[hidden] {
    display: none !important;
}

.ch-anexo-video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
}

.ch-anexo-video-modal__box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(960px, 100%);
    max-height: min(92vh, 900px);
    background: #0f172a;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.ch-anexo-video-modal__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: #1e293b;
}

.ch-anexo-video-modal__title {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #f8fafc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ch-anexo-video-modal__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ch-anexo-video-modal__download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    background: #0068ff;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease;
}

.ch-anexo-video-modal__download:hover {
    background: #0050cc;
    color: #fff;
}

.ch-anexo-video-modal__close {
    position: relative;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ch-anexo-video-modal__close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.ch-anexo-video-modal__body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #000;
    min-height: 280px;
}

.ch-anexo-video-modal__player {
    width: 100%;
    max-height: min(78vh, 760px);
    background: #000;
    border-radius: 8px;
    outline: none;
}

@media (max-width: 640px) {
    .ch-anexo--img,
    .ch-anexo--pdf,
    .ch-anexo--video {
        max-width: 100%;
    }

    .ch-anexo-pdf-modal__box,
    .ch-anexo-video-modal__box {
        max-height: 96vh;
    }

    .ch-anexo-pdf-modal__frame {
        min-height: 300px;
    }

    .ch-anexo-video-modal__body {
        min-height: 200px;
        padding: 8px;
    }
}
