/* Helpdesk drawer (banner): ticket list with views and search, docked preview with inline reply */

/* Shared heads of drawer and preview */
#notifications-floater > .content-wrapper { z-index: 1; }
#notifications-floater .content-wrapper .help-header,
#notifications-floater .helpdesk-preview-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-shrink: 0; height: 85px; padding: 0 20px;
    background: rgb(0 0 0 / 4%); border-bottom: 2px solid rgb(0 0 0 / 10%);
    line-height: 85px;
}
#notifications-floater .helpdesk-header { justify-content: flex-start; gap: 8px; }
#notifications-floater .helpdesk-header .icon.add { display: inline-flex; align-items: center; color: var(--color-success, #16a34a); font-size: 20px; line-height: 1; }

/* Views and search */
.helpdesk-toolbar { flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 20px 6px; }
.helpdesk-views { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: #f1f5f9; }
.helpdesk-views button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent;
    color: var(--av-color-text-muted); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.helpdesk-views button:hover { color: var(--av-color-text); }
.helpdesk-views button.active { background: #fff; color: var(--av-color-text); box-shadow: 0 1px 3px rgb(15 23 42 / 12%); }
.helpdesk-view-count { font-size: 11px; font-weight: 700; color: #94a3b8; font-variant-numeric: tabular-nums; }
.helpdesk-views button.active .helpdesk-view-count { color: var(--av-color-primary); }
.helpdesk-view-count.is-warning { color: #9a4a06; }
.helpdesk-search {
    display: flex; align-items: center; gap: 8px; height: 38px; margin: 0; padding: 0 12px;
    border: 1px solid var(--av-color-border); border-radius: 10px; background: #fff; color: var(--av-color-text-muted);
}
.helpdesk-search:focus-within { border-color: var(--av-color-primary); box-shadow: 0 0 0 3px rgb(47 107 255 / 15%); }
.helpdesk-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--av-color-text); font-size: 14px; }
.helpdesk-search input::placeholder { color: #94a3b8; }
.helpdesk-search kbd { padding: 1px 6px; border-radius: 5px; background: #f1f5f9; color: var(--av-color-text-muted); font-size: 11px; font-weight: 600; box-shadow: none; }

/* Ticket list */
.helpdesk-list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.helpdesk-list[aria-busy="true"] { opacity: .6; }
.helpdesk-list > .message { margin: 16px 20px 8px; }
.helpdesk-list > .btn { margin: 0 20px; }
.helpdesk-empty { margin: 0; padding: 28px 20px; color: var(--av-color-text-muted); text-align: center; }
.helpdesk-tickets { width: 100%; border-collapse: collapse; table-layout: fixed; }
.helpdesk-tickets td { padding: 9px 16px 9px 20px; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.helpdesk-tickets .helpdesk-col-side { width: 124px; }
.helpdesk-tickets td.helpdesk-ticket-side { padding-left: 0; text-align: right; }
.helpdesk-group th {
    padding: 14px 20px 6px; color: var(--av-color-text-muted); font-size: 11px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; text-align: left;
}
.helpdesk-group th span { margin-left: 6px; color: #94a3b8; letter-spacing: 0; }
.helpdesk-tickets tr[data-href] { cursor: pointer; }
.helpdesk-tickets tr[data-href]:hover, .helpdesk-tickets tr[data-href]:focus-within { background: #f8fafc; }
#notifications-floater tr.is-previewed { background: var(--av-blue-50); box-shadow: inset 3px 0 var(--av-color-primary); }
.helpdesk-ticket-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.helpdesk-ticket-text { flex: 1; min-width: 0; overflow: hidden; }
.helpdesk-ticket-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.helpdesk-ticket-title a {
    min-width: 0; overflow: hidden; color: var(--av-color-text); font-size: 14px; font-weight: 600;
    line-height: 19px; text-overflow: ellipsis; white-space: nowrap; text-decoration: none;
}
.helpdesk-ticket-title a:hover { color: var(--av-color-primary); }
.helpdesk-ticket-meta { overflow: hidden; color: var(--av-color-text-muted); font-size: 12.5px; line-height: 17px; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-ticket-meta strong { color: var(--av-color-text); font-weight: 500; }
.helpdesk-ticket-info { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.helpdesk-ticket-info time { color: var(--av-color-text-muted); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Row actions cover time and status on hover and keyboard focus without changing the row height */
.helpdesk-tickets td.helpdesk-ticket-side { position: relative; }
.helpdesk-ticket-actions {
    display: flex; visibility: hidden; justify-content: flex-end; gap: 2px;
    position: absolute; top: 50%; right: 16px; transform: translateY(-50%);
}
.helpdesk-ticket-actions .btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
    border: 1px solid var(--av-color-border); border-radius: 8px; background: #fff; color: var(--av-color-text-muted);
}
.helpdesk-ticket-actions .btn:hover, .helpdesk-ticket-actions .btn:focus-visible { border-color: #c9d8ff; background: var(--av-blue-50); color: var(--av-color-primary); }
.helpdesk-tickets tr:hover .helpdesk-ticket-actions, .helpdesk-tickets tr:focus-within .helpdesk-ticket-actions { visibility: visible; }
.helpdesk-tickets tr:hover .helpdesk-ticket-info, .helpdesk-tickets tr:focus-within .helpdesk-ticket-info { visibility: hidden; }
@media (hover: none) { .helpdesk-ticket-actions { display: none !important; } .helpdesk-ticket-info { visibility: visible !important; } }

/* Avatars, status and priority */
.helpdesk-avatar {
    display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px;
    border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1;
}
.helpdesk-avatar.tone-blue { background: #e3edfc; color: #174ea6; }
.helpdesk-avatar.tone-amber { background: #fff1d6; color: #8a4b05; }
.helpdesk-avatar.tone-green { background: #dff5e7; color: #166534; }
.helpdesk-avatar.tone-purple { background: #f3e8fd; color: #6b21a8; }
.helpdesk-avatar.tone-gray { background: #eef1f6; color: #3a4659; }
.helpdesk-status { display: inline-block; padding: 2px 7px; border-radius: 6px; background: #eef1f6; color: #3a4659; font-size: 11px; font-weight: 700; line-height: 14px; white-space: nowrap; }
.helpdesk-status.is-New { background: #e3edfc; color: #174ea6; }
.helpdesk-status.is-WaitingForYou { background: #fff1d6; color: #8a4b05; }
.helpdesk-priority { display: inline-grid; place-items: center; flex: 0 0 18px; width: 18px; height: 18px; border-radius: 5px; font-size: 10px; }
.helpdesk-priority.is-extremely-high { background: #b42318; color: #fff; }
.helpdesk-priority.is-high { background: #fff1d6; color: #8a4b05; box-shadow: inset 0 0 0 1px #f5d88f; }

/* Footer */
.helpdesk-footer {
    flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 20px 14px; border-top: 1px solid var(--av-color-border); font-size: 12.5px; color: var(--av-color-text-muted);
}
.helpdesk-footer a { font-size: 14px; font-weight: 600; text-decoration: none; }

/* Docked preview */
#notifications-floater .helpdesk-preview {
    z-index: 0; position: fixed; inset: 0 500px 0 auto; width: min(560px, calc(100vw - 500px));
    display: flex; flex-direction: column; background: var(--bs-body-bg, white);
    color: var(--av-color-text); border-right: 1px solid var(--av-color-border);
    box-shadow: -12px 0 30px rgb(0 0 0 / 12%);
}
.helpdesk-preview-heading { justify-content: flex-start !important; gap: 4px !important; }
.helpdesk-preview-heading .helpdesk-avatar { margin-right: 8px; }
.helpdesk-preview-heading h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-preview-who h2 { margin: 0; padding-left: 0; border-left: 0; font-size: 18px; font-weight: 700; line-height: 24px; }
.helpdesk-preview-heading h2 a { color: inherit; text-decoration: none; }
.helpdesk-preview-heading h2 a:hover { color: var(--av-color-primary); }
.helpdesk-preview-heading button { flex-shrink: 0; }
.helpdesk-preview-who { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.25; }
.helpdesk-preview-who small { overflow: hidden; color: var(--av-color-text-muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-preview-content { padding: 22px; overflow-y: auto; min-height: 0; }
.helpdesk-preview-content.is-ticket { flex: 1; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.helpdesk-preview-summary { flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px 22px 14px; border-bottom: 1px solid var(--av-color-border); }
.helpdesk-preview-title {
    margin: 0; font-size: 18px; font-weight: 700; line-height: 24px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.helpdesk-preview-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--av-color-text-muted); font-size: 12.5px; }
.helpdesk-preview-number { padding: 2px 7px; border-radius: 6px; background: #f1f5f9; font-weight: 600; }
.helpdesk-preview-time { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.helpdesk-preview-time .fa-clock { margin-right: 2px; }
.helpdesk-preview-time .icon.add { color: var(--color-success); font-size: 16px; line-height: 1; text-decoration: none; }
.helpdesk-preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.helpdesk-preview-open { margin-left: auto; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.helpdesk-preview-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px; background: #fafbfd; }
.helpdesk-preview-mail { padding: 14px 16px; border: 1px solid var(--av-color-border); border-radius: 14px; background: #fff; }
.helpdesk-preview-mail header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 10px; font-size: 13px; }
.helpdesk-preview-mail header small { color: var(--av-color-text-muted); }
.helpdesk-preview-mail header time { margin-left: auto; color: var(--av-color-text-muted); font-size: 12px; white-space: nowrap; }
.helpdesk-preview-message { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }

/* Inline reply */
.helpdesk-reply { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 22px 16px; border-top: 1px solid var(--av-color-border); background: #fff; }
.helpdesk-reply-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--av-color-text-muted); }
.helpdesk-reply-head label { margin: 0; color: var(--av-color-text); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.helpdesk-reply-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.helpdesk-reply textarea { resize: vertical; min-height: 76px; }
.helpdesk-reply-help { margin: 0; color: var(--av-color-text-muted); font-size: 12px; }
.helpdesk-reply-help kbd { padding: 0 5px; border: 1px solid var(--av-color-border); border-bottom-width: 2px; border-radius: 5px; background: #f8fafc; color: var(--av-color-text); font-size: 11px; font-weight: 600; box-shadow: none; }
.helpdesk-reply-row { display: flex; align-items: center; gap: 8px; }
.helpdesk-reply-row .form-select { flex: 1 1 0; width: auto; min-width: 0; max-width: 220px; }
.helpdesk-reply-row .btn { flex-shrink: 0; }
.helpdesk-reply-long { flex-shrink: 0; margin-left: auto; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* The existing modal must remain above both panels. */
#notifications-floater.helpdesk-modal-open { z-index: 1040; }
@media (max-width: 899px) { #notifications-floater .helpdesk-preview { display: none; } }
