/* Chat de tickets — admin / suporte / financeiro */

.ticket-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.ticket-chat-item {
    display: flex;
    max-width: 82%;
}

.ticket-chat-item--end {
    align-self: flex-end;
}

.ticket-chat-item--start {
    align-self: flex-start;
}

.ticket-chat-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    max-width: 100%;
}

.ticket-chat-row__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    align-self: flex-start;
    object-fit: cover;
    border: 2px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.ticket-modal__chat .ticket-chat-row__avatar {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ticket-chat-bubble {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.9375rem;
    line-height: 1.45;
}

.ticket-chat-bubble--client {
    background: #6877c6;
    border: 1px solid #5352ed;
    color: #f9f5f5;
}

.ticket-chat-bubble--staff {
    background: #272935;
    border: 1px solid #5352ed;
    color: #eef1f7;
}

.ticket-chat-bubble__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ticket-chat-bubble__author {
    font-weight: 700;
    font-size: 0.8125rem;
}

.ticket-chat-bubble__time {
    opacity: 0.85;
    white-space: nowrap;
}

.ticket-chat-bubble__body {
    padding: 0.65rem 0.7rem;
}

.ticket-chat-bubble__body p:last-child {
    margin-bottom: 0;
}

.ticket-attach-card--in-bubble {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.45rem;
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.12);
    box-shadow: none;
}

.ticket-chat-bubble--client .ticket-attach-card--in-bubble {
    background: rgba(0, 0, 0, 0.1);
}

.ticket-attach-card--in-bubble .ticket-img-card__frame {
    background: rgba(255, 255, 255, 0.95);
}

.ticket-attach-card {    display: inline-block;
    vertical-align: top;
    margin-top: 0.15rem;
    padding: 0.45rem;
    border-radius: 12px;
    background: #f1f3f8;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    max-width: 100%;
}

.ticket-attach-card--staff {
    background: rgba(83, 82, 237, 0.1);
    border-color: rgba(83, 82, 237, 0.28);
}

.ticket-attach-card--client {
    background: #eef1f7;
    border-color: rgba(0, 0, 0, 0.08);
}

.ticket-attach-card__grid {
    display: grid;
    gap: 0.4rem;
}

.ticket-attach-card__grid--count-1 {
    grid-template-columns: 220px;
}

.ticket-attach-card__grid--count-2 {
    grid-template-columns: repeat(2, 170px);
}

.ticket-attach-card__grid--count-3,
.ticket-attach-card__grid--count-4 {
    grid-template-columns: repeat(2, 148px);
}

.ticket-img-card {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    border-radius: 10px;
    line-height: 0;
    transition: transform 0.2s ease;
}

.ticket-img-card:hover {
    transform: translateY(-2px);
}

.ticket-img-card__frame {
    display: block;
    padding: 3px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ticket-img-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: cover;
    border-radius: 7px;
}

.ticket-img-card__zoom {
    position: absolute;
    right: 0.45rem;
    bottom: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 8px;
    background: rgba(20, 24, 36, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.95rem;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.ticket-img-card:hover .ticket-img-card__zoom {
    opacity: 1;
    transform: scale(1);
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.chat-form textarea {
    width: 100%;
    min-height: 88px;
    background: #f8f9fc;
    color: #212529;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 0.75rem 0.85rem;
    opacity: 1;
    border-radius: 10px;
    resize: vertical;
}

.chat-form textarea:focus {
    outline: none;
    border-color: rgba(83, 82, 237, 0.45);
    box-shadow: 0 0 0 3px rgba(83, 82, 237, 0.12);
}

.chat-form__toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chat-form__attach {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(83, 82, 237, 0.25);
    background: rgba(83, 82, 237, 0.08);
    color: #5352ed;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.chat-form__attach input[type="file"] {
    display: none;
}

.chat-form__attach-preview {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-form__submit {
    margin-left: auto;
    padding: 0.55rem 1.15rem;
    border: none;
    border-radius: 8px;
    background: #5352ed;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.chat-form__submit:hover {
    background: #4544d4;
}

.chat-form__hint {
    margin: 0;
    font-size: 0.75rem;
    color: #8b98ad;
}

body.ticket-lightbox-open {
    overflow: hidden;
}

.ticket-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

.ticket-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ticket-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 14, 0.9);
    backdrop-filter: blur(6px);
}

.ticket-lightbox__panel {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(92vw, 980px);
    max-height: 90vh;
    transform: scale(0.94) translateY(10px);
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease;
}

.ticket-lightbox.is-open .ticket-lightbox__panel {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.ticket-lightbox__figure {
    margin: 0;
    max-width: 100%;
    text-align: center;
}

.ticket-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 5rem);
    margin: 0 auto;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    transition: opacity 0.25s ease;
}

.ticket-lightbox__img.is-changing {
    opacity: 0.35;
}

.ticket-lightbox__caption {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: #d1d5db;
}

.ticket-lightbox__counter {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #9aa6ba;
}

.ticket-lightbox__close {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}

.ticket-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.75rem;
    cursor: pointer;
}

.ticket-lightbox__nav--prev {
    left: -3.25rem;
}

.ticket-lightbox__nav--next {
    right: -3.25rem;
}

@media (max-width: 767.98px) {
    .ticket-attach-card__grid--count-1 {
        grid-template-columns: minmax(0, 1fr);
    }

    .ticket-attach-card__grid--count-2,
    .ticket-attach-card__grid--count-3,
    .ticket-attach-card__grid--count-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ticket-attach-card {
        display: block;
        width: 100%;
    }

    .ticket-lightbox__nav--prev {
        left: 0.25rem;
    }

    .ticket-lightbox__nav--next {
        right: 0.25rem;
    }
}
