/**
 * GToma Ticketing – front-end styles.
 *
 * The styles inherit fonts and colors from the theme. Customise the accent
 * color from the settings or with the --gtoma-accent custom property.
 */

.gtoma-ticketing {
	--gtoma-accent: #2271b1;
	--gtoma-border: rgba(0, 0, 0, 0.14);
	--gtoma-muted: rgba(0, 0, 0, 0.58);
	--gtoma-surface: rgba(0, 0, 0, 0.03);
	--gtoma-radius: 8px;
	--gtoma-success: #1e7d45;
	--gtoma-error: #b42318;
	max-width: 760px;
	margin: 0 auto 2em;
	box-sizing: border-box;
}

.gtoma-ticketing *,
.gtoma-ticketing *::before,
.gtoma-ticketing *::after {
	box-sizing: inherit;
}

/* Form layout ---------------------------------------------------------- */

.gtoma-ticketing .gtoma-row {
	display: grid;
	gap: 0 1.25em;
}

@media (min-width: 640px) {
	.gtoma-ticketing .gtoma-row-2 {
		grid-template-columns: 1fr 1fr;
	}
}

.gtoma-ticketing .gtoma-field {
	margin: 0 0 1.1em;
}

.gtoma-ticketing .gtoma-field label {
	display: block;
	margin-bottom: 0.35em;
	font-weight: 600;
}

.gtoma-ticketing .gtoma-checkbox label {
	display: flex;
	gap: 0.6em;
	align-items: flex-start;
	font-weight: normal;
}

.gtoma-ticketing .gtoma-checkbox input {
	margin-top: 0.3em;
	flex: 0 0 auto;
}

.gtoma-ticketing input[type="text"],
.gtoma-ticketing input[type="email"],
.gtoma-ticketing select,
.gtoma-ticketing textarea {
	width: 100%;
	max-width: 100%;
	padding: 0.65em 0.8em;
	border: 1px solid var(--gtoma-border);
	border-radius: 6px;
	background: #fff;
	color: inherit;
	font: inherit;
	line-height: 1.4;
}

.gtoma-ticketing textarea {
	resize: vertical;
	min-height: 8em;
}

.gtoma-ticketing input:focus,
.gtoma-ticketing select:focus,
.gtoma-ticketing textarea:focus {
	outline: 2px solid var(--gtoma-accent);
	outline-offset: 1px;
	border-color: var(--gtoma-accent);
}

.gtoma-ticketing input[type="file"] {
	max-width: 100%;
	font-size: 0.9em;
}

.gtoma-ticketing .gtoma-required {
	color: var(--gtoma-error);
}

.gtoma-ticketing .gtoma-help {
	display: block;
	margin-top: 0.35em;
	color: var(--gtoma-muted);
	font-size: 0.85em;
}

.gtoma-ticketing .has-error input,
.gtoma-ticketing .has-error textarea,
.gtoma-ticketing .has-error select {
	border-color: var(--gtoma-error);
}

.gtoma-ticketing .gtoma-field-error {
	margin: 0.35em 0 0;
	color: var(--gtoma-error);
	font-size: 0.875em;
}

/* Honeypot: hidden from people, visible to bots. */
.gtoma-ticketing .gtoma-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Buttons --------------------------------------------------------------- */

.gtoma-ticketing .gtoma-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	align-items: center;
	margin: 1.25em 0 0;
}

.gtoma-ticketing .gtoma-button {
	display: inline-block;
	padding: 0.75em 1.5em;
	border: 0;
	border-radius: 6px;
	background: var(--gtoma-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.gtoma-ticketing .gtoma-button:hover,
.gtoma-ticketing .gtoma-button:focus {
	color: #fff;
	filter: brightness(0.92);
}

.gtoma-ticketing .gtoma-button[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.gtoma-ticketing .gtoma-link-button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--gtoma-muted);
	font: inherit;
	font-size: 0.9em;
	text-decoration: underline;
	cursor: pointer;
}

.gtoma-ticketing .gtoma-close-form {
	margin-top: 1em;
	text-align: right;
}

/* Notices --------------------------------------------------------------- */

.gtoma-ticketing .gtoma-notice {
	margin: 0 0 1.5em;
	padding: 1em 1.25em;
	border-left: 4px solid var(--gtoma-accent);
	border-radius: 0 var(--gtoma-radius) var(--gtoma-radius) 0;
	background: var(--gtoma-surface);
}

.gtoma-ticketing .gtoma-notice p {
	margin: 0 0 0.5em;
}

.gtoma-ticketing .gtoma-notice p:last-child {
	margin-bottom: 0;
}

.gtoma-ticketing .gtoma-notice-success {
	border-color: var(--gtoma-success);
}

.gtoma-ticketing .gtoma-notice-error {
	border-color: var(--gtoma-error);
}

/* Badges ---------------------------------------------------------------- */

.gtoma-ticketing .gtoma-badge {
	display: inline-block;
	padding: 0.2em 0.65em;
	border-radius: 999px;
	background: #e5e7eb;
	color: #374151;
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}

.gtoma-ticketing .gtoma-status-open { background: #dbeafe; color: #1e40af; }
.gtoma-ticketing .gtoma-status-in_progress { background: #fef3c7; color: #92400e; }
.gtoma-ticketing .gtoma-status-awaiting_customer { background: #ede9fe; color: #5b21b6; }
.gtoma-ticketing .gtoma-status-resolved { background: #dcfce7; color: #166534; }
.gtoma-ticketing .gtoma-status-closed { background: #e5e7eb; color: #374151; }

/* Ticket view ----------------------------------------------------------- */

.gtoma-ticketing .gtoma-back {
	margin: 0 0 1em;
	font-size: 0.9em;
}

.gtoma-ticketing .gtoma-ticket-header {
	margin-bottom: 1.5em;
	padding-bottom: 1em;
	border-bottom: 1px solid var(--gtoma-border);
}

.gtoma-ticketing .gtoma-ticket-number {
	margin: 0;
	color: var(--gtoma-muted);
	font-size: 0.9em;
	font-weight: 600;
}

.gtoma-ticketing .gtoma-ticket-subject {
	margin: 0.15em 0 0.6em;
}

.gtoma-ticketing .gtoma-ticket-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em 2em;
	margin: 0;
	font-size: 0.9em;
}

.gtoma-ticketing .gtoma-ticket-meta dt {
	color: var(--gtoma-muted);
	font-size: 0.85em;
}

.gtoma-ticketing .gtoma-ticket-meta dd {
	margin: 0;
}

.gtoma-ticketing .gtoma-conversation {
	margin: 0 0 1.5em;
	padding: 0;
	list-style: none;
}

.gtoma-ticketing .gtoma-message {
	margin: 0 0 1em;
	padding: 1em 1.25em;
	border: 1px solid var(--gtoma-border);
	border-radius: var(--gtoma-radius);
}

.gtoma-ticketing .gtoma-message-staff {
	border-left: 4px solid var(--gtoma-accent);
	background: var(--gtoma-surface);
}

.gtoma-ticketing .gtoma-message-head {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 0.75em;
	align-items: baseline;
	margin-bottom: 0.5em;
	font-size: 0.9em;
}

.gtoma-ticketing .gtoma-message-head time {
	margin-left: auto;
	color: var(--gtoma-muted);
	font-size: 0.9em;
}

.gtoma-ticketing .gtoma-message-role {
	color: var(--gtoma-accent);
	font-size: 0.85em;
	font-weight: 600;
}

.gtoma-ticketing .gtoma-message-text {
	overflow-wrap: anywhere;
}

.gtoma-ticketing .gtoma-message-text p {
	margin: 0 0 0.75em;
}

.gtoma-ticketing .gtoma-message-text p:last-child {
	margin-bottom: 0;
}

.gtoma-ticketing .gtoma-attachments {
	margin: 0.75em 0 0;
	padding: 0.75em 0 0;
	border-top: 1px dashed var(--gtoma-border);
	list-style: none;
	font-size: 0.9em;
}

.gtoma-ticketing .gtoma-attachments .gtoma-help {
	display: inline;
}

.gtoma-ticketing .gtoma-event {
	margin: 0 0 1em;
	color: var(--gtoma-muted);
	font-size: 0.85em;
	text-align: center;
}

.gtoma-ticketing .gtoma-closed-info {
	padding: 1em;
	border-radius: var(--gtoma-radius);
	background: var(--gtoma-surface);
	text-align: center;
}

/* Ticket list ----------------------------------------------------------- */

.gtoma-ticketing .gtoma-list-header {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1em;
}

.gtoma-ticketing .gtoma-list-header h2 {
	margin: 0;
}

.gtoma-ticketing .gtoma-tickets {
	margin: 0;
	padding: 0;
	list-style: none;
}

.gtoma-ticketing .gtoma-ticket-row a {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1em;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.6em;
	padding: 0.9em 1.1em;
	border: 1px solid var(--gtoma-border);
	border-radius: var(--gtoma-radius);
	color: inherit;
	text-decoration: none;
}

.gtoma-ticketing .gtoma-ticket-row a:hover,
.gtoma-ticketing .gtoma-ticket-row a:focus {
	border-color: var(--gtoma-accent);
}

.gtoma-ticketing .gtoma-ticket-row-number {
	margin-right: 0.6em;
	color: var(--gtoma-muted);
	font-weight: 600;
}

.gtoma-ticketing .gtoma-ticket-row-side {
	display: flex;
	gap: 0.75em;
	align-items: center;
}

.gtoma-ticketing .gtoma-ticket-row-side .gtoma-help {
	margin: 0;
}

.gtoma-ticketing .gtoma-secondary-link {
	font-size: 0.9em;
}
