/**
 * EC Support — Minimal styles for My Account ticket views.
 * Inherits from WooCommerce shop_table and theme styles.
 */

/* ── Status badges ─────────────────────────────────────────────────── */

.ec-support-status {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.ec-support-status--active {
	background-color: #dcfce7;
	color: #166534;
}

.ec-support-status--pending {
	background-color: #fef3c7;
	color: #92400e;
}

.ec-support-status--closed {
	background-color: #f3f4f6;
	color: #6b7280;
}

/* ── List header ──────────────────────────────────────────────────── */

.ec-support-list-header {
	display: flex;
	justify-content: flex-end;
	gap: 0.75em;
	margin-bottom: 1em;
}

.ec-btn-help-articles {
	background: #fff !important;
	color: #000 !important;
	border: 1px solid #000 !important;
	padding: 0.6em 1.5em !important;
	border-radius: 0 !important;
	font-size: 0.95em !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	transition: background 0.15s !important;
	text-transform: uppercase !important;
	letter-spacing: 0.05em !important;
	text-decoration: none !important;
}

.ec-btn-help-articles:hover {
	background: #f3f4f6 !important;
}

/* ── Empty state ───────────────────────────────────────────────────── */

.ec-support-empty {
	text-align: center;
	padding: 2em 1em;
	color: #6b7280;
}

.ec-support-empty a {
	font-weight: 600;
}

/* ── Ticket detail header ──────────────────────────────────────────── */

.ec-support-detail-header {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 1em;
}

.ec-support-detail-header h3 {
	margin: 0;
	flex: 1;
}

.ec-support-back {
	margin-bottom: 1em;
}

.ec-support-linked-order {
	margin-bottom: 1.5em;
	color: #6b7280;
	font-size: 0.9em;
}

/* ── Conversation thread ───────────────────────────────────────────── */

.ec-support-conversation {
	display: flex;
	flex-direction: column;
	gap: 1em;
	margin-bottom: 1.5em;
}

.ec-message {
	padding: 1em;
	border-radius: 8px;
	min-width: 85%;
	max-width: 95%;
}

.ec-message--customer {
	background-color: #f0f9ff;
	border: 1px solid #bae6fd;
	align-self: flex-start;
}

.ec-message--agent {
	background-color: #f8fafc;
	border: 1px solid #e2e8f0;
	align-self: flex-end;
}

.ec-message-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 0.5em;
	flex-wrap: wrap;
}

.ec-message-sender {
	font-size: 0.85em;
}

.ec-message-time {
	font-size: 0.75em;
	color: #9ca3af;
}

.ec-message-body {
	font-size: 0.95em;
	line-height: 1.6;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.ec-message-body img {
	max-width: 100%;
	height: auto;
}

/* ── Sticky reply bar ─────────────────────────────────────────────── */

.ec-support-detail {
	position: relative;
	padding-bottom: 80px;
}

.ec-support-reply-bar {
	position: sticky;
	bottom: 0;
	z-index: 100;
	background: #fff;
	border-top: 1px solid #d1d5db;
	padding: 0.75em 0;
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.ec-support-reply-form {
	margin: 0;
}

.ec-reply-composer {
	border: 1px solid #d1d5db;
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow 0.15s;
}

.ec-reply-composer:focus-within {
	border-color: #3b82f6;
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.ec-reply-collapsed {
	padding: 0.75em 1em;
	cursor: text;
}

.ec-reply-placeholder {
	color: #9ca3af;
	font-size: 0.95em;
}

.ec-reply-expanded {
	display: none;
}

.ec-reply-expanded textarea {
	width: 100%;
	border: none;
	padding: 0.75em 1em;
	font-family: inherit;
	font-size: 0.95em;
	line-height: 1.6;
	resize: vertical;
	min-height: 80px;
}

.ec-reply-expanded textarea:focus {
	outline: none;
}

.ec-reply-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.5em 0.75em;
	background: #f9fafb;
	border-top: 1px solid #f3f4f6;
}

.ec-btn-send {
	background: #000;
	color: #fff;
	border: none;
	padding: 0.5em 1.5em;
	border-radius: 0;
	font-size: 0.9em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.ec-btn-send:hover {
	background: #333;
}

.ec-btn-close {
	background: none;
	border: none;
	color: #9ca3af;
	font-size: 0.8em;
	cursor: pointer;
	padding: 0.5em 0.75em;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
}

.ec-btn-close:hover {
	color: #dc2626;
	background: #fef2f2;
}

.ec-close-inline {
	display: inline;
}

/* ── File attachments ────────────────────────────────────────────── */

.ec-reply-attachments {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5em;
	padding: 0.5em 0.75em;
	border-top: 1px solid #f3f4f6;
	font-size: 0.85em;
}

.ec-attach-label {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	cursor: pointer;
	color: #4b5563;
	padding: 0.25em 0.5em;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	transition: border-color 0.15s, color 0.15s;
}

.ec-attach-label:hover {
	color: #000;
	border-color: #9ca3af;
}

.ec-attach-input {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.ec-attach-hint {
	font-size: 0.85em;
	color: #9ca3af;
}

.ec-attach-filelist {
	width: 100%;
	font-size: 0.85em;
	color: #6b7280;
	padding-top: 0.25em;
}

.ec-field-hint {
	margin: 0.3em 0 0;
	font-size: 0.8em;
	color: #9ca3af;
}

/* ── Message attachments ─────────────────────────────────────────── */

.ec-message-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	padding: 0.5em 1em 0.75em;
	border-top: 1px solid #e8ecf0;
}

.ec-attachment-link {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	padding: 0.3em 0.6em;
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	font-size: 0.8em;
	color: #374151;
	text-decoration: none;
	transition: background 0.15s, border-color 0.15s;
}

.ec-attachment-link:hover {
	background: #e5e7eb;
	border-color: #d1d5db;
	color: #111827;
}

.ec-attachment-icon {
	font-size: 1em;
}

.ec-attachment-size {
	color: #9ca3af;
	font-size: 0.9em;
}

/* ── Closed ticket notice ─────────────────────────────────────────── */

.ec-support-closed-notice {
	padding: 1em;
	background-color: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	font-size: 0.9em;
	color: #6b7280;
	margin-top: 1em;
}

.ec-support-closed-notice a {
	font-weight: 600;
}

/* ── Contact / new ticket form ────────────────────────────────────── */

.ec-contact-form-wrap {
	max-width: 600px;
}

.ec-contact-form {
	display: flex;
	flex-direction: column;
	gap: 1.25em;
}

.ec-contact-field label {
	display: block;
	font-weight: 600;
	font-size: 0.9em;
	margin-bottom: 0.35em;
}

.ec-contact-field label .required {
	color: #dc2626;
}

.ec-contact-field input[type="text"],
.ec-contact-field input[type="email"],
.ec-contact-field select,
.ec-contact-field textarea {
	width: 100%;
	padding: 0.6em 0.75em;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-family: inherit;
	font-size: 0.95em;
	line-height: 1.5;
}

.ec-contact-field input:focus,
.ec-contact-field textarea:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.ec-contact-field input[readonly] {
	background: #f9fafb;
	color: #6b7280;
}

.ec-contact-field textarea {
	resize: vertical;
}

.ec-contact-actions {
	padding-top: 0.25em;
}

.ec-contact-submit {
	background: #000 !important;
	color: #fff !important;
	border: none !important;
	padding: 0.6em 2em !important;
	border-radius: 0 !important;
	font-size: 0.95em !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	transition: background 0.15s !important;
	text-transform: uppercase !important;
	letter-spacing: 0.05em !important;
}

.ec-contact-submit:hover {
	background: #333 !important;
}

.ec-contact-notice {
	padding: 1em;
	border-radius: 6px;
	margin-bottom: 1.5em;
	font-size: 0.95em;
}

.ec-contact-notice--success {
	background: #dcfce7;
	border: 1px solid #86efac;
	color: #166534;
}

.ec-contact-notice--success a {
	font-weight: 600;
	color: #166534;
}

.ec-contact-notice--error {
	background: #fef2f2;
	border: 1px solid #fca5a5;
	color: #991b1b;
}

.ec-contact-alt {
	margin-top: 2em;
	padding-top: 1.5em;
	border-top: 1px solid #e5e7eb;
	font-size: 0.9em;
	color: #6b7280;
}

.ec-contact-alt a {
	font-weight: 600;
}

/* ── Table tweaks ──────────────────────────────────────────────────── */

.ec-support-col-ref {
	width: 100px;
}

.ec-support-col-status {
	width: 130px;
}

.ec-support-col-updated {
	width: 140px;
}

/* ── Guest magic-link view ────────────────────────────────────────── */

.ec-guest-ticket-wrap {
	max-width: 800px;
	margin: 0 auto;
	padding: 1em 0;
}

.ec-guest-account-cta {
	margin-top: 2em;
	padding-top: 1.5em;
	border-top: 1px solid #e5e7eb;
	font-size: 0.9em;
	color: #6b7280;
	text-align: center;
}

.ec-guest-account-cta a {
	font-weight: 600;
}

/* ── Mobile responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
	.ec-message {
		min-width: 90%;
		max-width: 100%;
	}

	.ec-support-detail-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.ec-message-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
	}
}

/* ── Knowledge Base ──────────────────────────────────────────────── */

.ec-kb-wrap {
	max-width: 960px;
	margin: 0 auto;
	padding: 2em 1em;
}

.ec-kb-header {
	text-align: center;
	margin-bottom: 2em;
}

.ec-kb-header h1 {
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 700;
	font-size: 1.75em;
}

.ec-kb-category-desc {
	color: #6b7280;
	font-size: 0.95em;
}

.ec-kb-section-title {
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 700;
	font-size: 1em;
	margin: 2em 0 1em;
}

/* ── KB Search ───────────────────────────────────────────────────── */

.ec-kb-search {
	display: flex;
	gap: 0;
	max-width: 500px;
	margin: 1em auto 0;
}

.ec-kb-search input[type="text"] {
	flex: 1;
	padding: 0.6em 0.75em;
	border: 1px solid #d1d5db;
	border-right: none;
	border-radius: 0;
	font-size: 0.95em;
	font-family: inherit;
}

.ec-kb-search input[type="text"]:focus {
	outline: none;
	border-color: #000;
}

.ec-kb-search-btn {
	background: #000;
	color: #fff;
	border: none;
	padding: 0.6em 1.5em;
	border-radius: 0;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	cursor: pointer;
	font-family: inherit;
}

.ec-kb-search-btn:hover {
	background: #333;
}

.ec-kb-search-results-label {
	font-size: 0.9em;
	color: #6b7280;
	margin-bottom: 1em;
}

/* ── KB Category Grid ────────────────────────────────────────────── */

.ec-kb-categories {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 1em;
	margin-bottom: 2em;
}

.ec-kb-category-card {
	display: block;
	padding: 1.25em;
	border: 1px solid #e5e7eb;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.ec-kb-category-card:hover {
	border-color: #000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ec-kb-category-card h3 {
	margin: 0 0 0.25em;
	font-size: 1em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.ec-kb-category-card p {
	margin: 0 0 0.5em;
	font-size: 0.85em;
	color: #6b7280;
}

.ec-kb-article-count {
	font-size: 0.8em;
	color: #9ca3af;
}

/* ── KB Article List ─────────────────────────────────────────────── */

.ec-kb-article-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.ec-kb-article-list li {
	border-bottom: 1px solid #f3f4f6;
}

.ec-kb-article-list a {
	display: block;
	padding: 0.75em 0;
	text-decoration: none;
	color: inherit;
	font-weight: 500;
}

.ec-kb-article-list a:hover {
	color: #000;
}

.ec-kb-article-excerpt {
	display: block;
	font-size: 0.85em;
	color: #9ca3af;
	font-weight: 400;
	padding-bottom: 0.5em;
}

.ec-kb-empty {
	text-align: center;
	padding: 2em 1em;
	color: #6b7280;
}

/* ── KB Single Article ───────────────────────────────────────────── */

.ec-kb-layout {
	display: grid;
	grid-template-columns: 1fr 260px;
	gap: 2em;
}

.ec-kb-article h1 {
	font-size: 1.5em;
	margin-bottom: 0.5em;
}

.ec-kb-article-body {
	line-height: 1.7;
}

.ec-kb-article-body img {
	max-width: 100%;
	height: auto;
}

.ec-kb-sidebar {
	border-left: 1px solid #e5e7eb;
	padding-left: 1.5em;
}

.ec-kb-sidebar h3 {
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
	margin: 0 0 0.75em;
}

.ec-kb-sidebar-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.ec-kb-sidebar-list li {
	padding: 0.35em 0;
}

.ec-kb-sidebar-list a {
	font-size: 0.9em;
	color: #374151;
	text-decoration: none;
}

.ec-kb-sidebar-list a:hover {
	color: #000;
	text-decoration: underline;
}

/* ── KB Breadcrumb ───────────────────────────────────────────────── */

.ec-kb-breadcrumb {
	font-size: 0.85em;
	color: #9ca3af;
	margin-bottom: 1.5em;
}

.ec-kb-breadcrumb a {
	color: #6b7280;
	text-decoration: none;
}

.ec-kb-breadcrumb a:hover {
	color: #000;
}

/* ── KB CTA ──────────────────────────────────────────────────────── */

.ec-kb-cta {
	margin-top: 2em;
	padding: 1.5em;
	border: 1px solid #e5e7eb;
	text-align: center;
}

.ec-kb-cta p {
	margin: 0 0 0.75em;
	color: #6b7280;
}

.ec-kb-back-link {
	margin-top: 2em;
}

/* ── KB Banner (ticket forms) ────────────────────────────────────── */

.ec-kb-banner {
	margin-bottom: 1.5em;
	padding: 0.5em 1em;
	background: #fff;
	border-left: 3px solid #000;
	border-top: none;
	border-right: none;
	border-bottom: none;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ec-kb-banner h3 {
	margin: 0 0 0.35em !important;
	padding: 0 !important;
	font-size: 0.9em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.ec-kb-banner-list {
	list-style: none;
	padding: 0;
	margin: 0 0 0.75em;
}

.ec-kb-banner-list li {
	padding: 0.2em 0;
}

.ec-kb-banner-list a {
	font-size: 0.9em;
	color: #374151;
	text-decoration: none;
}

.ec-kb-banner-list a:hover {
	color: #000;
	text-decoration: underline;
}

.ec-kb-banner-link {
	font-size: 0.85em;
	font-weight: 600;
	text-decoration: none;
	color: #000;
}

.ec-kb-banner-link:hover {
	text-decoration: underline;
}

/* ── KB Mobile ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
	.ec-kb-layout {
		grid-template-columns: 1fr;
	}

	.ec-kb-sidebar {
		border-left: none;
		border-top: 1px solid #e5e7eb;
		padding-left: 0;
		padding-top: 1.5em;
	}

	.ec-kb-categories {
		grid-template-columns: 1fr;
	}
}
