/* Support Ticket AI — Frontend styles.
   Scoped entirely under .stai-app with prefixed classes so it never
   collides with, or inherits unwanted rules from, the active theme. */

.stai-app {
	--stai-primary: #2563eb;
	--stai-primary-dark: #1d4ed8;
	--stai-border: #e2e8f0;
	--stai-text: #1e293b;
	--stai-muted: #64748b;
	--stai-bg: #f8fafc;
	--stai-danger: #dc2626;
	--stai-success: #059669;
	--stai-warning: #d97706;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--stai-text);
	max-width: 900px;
	margin: 0 auto;
}
.stai-app *, .stai-app *::before, .stai-app *::after { box-sizing: inherit; }

.stai-card {
	background: #fff;
	border: 1px solid var(--stai-border);
	border-radius: 10px;
	padding: 24px;
	margin-bottom: 24px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.stai-card h2 { margin-top: 0; font-size: 1.25rem; }

.stai-field { margin-bottom: 16px; }
.stai-field-row { display: flex; gap: 16px; }
.stai-field-row .stai-field { flex: 1; }
.stai-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.stai-field input[type="text"],
.stai-field input[type="email"],
.stai-field select,
.stai-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--stai-border);
	border-radius: 6px;
	font-size: 0.95rem;
	font-family: inherit;
	background: #fff;
	color: var(--stai-text);
}
.stai-field textarea { resize: vertical; }
.stai-field input:focus, .stai-field select:focus, .stai-field textarea:focus {
	outline: none;
	border-color: var(--stai-primary);
	box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.stai-honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.stai-btn {
	display: inline-block;
	border: none;
	border-radius: 6px;
	padding: 10px 20px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}
.stai-btn--primary { background: var(--stai-primary); color: #fff; }
.stai-btn--primary:hover { background: var(--stai-primary-dark); color: #fff; }
.stai-btn--secondary { background: var(--stai-bg); color: var(--stai-text); border: 1px solid var(--stai-border); }
.stai-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.stai-form-message { margin-top: 12px; font-size: 0.9rem; }
.stai-form-message.is-success { color: var(--stai-success); }
.stai-form-message.is-error { color: var(--stai-danger); }

.stai-table { width: 100%; border-collapse: collapse; }
.stai-table th, .stai-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--stai-border); font-size: 0.9rem; }
.stai-table a { color: var(--stai-primary); text-decoration: none; }
.stai-empty { color: var(--stai-muted); }

.stai-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	background: var(--stai-bg);
	color: var(--stai-muted);
}
.stai-badge--open { background: #dbeafe; color: #1d4ed8; }
.stai-badge--pending { background: #fef3c7; color: #b45309; }
.stai-badge--answered { background: #dcfce7; color: #15803d; }
.stai-badge--on-hold { background: #fee2e2; color: #b91c1c; }
.stai-badge--closed { background: #e2e8f0; color: #475569; }

.stai-ticket-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.stai-ticket-meta { color: var(--stai-muted); font-size: 0.9rem; }

.stai-thread { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.stai-message { border-radius: 8px; padding: 14px 16px; max-width: 85%; }
.stai-message--customer { background: var(--stai-bg); align-self: flex-start; }
.stai-message--agent { background: #eff6ff; align-self: flex-end; }
.stai-message-author { font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.stai-message-time { font-weight: 400; color: var(--stai-muted); font-size: 0.8rem; }
.stai-message-body p:first-child { margin-top: 0; }
.stai-message-body p:last-child { margin-bottom: 0; }

.stai-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.stai-tag--ai { background: #ede9fe; color: #6d28d9; }

.stai-kb-suggestions { margin-top: 10px; background: var(--stai-bg); border: 1px solid var(--stai-border); border-radius: 6px; padding: 10px 12px; font-size: 0.85rem; }
.stai-kb-suggestions a { color: var(--stai-primary); }

.stai-stars { display: flex; gap: 4px; }
.stai-star { background: none; border: none; font-size: 1.6rem; color: #cbd5e1; cursor: pointer; padding: 0; }
.stai-star.is-active, .stai-star:hover { color: #f59e0b; }

.stai-notice { padding: 12px 16px; border-radius: 6px; font-size: 0.9rem; }
.stai-notice--error { background: #fee2e2; color: #b91c1c; }

@media (max-width: 600px) {
	.stai-field-row { flex-direction: column; gap: 0; }
	.stai-message { max-width: 100%; }
}
