/* resources/css/components/tickets.css */

.tickets-layout {
    display: flex;
    height: calc(100vh - 120px);
    min-height: 500px;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    background: var(--bs-body-bg, #fff);
}

/* ---- Sidebar (lista de tickets) ---- */
.tickets-sidebar {
    width: 420px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-body-bg, #fff);
}

.tickets-sidebar-header {
    padding: 16px 14px 10px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.tickets-search-wrapper {
    position: relative;
}
.tickets-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 1rem;
}
.tickets-search-input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 20px;
    font-size: 0.85rem;
    background: var(--bs-secondary-bg, #f8f9fa);
    outline: none;
    transition: border-color 0.2s;
}
.tickets-search-input:focus {
    border-color: #0d6efd;
    background: var(--bs-body-bg, #fff);
}

.tickets-filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.tickets-filter-tab {
    border: none;
    background: var(--bs-secondary-bg, #f0f0f0);
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 0.77rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--bs-secondary-color, #6c757d);
    transition: background 0.15s, color 0.15s;
}
.tickets-filter-tab.active,
.tickets-filter-tab:hover {
    background: #1a1a2e;
    color: #fff;
}

.tickets-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

/* ---- Ticket Card ---- */
.ticket-card {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    transition: background 0.15s;
    gap: 8px;
}
.ticket-card:hover {
    background: var(--bs-secondary-bg, #f8f9fa);
}
.ticket-card.active {
    background: #e8f0fe;
    border-left: 3px solid #0d6efd;
}
.ticket-card-inner {
    flex: 1;
    min-width: 0;
}
.ticket-card-header {
    display: flex;
    align-items: center;
}
.ticket-card-title {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ticket-card-meta {
    font-size: 0.78rem;
}
.ticket-card-footer {
    display: flex;
    align-items: center;
}
.ticket-card-arrow {
    color: #ccc;
    font-size: 1rem;
}

/* ---- Painel principal ---- */
.tickets-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bs-body-bg, #fff);
}

/* Estado vazio */
.tickets-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #aaa;
    text-align: center;
    padding: 40px;
}
.tickets-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Detalhe */
.tickets-detail {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tickets-detail-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

/* Chat area */
.tickets-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Mensagem de chat */
.chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.chat-message.mine {
    flex-direction: row-reverse;
}
.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #5c6bc0;
    flex-shrink: 0;
}
.chat-message.mine .chat-message-avatar {
    background: #d4edda;
    color: #28a745;
}
.chat-message-content {
    max-width: 75%;
}
.chat-message-header {
    margin-bottom: 3px;
    font-size: 0.8rem;
}
.chat-message.mine .chat-message-header {
    text-align: right;
}
.chat-message-bubble {
    background: var(--bs-secondary-bg, #f1f3f4);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.88rem;
    line-height: 1.5;
}
.chat-message.mine .chat-message-bubble {
    background: #d6f0d6;
}
.chat-attachment-link {
    display: block;
    margin-top: 4px;
    color: #0d6efd;
    text-decoration: none;
}

/* Área de resposta */
.tickets-reply-area {
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    padding: 12px 16px;
}
.tickets-reply-wrapper {
    background: var(--bs-secondary-bg, #f8f9fa);
    border-radius: 12px;
    padding: 8px 12px;
}
.tickets-reply-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    max-height: 120px;
    overflow-y: auto;
}
.tickets-attach-btn {
    cursor: pointer;
    color: #888;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s;
}
.tickets-attach-btn:hover {
    color: #0d6efd;
}
.tickets-send-btn {
    border: none;
    background: #1a7a4e;
    color: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.tickets-send-btn:hover {
    background: #156040;
}
.tickets-attachment-preview {
    font-size: 0.82rem;
    color: #555;
    background: #e8f4ff;
    border-radius: 6px;
    padding: 4px 10px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

/* Responsividade */
@media (max-width: 768px) {
    .tickets-layout {
        flex-direction: column;
        height: auto;
    }
    .tickets-sidebar {
        width: 100%;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    }
    .tickets-main {
        min-height: 50vh;
    }
}
