/* Answyr Desk — admin styles. Tokens come from tokens.css. */

/* ── Inbox list ─────────────────────────────────────────────────────────── */
.answyr-desk-inbox .answyr-inbox-head {
	display: flex;
	align-items: baseline;
	gap: var(--answyr-gap-sm);
	margin-bottom: var(--answyr-gap-xs);
}

.answyr-desk-inbox .answyr-count {
	display: inline-block;
	min-width: 20px;
	padding: 0 7px;
	border-radius: 10px;
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-soft);
	font-size: 12px;
	font-weight: 600;
	line-height: 20px;
	text-align: center;
}

.answyr-desk-inbox table.widefat {
	border-radius: var(--answyr-radius-card);
	overflow: hidden;
	box-shadow: var(--answyr-shadow-card);
}

.answyr-desk-inbox td {
	vertical-align: middle;
}

/* Subtle row hover so the list feels interactive. */
.answyr-desk-inbox tbody tr {
	transition: background var(--answyr-transition);
}

.answyr-desk-inbox tbody tr:hover {
	background: var(--answyr-accent-soft);
}

.answyr-desk-inbox .answyr-subject {
	font-weight: 600;
}

.answyr-desk-inbox .answyr-customer {
	color: var(--answyr-ink-soft);
}

.answyr-desk-inbox .answyr-id {
	color: var(--answyr-ink-faint);
	font-variant-numeric: tabular-nums;
}

.answyr-desk-inbox .answyr-empty {
	padding: var(--answyr-gap-lg);
	text-align: center;
	color: var(--answyr-ink-faint);
}

.answyr-desk-inbox .answyr-empty:hover {
	background: transparent;
}

.answyr-desk-inbox .answyr-empty-icon {
	display: block;
	margin: 0 auto var(--answyr-gap-sm);
	width: 44px;
	height: 44px;
	color: var(--answyr-line);
}

.answyr-desk-inbox .answyr-empty-icon .dashicons {
	width: 44px;
	height: 44px;
	font-size: 44px;
}

/* Status pill */
.answyr-pill {
	display: inline-block;
	padding: 1px 9px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	text-transform: capitalize;
	line-height: 18px;
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-soft);
}

.answyr-pill-open {
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent-hover);
}

.answyr-pill-pending {
	background: #fcf3e6;
	color: var(--answyr-warning);
}

.answyr-pill-resolved {
	background: var(--answyr-success-soft);
	color: var(--answyr-success);
}

.answyr-pill-closed {
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-faint);
}

/* Derived "waiting on" indicator (detail bar) */
.answyr-pill-waiting-agent {
	background: #fcf3e6;
	color: var(--answyr-warning);
}

.answyr-pill-waiting-customer {
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent-hover);
}

/* Compact "waiting on" hint in the inbox list */
.answyr-wait {
	display: inline-block;
	margin-left: 6px;
	font-size: 11px;
	font-weight: 600;
	line-height: 18px;
}

.answyr-wait-agent {
	color: var(--answyr-warning);
}

.answyr-wait-customer {
	color: var(--answyr-ink-faint);
}

/* Priority pills */
.answyr-pri {
	display: inline-block;
	padding: 1px 9px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	line-height: 18px;
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-soft);
}

.answyr-pri-low {
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-faint);
}

.answyr-pri-normal {
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent-hover);
}

.answyr-pri-high {
	background: #fcf3e6;
	color: var(--answyr-warning);
}

.answyr-pri-urgent {
	background: #fcf0f1;
	color: var(--answyr-danger);
}

/* Tag chips */
.answyr-chip {
	display: inline-block;
	padding: 0 8px;
	border-radius: 10px;
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-soft);
	font-size: 11px;
	line-height: 18px;
	text-decoration: none;
}

.answyr-chip:hover {
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent-hover);
}

.answyr-row-tags {
	display: inline-flex;
	gap: var(--answyr-gap-xs);
	margin-left: var(--answyr-gap-sm);
	flex-wrap: wrap;
}

.answyr-tag-active {
	align-self: center;
	padding: 2px 10px;
	border-radius: 10px;
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent-hover);
	text-decoration: none;
	font-size: 12px;
}

/* Inbox filter bar */
.answyr-desk-inbox .answyr-inbox-filters {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap);
	flex-wrap: wrap;
	margin: var(--answyr-gap-sm) 0 var(--answyr-gap);
}

.answyr-desk-inbox .answyr-inbox-filters .search-box {
	display: inline-flex;
	gap: var(--answyr-gap-xs);
}

/* Ticket detail: tags row */
.answyr-desk .answyr-tags-control {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-sm);
	flex-wrap: wrap;
}

.answyr-desk .answyr-tags-control label {
	font-weight: 600;
	color: var(--answyr-ink-soft);
}

/* Compose tools row */
.answyr-desk .answyr-compose-tools {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-sm);
	flex-wrap: wrap;
}

/* Internal note bubble + box */
.answyr-desk .answyr-msg-note {
	flex-direction: row;
}

.answyr-desk .answyr-msg-note .answyr-avatar {
	background: var(--answyr-warning);
}

.answyr-desk .answyr-msg-note .answyr-bubble {
	background: #fffaf0;
	border-color: #f0e0bf;
	border-style: dashed;
}

.answyr-desk .answyr-note-box {
	box-shadow: var(--answyr-shadow);
	border-style: dashed;
}

/* ── Ticket detail ──────────────────────────────────────────────────────── */
.answyr-desk .answyr-back {
	display: inline-block;
	margin-bottom: var(--answyr-gap-sm);
	text-decoration: none;
}

.answyr-desk .answyr-ticket-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--answyr-gap);
}

.answyr-desk .answyr-ticket-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--answyr-gap-sm);
	color: var(--answyr-ink-soft);
}

.answyr-desk .answyr-status-control {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-sm);
}

.answyr-desk .answyr-status-control label {
	font-weight: 600;
	color: var(--answyr-ink-soft);
}

.answyr-desk .answyr-thread {
	max-width: 860px;
	margin: var(--answyr-gap-md) 0;
}

/* Message bubbles — customer left, agent right */
.answyr-desk .answyr-msg {
	display: flex;
	gap: var(--answyr-gap);
	margin-bottom: var(--answyr-gap-md);
}

.answyr-desk .answyr-msg-agent {
	flex-direction: row-reverse;
}

.answyr-desk .answyr-avatar {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	background: var(--answyr-accent);
	user-select: none;
}

.answyr-desk .answyr-msg-agent .answyr-avatar {
	background: var(--answyr-success);
}

.answyr-desk .answyr-bubble {
	max-width: 78%;
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-lg);
	padding: var(--answyr-gap) var(--answyr-gap-md);
	background: var(--answyr-surface);
	box-shadow: var(--answyr-shadow);
}

.answyr-desk .answyr-msg-customer .answyr-bubble {
	border-top-left-radius: var(--answyr-radius-sm);
}

.answyr-desk .answyr-msg-agent .answyr-bubble {
	border-top-right-radius: var(--answyr-radius-sm);
	background: var(--answyr-success-soft);
	border-color: #c6e6cf;
}

.answyr-desk .answyr-msg-meta {
	font-size: 12px;
	color: var(--answyr-ink-faint);
	margin-bottom: var(--answyr-gap-xs);
}

.answyr-desk .answyr-msg-body p:last-child {
	margin-bottom: 0;
}

/* ── Customer context (intake fields) ──────────────────────────────────── */
.answyr-desk .answyr-context {
	margin: var(--answyr-gap-md) 0;
	padding: var(--answyr-gap) var(--answyr-gap-md);
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-card);
	background: var(--answyr-surface);
	box-shadow: var(--answyr-shadow-card);
}

.answyr-desk .answyr-context h2 {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-xs);
	margin: 0 0 var(--answyr-gap-xs);
	font-size: 14px;
}

.answyr-desk .answyr-context-list {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 4px var(--answyr-gap-md);
	margin: 0;
}

.answyr-desk .answyr-context-list dt {
	font-weight: 600;
	color: var(--answyr-ink-soft);
}

.answyr-desk .answyr-context-list dd {
	margin: 0;
	word-break: break-word;
}

/* ── Attached chat transcript — customer vs agent turns styled distinctly ── */
.answyr-desk .answyr-transcript {
	display: flex;
	flex-direction: column;
	gap: var(--answyr-gap-xs);
	margin-top: var(--answyr-gap-xs);
}

.answyr-desk .answyr-transcript-turn {
	padding: var(--answyr-gap-xs) var(--answyr-gap-sm);
	border-radius: var(--answyr-radius);
	border-left: 3px solid transparent;
	font-size: 13px;
	line-height: 1.5;
}

.answyr-desk .answyr-transcript-turn.is-customer {
	background: var(--answyr-accent-soft);
	border-left-color: var(--answyr-accent);
}

.answyr-desk .answyr-transcript-turn.is-agent {
	background: var(--answyr-success-soft);
	border-left-color: var(--answyr-success);
}

.answyr-desk .answyr-transcript-who {
	display: block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--answyr-ink-faint);
	margin-bottom: 2px;
}

/* ── Compose / draft-and-vet ────────────────────────────────────────────── */
.answyr-desk .answyr-compose {
	max-width: 860px;
	margin-top: var(--answyr-gap-lg);
	padding: var(--answyr-gap-md);
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius);
	background: var(--answyr-surface);
	box-shadow: var(--answyr-shadow-md);
}

.answyr-desk .answyr-compose h2 {
	margin-top: 0;
}

.answyr-desk .answyr-sources {
	background: var(--answyr-surface-soft);
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-sm);
	padding: var(--answyr-gap-sm) var(--answyr-gap);
	margin-bottom: var(--answyr-gap-sm);
	font-size: 13px;
}

.answyr-desk .answyr-sources ul {
	margin: var(--answyr-gap-xs) 0 0;
}

.answyr-desk #answyr-reply-body {
	border-radius: var(--answyr-radius-sm);
}

.answyr-desk #answyr-suggest-status,
.answyr-desk #answyr-send-status {
	margin-left: var(--answyr-gap-sm);
}

.answyr-desk .answyr-vet-note {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-xs);
	color: var(--answyr-ink-faint);
}

/* ── Public intake form ─────────────────────────────────────────────────── */
.answyr-form {
	max-width: 520px;
}

.answyr-form input,
.answyr-form textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-sm);
	box-sizing: border-box;
	font: inherit;
}

.answyr-form input:focus,
.answyr-form textarea:focus {
	border-color: var(--answyr-accent);
	outline: 2px solid var(--answyr-accent-soft);
}

/* Intake field labels on the public form */
.answyr-form .answyr-field label {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 600;
}

.answyr-req {
	color: var(--answyr-danger);
}

.answyr-form button {
	padding: 10px 20px;
	border: 0;
	border-radius: var(--answyr-radius-sm);
	background: var(--answyr-accent);
	color: #fff;
	cursor: pointer;
	font: inherit;
}

.answyr-form button:hover:not(:disabled) {
	background: var(--answyr-accent-hover);
}

.answyr-form button:disabled {
	opacity: 0.6;
	cursor: default;
}

.answyr-form-status {
	min-height: 1.4em;
	font-size: 14px;
}

.answyr-form-status.is-error {
	color: var(--answyr-danger);
}

.answyr-form-status.is-success {
	color: var(--answyr-success);
}
