/*
 * KODENZO Support Tickets — customer-facing front end (2026-09-26).
 *
 * Deliberately does not redeclare any color/font token — every value here
 * reads from the CSS custom properties frontend.css already defines in
 * :root (--lf-navy, --lf-coral, --lf-text, --lf-text-muted, --lf-border,
 * --lf-radius, --lf-font-heading, --lf-font-body), and reuses frontend.css's
 * existing .lf-card/.lf-btn/.lf-badge/.lf-notice/.lf-empty-state components
 * directly rather than inventing parallel ones. The goal is a screen that
 * reads as part of the same KODENZO Hub portal as Dashboard/Licenses/
 * Account, not a bolted-on generic helpdesk.
 */

.lf-support {
	max-width: 960px;
	margin: 0 auto;
}

.lf-support__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 24px;
}

.lf-support__header--compact {
	margin-bottom: 20px;
}

.lf-support__header h1 {
	margin: 4px 0 6px;
}

.lf-support__subtitle {
	color: var(--lf-text-muted);
	margin: 0;
}

.lf-support__back {
	display: inline-block;
	font-size: 13px;
	color: var(--lf-text-muted);
	text-decoration: none;
	margin-bottom: 10px;
}

.lf-support__back:hover {
	color: var(--lf-coral);
}

.lf-support__new-btn {
	flex-shrink: 0;
	white-space: nowrap;
}

/* ---------------------------------------------------------------------
 * Summary cards — subtle, not a dashboard. Only numbers, no charts.
 * ------------------------------------------------------------------- */
.lf-support__summary {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 20px;
}

.lf-support__summary-item {
	background: #fff;
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	padding: 14px 16px;
}

.lf-support__summary-value {
	display: block;
	font-family: var(--lf-font-heading);
	font-size: 22px;
	color: var(--lf-text);
	line-height: 1.2;
}

.lf-support__summary-label {
	display: block;
	font-size: 12px;
	color: var(--lf-text-muted);
	margin-top: 2px;
}

/* ---------------------------------------------------------------------
 * Filters
 * ------------------------------------------------------------------- */
.lf-support__filters {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.lf-support__search {
	position: relative;
	flex: 1 1 240px;
	display: flex;
	align-items: center;
}

.lf-support__search svg {
	position: absolute;
	left: 12px;
	color: var(--lf-text-muted);
	pointer-events: none;
}

.lf-support__search input {
	width: 100%;
	padding: 9px 12px 9px 36px;
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	font-family: var(--lf-font-body);
	font-size: 14px;
}

.lf-support__filters select {
	padding: 9px 12px;
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	font-family: var(--lf-font-body);
	font-size: 14px;
	background: #fff;
}

.lf-support__filter-submit {
	display: none;
}

/* ---------------------------------------------------------------------
 * Empty state
 * ------------------------------------------------------------------- */
.lf-support__empty {
	text-align: center;
	padding: 48px 24px;
}

.lf-support__empty-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: #f5f6f8;
	color: var(--lf-text-muted);
	margin-bottom: 16px;
}

.lf-support__empty h3 {
	margin: 0 0 6px;
}

.lf-support__empty p {
	color: var(--lf-text-muted);
	max-width: 380px;
	margin: 0 auto 18px;
}

/* ---------------------------------------------------------------------
 * Ticket list
 * ------------------------------------------------------------------- */
.lf-ticket-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.lf-ticket-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	background: #fff;
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	padding: 16px 20px;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.lf-ticket-row:hover,
.lf-ticket-row:focus-visible {
	border-color: var(--lf-coral);
	box-shadow: 0 6px 16px rgba(19, 25, 34, 0.06);
	transform: translateY(-1px);
}

.lf-ticket-row:focus-visible {
	outline: 2px solid var(--lf-coral);
	outline-offset: 2px;
}

.lf-ticket-row__main {
	min-width: 0;
	flex: 1;
}

.lf-ticket-row__top {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 3px;
}

.lf-ticket-row__number {
	font-size: 12px;
	color: var(--lf-text-muted);
	font-weight: 600;
	letter-spacing: 0.02em;
}

.lf-ticket-row__priority {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 1px 7px;
	border-radius: 999px;
	background: #fdf4e3;
	color: #b45309;
}

.lf-ticket-row__priority--urgent {
	background: #fce8e8;
	color: #b91c1c;
}

.lf-ticket-row__subject {
	font-family: var(--lf-font-heading);
	font-size: 16px;
	color: var(--lf-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lf-ticket-row__product {
	font-size: 13px;
	color: var(--lf-text-muted);
	margin-top: 2px;
}

.lf-ticket-row__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	flex-shrink: 0;
}

.lf-ticket-row__updated {
	text-align: right;
	font-size: 12px;
	color: var(--lf-text-muted);
}

.lf-ticket-row__updated-label {
	display: block;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* ---------------------------------------------------------------------
 * Status pill — text + icon, never color alone.
 * ------------------------------------------------------------------- */
.lf-ticket-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 999px;
	white-space: nowrap;
}

.lf-ticket-status--lg {
	font-size: 13px;
	padding: 6px 14px;
}

.lf-ticket-status__dot {
	font-size: 9px;
	line-height: 1;
}

.lf-ticket-status--support {
	background: #fdf4e3;
	color: #b45309;
}

.lf-ticket-status--customer {
	background: #eef2ff;
	color: #3538cd;
}

.lf-ticket-status--resolved {
	background: #edfaf0;
	color: #00a32a;
}

.lf-ticket-status--closed {
	background: #f0f2f5;
	color: #5a6472;
}

/* ---------------------------------------------------------------------
 * Ticket form (New Ticket)
 * ------------------------------------------------------------------- */
.lf-ticket-form {
	padding: 28px 30px;
}

.lf-form-row {
	margin-bottom: 20px;
}

.lf-form-row--split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

.lf-form-field label,
.lf-form-row > label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--lf-text);
	margin-bottom: 6px;
}

.lf-ticket-form select,
.lf-ticket-form input[type="text"],
.lf-ticket-form textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	font-family: var(--lf-font-body);
	font-size: 14px;
	color: var(--lf-text);
	background: #fff;
}

.lf-ticket-form select:focus,
.lf-ticket-form input:focus,
.lf-ticket-form textarea:focus {
	outline: 2px solid var(--lf-coral);
	outline-offset: 1px;
	border-color: var(--lf-coral);
}

.lf-ticket-form textarea {
	resize: vertical;
}

.lf-ticket-form__actions {
	display: flex;
	gap: 10px;
	margin-top: 8px;
}

.lf-ticket-form__submit[data-loading="1"] {
	opacity: 0.7;
	pointer-events: none;
}

/* ---------------------------------------------------------------------
 * Attachment dropzone + file cards
 * ------------------------------------------------------------------- */
.lf-attachment-dropzone {
	position: relative;
	border: 1.5px dashed var(--lf-border);
	border-radius: var(--lf-radius);
	padding: 26px 20px;
	text-align: center;
	color: var(--lf-text-muted);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.lf-attachment-dropzone:hover,
.lf-attachment-dropzone:focus-visible,
.lf-attachment-dropzone.is-dragover {
	border-color: var(--lf-coral);
	background: #fff8f7;
	outline: none;
}

.lf-attachment-dropzone svg {
	color: var(--lf-text-muted);
	margin-bottom: 8px;
}

.lf-attachment-dropzone__title {
	margin: 0;
	font-weight: 600;
	color: var(--lf-text);
}

.lf-attachment-dropzone__or {
	margin: 4px 0;
	font-size: 12px;
}

.lf-attachment-dropzone__browse {
	margin: 4px 0 10px;
}

.lf-attachment-dropzone__hint {
	margin: 0;
	font-size: 12px;
}

.lf-attachment-dropzone__input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

.lf-attachment-list {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.lf-attachment-list:empty {
	margin: 0;
}

.lf-attachment-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border: 1px solid var(--lf-border);
	border-radius: 6px;
	font-size: 13px;
}

.lf-attachment-card__name {
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--lf-text);
}

.lf-attachment-card__size {
	color: var(--lf-text-muted);
	font-size: 12px;
	flex-shrink: 0;
}

.lf-attachment-card__remove {
	background: none;
	border: none;
	color: var(--lf-text-muted);
	cursor: pointer;
	font-size: 13px;
	padding: 2px 6px;
	flex-shrink: 0;
}

.lf-attachment-card__remove:hover {
	color: #b91c1c;
}

.lf-attachment-card--error {
	border-color: #f3dfae;
	background: #fffbea;
	color: #b45309;
}

/* ---------------------------------------------------------------------
 * Success state
 * ------------------------------------------------------------------- */
.lf-ticket-success {
	text-align: center;
	padding: 36px 24px;
	margin-bottom: 20px;
}

.lf-ticket-success__icon {
	color: #00a32a;
	margin-bottom: 8px;
}

.lf-ticket-success h2 {
	margin: 0 0 6px;
}

.lf-ticket-success__number {
	font-family: var(--lf-font-heading);
	font-size: 20px;
	color: var(--lf-coral);
	margin: 0 0 10px;
}

/* ---------------------------------------------------------------------
 * Ticket detail
 * ------------------------------------------------------------------- */
.lf-ticket-detail__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
}

.lf-ticket-detail__number {
	display: block;
	font-size: 12px;
	color: var(--lf-text-muted);
	font-weight: 600;
	margin-bottom: 2px;
}

.lf-ticket-detail__title-block h1 {
	margin: 0 0 4px;
	font-size: 24px;
}

.lf-ticket-detail__product {
	font-size: 13px;
	color: var(--lf-text-muted);
}

.lf-ticket-detail__layout {
	display: grid;
	grid-template-columns: 1fr 280px;
	gap: 24px;
	align-items: start;
}

.lf-ticket-detail__main {
	min-width: 0;
}

/* ---------------------------------------------------------------------
 * Conversation
 * ------------------------------------------------------------------- */
.lf-conversation {
	padding: 4px 26px;
}

.lf-conversation__empty {
	color: var(--lf-text-muted);
	padding: 20px 0;
	text-align: center;
}

.lf-message {
	padding: 18px 0;
	border-bottom: 1px solid var(--lf-border);
}

.lf-message:last-child {
	border-bottom: none;
}

.lf-message__header {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin-bottom: 6px;
}

.lf-message__author {
	font-weight: 700;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--lf-text-muted);
}

.lf-message--staff .lf-message__author {
	color: var(--lf-coral);
}

.lf-message__time {
	font-size: 12px;
	color: var(--lf-text-muted);
}

.lf-message__body {
	color: var(--lf-text);
	line-height: 1.6;
	font-size: 14px;
}

.lf-message__body p {
	margin: 0 0 10px;
}

.lf-message__body p:last-child {
	margin-bottom: 0;
}

.lf-message__attachments {
	margin-top: 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.lf-attachment-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	border: 1px solid var(--lf-border);
	border-radius: 999px;
	font-size: 12px;
	color: var(--lf-text);
	text-decoration: none;
	background: #fafbfc;
}

.lf-attachment-chip:hover {
	border-color: var(--lf-coral);
	color: var(--lf-coral);
}

.lf-attachment-chip__size {
	color: var(--lf-text-muted);
}

.lf-message--ticket-attachments .lf-message__author {
	color: var(--lf-text-muted);
	text-transform: none;
	font-weight: 600;
	letter-spacing: 0;
}

/* ---------------------------------------------------------------------
 * Reply composer
 * ------------------------------------------------------------------- */
.lf-reply-composer {
	padding: 22px 26px;
}

.lf-reply-composer h3 {
	margin: 0 0 12px;
	font-size: 15px;
}

.lf-reply-composer textarea {
	width: 100%;
	padding: 12px;
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	font-family: var(--lf-font-body);
	font-size: 14px;
	resize: vertical;
	margin-bottom: 12px;
}

.lf-reply-composer textarea:focus {
	outline: 2px solid var(--lf-coral);
	outline-offset: 1px;
	border-color: var(--lf-coral);
}

.lf-reply-composer__attachments {
	margin-bottom: 14px;
}

.lf-reply-composer__actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Send Reply and Close Ticket are two sibling <form> elements, not one
 * nested inside the other (nested forms are invalid HTML and silently
 * merge their fields — see templates/frontend/support/detail.php's inline
 * comment for the bug that caused). The Close form sits just below the
 * reply form's own actions row with a small gap, rather than forcing it
 * onto the same line via fragile positioning. */
.lf-reply-composer__close-form {
	display: inline-block;
	margin-top: 12px;
}

.lf-reply-composer--closed {
	text-align: center;
	color: var(--lf-text-muted);
}

.lf-reply-composer--closed p {
	margin-bottom: 12px;
}

.lf-btn--ghost {
	background: none;
	border: none;
	color: var(--lf-text-muted);
	padding: 10px 4px;
	cursor: pointer;
	font-family: var(--lf-font-body);
	font-size: 14px;
}

.lf-btn--ghost:hover {
	color: #b91c1c;
}

/* ---------------------------------------------------------------------
 * Sidebar
 * ------------------------------------------------------------------- */
.lf-ticket-sidebar {
	padding: 20px 22px;
}

.lf-ticket-sidebar h3 {
	margin: 0 0 14px;
	font-size: 14px;
}

.lf-ticket-sidebar__list {
	margin: 0;
}

.lf-ticket-sidebar__row {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px solid var(--lf-border);
	font-size: 13px;
}

.lf-ticket-sidebar__row:last-child {
	border-bottom: none;
}

.lf-ticket-sidebar__row dt {
	color: var(--lf-text-muted);
}

.lf-ticket-sidebar__row dd {
	margin: 0;
	color: var(--lf-text);
	font-weight: 600;
	text-align: right;
}

/* ---------------------------------------------------------------------
 * Loading skeletons
 * ------------------------------------------------------------------- */
.lf-skeleton {
	background: linear-gradient(90deg, #f0f2f5 25%, #f7f8fa 37%, #f0f2f5 63%);
	background-size: 400% 100%;
	animation: lf-skeleton-shimmer 1.4s ease infinite;
	border-radius: 6px;
}

@keyframes lf-skeleton-shimmer {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

.lf-skeleton-row {
	height: 72px;
	margin-bottom: 10px;
}

/* ---------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------- */
@media (max-width: 860px) {
	.lf-ticket-detail__layout {
		grid-template-columns: 1fr;
	}

	.lf-ticket-detail__sidebar {
		order: -1;
	}

	.lf-support__summary {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.lf-support__header {
		flex-direction: column;
		align-items: stretch;
	}

	.lf-support__new-btn {
		text-align: center;
	}

	.lf-form-row--split {
		grid-template-columns: 1fr;
	}

	.lf-ticket-row {
		flex-direction: column;
		align-items: stretch;
	}

	.lf-ticket-row__meta {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	.lf-ticket-row__updated {
		text-align: left;
	}

	.lf-support__filters {
		flex-direction: column;
		align-items: stretch;
	}

	.lf-ticket-form {
		padding: 20px;
	}

	.lf-conversation {
		padding: 4px 18px;
	}

	.lf-reply-composer {
		padding: 18px;
	}

	.lf-ticket-detail__header {
		flex-direction: column;
	}
}

/* ---------------------------------------------------------------------
 * Confirm dialog (Close ticket)
 * ------------------------------------------------------------------- */
.lf-confirm-overlay {
	position: fixed;
	inset: 0;
	background: rgba(19, 25, 34, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	padding: 20px;
}

.lf-confirm-dialog {
	background: #fff;
	border-radius: 10px;
	padding: 24px;
	max-width: 380px;
	width: 100%;
	box-shadow: 0 20px 50px rgba(19, 25, 34, 0.2);
}

.lf-confirm-dialog h3 {
	margin: 0 0 8px;
}

.lf-confirm-dialog p {
	color: var(--lf-text-muted);
	margin: 0 0 18px;
}

.lf-confirm-dialog__actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}
