/*
 * Amir Forex Support front-end styles.
 *
 * @package Amir_Forex_Support
 */

.afs-portal,
.afs-page,
.afs-login-notice {
	--afs-bg: #070b13;
	--afs-bg-soft: #0b111c;
	--afs-bg-elevated: #101827;
	--afs-bg-hover: #151f2f;
	--afs-border: rgba(151, 169, 194, 0.18);
	--afs-border-gold: rgba(243, 186, 47, 0.44);
	--afs-text: #f4f7fb;
	--afs-muted: #9ba7b8;
	--afs-gold: #f3ba2f;
	--afs-gold-light: #ffd96a;
	--afs-success: #20d889;
	--afs-danger: #ff707a;
	font-family: inherit;
	color: var(--afs-text);
}

.afs-portal *,
.afs-portal *::before,
.afs-portal *::after,
.afs-login-notice *,
.afs-login-notice *::before,
.afs-login-notice *::after {
	box-sizing: border-box;
}

.afs-page {
	width: 100%;
	max-width: 76rem;
	margin: 0 auto;
}

.afs-page-heading {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.afs-page-heading h1 {
	margin: 0.45rem 0 0.4rem;
	color: var(--afs-text);
	font-size: clamp(1.35rem, 3vw, 2rem);
	font-weight: 900;
	line-height: 1.6;
}

.afs-page-heading p {
	margin: 0;
	color: var(--afs-muted);
	font-size: 0.78rem;
	line-height: 2;
}

.afs-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	color: var(--afs-gold);
	font-size: 0.7rem;
	font-weight: 700;
}

.afs-status-dot {
	display: inline-block;
	width: 0.48rem;
	height: 0.48rem;
	border-radius: 50%;
	background: var(--afs-success);
	box-shadow: 0 0 0 0.22rem rgba(32, 216, 137, 0.12);
}

.afs-icon {
	display: inline-block;
	width: 1.2rem;
	height: 1.2rem;
	flex: 0 0 1.2rem;
	fill: currentColor;
	vertical-align: middle;
}

.afs-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	min-height: 2.7rem;
	padding: 0.6rem 1rem;
	border: 1px solid transparent;
	border-radius: 0.6rem;
	font: inherit;
	font-size: 0.74rem;
	font-weight: 700;
	line-height: 1.5;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, filter 180ms ease;
}

.afs-button--gold {
	background: linear-gradient(135deg, var(--afs-gold-light), var(--afs-gold));
	box-shadow: 0 0.4rem 1.4rem rgba(243, 186, 47, 0.18);
	color: #111722;
}

.afs-button--gold:hover,
.afs-button--gold:focus-visible {
	filter: brightness(1.08);
	outline: none;
}

.afs-button--outline {
	border-color: var(--afs-border-gold);
	background: transparent;
	color: var(--afs-gold-light);
}

.afs-button--outline:hover,
.afs-button--outline:focus-visible {
	background: rgba(243, 186, 47, 0.1);
	outline: none;
}

.afs-back-link {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin-bottom: 0.7rem;
	color: var(--afs-gold);
	font-size: 0.7rem;
	text-decoration: none;
}

.afs-back-link:hover,
.afs-back-link:focus-visible {
	color: var(--afs-gold-light);
	outline: none;
}

.afs-panel {
	padding: 1rem;
	border: 1px solid var(--afs-border);
	border-radius: 0.9rem;
	background: rgba(11, 17, 28, 0.82);
}

.afs-ticket-list {
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
}

.afs-ticket-card {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 1rem;
	border: 1px solid var(--afs-border);
	border-radius: 0.85rem;
	background: var(--afs-bg-soft);
	color: var(--afs-text);
	text-decoration: none;
	transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.afs-ticket-card:hover,
.afs-ticket-card:focus-visible {
	border-color: var(--afs-border-gold);
	background: var(--afs-bg-hover);
	transform: translateY(-1px);
	outline: none;
}

.afs-ticket-card__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.7rem;
	height: 2.7rem;
	flex: 0 0 2.7rem;
	border: 1px solid rgba(243, 186, 47, 0.28);
	border-radius: 0.7rem;
	background: rgba(243, 186, 47, 0.1);
	color: var(--afs-gold);
}

.afs-ticket-card__content {
	min-width: 0;
	flex: 1 1 auto;
}

.afs-ticket-card__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.afs-ticket-card h2 {
	min-width: 0;
	margin: 0;
	overflow: hidden;
	color: var(--afs-text);
	font-size: 0.84rem;
	font-weight: 800;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.afs-ticket-card p {
	margin: 0.35rem 0 0.6rem;
	overflow: hidden;
	color: var(--afs-muted);
	font-size: 0.7rem;
	line-height: 1.8;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.afs-ticket-card footer {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.8rem;
	color: var(--afs-muted);
	font-size: 0.64rem;
}

.afs-ticket-card footer span {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.afs-ticket-card footer .afs-icon {
	width: 0.85rem;
	height: 0.85rem;
	flex-basis: 0.85rem;
	color: var(--afs-gold);
}

.afs-ticket-card__arrow {
	color: var(--afs-gold);
}

.afs-status,
.afs-priority {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 1.55rem;
	padding: 0.2rem 0.55rem;
	border-radius: 99rem;
	font-size: 0.63rem;
	font-weight: 700;
	white-space: nowrap;
}

.afs-status--afs_open,
.afs-status--afs_in_progress {
	background: rgba(243, 186, 47, 0.12);
	color: var(--afs-gold-light);
}

.afs-status--afs_waiting_user {
	background: rgba(102, 164, 255, 0.12);
	color: #94beff;
}

.afs-status--afs_answered {
	background: rgba(243, 186, 47, 0.18);
	color: var(--afs-gold-light);
}

.afs-status--afs_resolved {
	background: rgba(32, 216, 137, 0.12);
	color: var(--afs-success);
}

.afs-status--afs_closed {
	background: rgba(151, 169, 194, 0.12);
	color: var(--afs-muted);
}

.afs-priority--urgent,
.afs-priority--high {
	color: var(--afs-danger);
}

.afs-priority--normal {
	color: var(--afs-gold);
}

.afs-priority--low {
	color: var(--afs-muted);
}

.afs-ticket-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.45rem;
}

.afs-empty-state {
	display: flex;
	align-items: center;
	flex-direction: column;
	justify-content: center;
	min-height: 14rem;
	padding: 2rem 1rem;
	border: 1px dashed var(--afs-border);
	border-radius: 0.8rem;
	text-align: center;
}

.afs-empty-state__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3.2rem;
	height: 3.2rem;
	margin-bottom: 0.75rem;
	border: 1px solid var(--afs-border-gold);
	border-radius: 0.8rem;
	background: rgba(243, 186, 47, 0.08);
	color: var(--afs-gold);
}

.afs-empty-state strong {
	font-size: 0.82rem;
}

.afs-empty-state p {
	max-width: 28rem;
	margin: 0.45rem 0 0;
	color: var(--afs-muted);
	font-size: 0.72rem;
	line-height: 1.9;
}

.afs-pagination {
	margin-top: 1rem;
}

.afs-pagination ul {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.afs-pagination a,
.afs-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.1rem;
	height: 2.1rem;
	padding: 0.2rem 0.55rem;
	border: 1px solid var(--afs-border);
	border-radius: 0.45rem;
	color: var(--afs-muted);
	font-size: 0.7rem;
	text-decoration: none;
}

.afs-pagination .current,
.afs-pagination a:hover,
.afs-pagination a:focus-visible {
	border-color: var(--afs-border-gold);
	background: rgba(243, 186, 47, 0.1);
	color: var(--afs-gold-light);
	outline: none;
}

.afs-form {
	border-color: rgba(243, 186, 47, 0.32);
	background: #0f1726;
	box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.18);
}

.afs-form-field input[type="text"],
.afs-form-field input[type="file"],
.afs-form-field select,
.afs-form-field textarea {
	border: 1px solid rgba(243, 186, 47, 0.32);
	background: #080d17;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.afs-form-field input::placeholder,
.afs-form-field textarea::placeholder {
	color: #77859a;
	opacity: 1;
}

.afs-form-field input[type="file"] {
	color: var(--afs-muted);
}

.afs-button--gold {
	border-color: #f3ba2f;
	background: linear-gradient(135deg, #ffe083, #f3ba2f);
	color: #111722 !important;
}

.afs-button--gold .afs-icon {
	color: #111722;
}

.afs-button--outline {
	border-color: rgba(243, 186, 47, 0.58);
	color: #ffd96a !important;
}

.afs-ticket-card {
	border-color: rgba(151, 169, 194, 0.28);
	background: #0d1522;
}

.afs-ticket-card__icon {
	border-color: rgba(243, 186, 47, 0.46);
	background: rgba(243, 186, 47, 0.13);
}

.afs-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}

.afs-form-field {
	margin: 0;
}

.afs-form-field--wide {
	grid-column: 1 / -1;
}

.afs-form-field label {
	display: block;
	margin-bottom: 0.4rem;
	color: var(--afs-text);
	font-size: 0.73rem;
	font-weight: 700;
}

.afs-form-field input[type="text"],
.afs-form-field input[type="file"],
.afs-form-field select,
.afs-form-field textarea {
	width: 100%;
	border: 1px solid var(--afs-border);
	border-radius: 0.55rem;
	background: var(--afs-bg);
	color: var(--afs-text);
	font: inherit;
	font-size: 0.75rem;
}

.afs-form-field input[type="text"],
.afs-form-field select,
.afs-form-field textarea {
	padding: 0.72rem 0.8rem;
}

.afs-form-field input[type="file"] {
	padding: 0.55rem;
}

.afs-form-field textarea {
	min-height: 10rem;
	resize: vertical;
}

.afs-form-field input:focus,
.afs-form-field select:focus,
.afs-form-field textarea:focus {
	border-color: var(--afs-gold);
	box-shadow: 0 0 0 0.2rem rgba(243, 186, 47, 0.08);
	outline: none;
}

.afs-form-field small {
	display: block;
	margin-top: 0.35rem;
	color: var(--afs-muted);
	font-size: 0.64rem;
}

.afs-form > .afs-button {
	margin-top: 1.15rem;
}

.afs-notice {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin-bottom: 1rem;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--afs-border);
	border-radius: 0.55rem;
	font-size: 0.72rem;
}

.afs-notice--success {
	border-color: rgba(32, 216, 137, 0.3);
	background: rgba(32, 216, 137, 0.08);
	color: var(--afs-success);
}

.afs-notice--error {
	border-color: rgba(255, 112, 122, 0.3);
	background: rgba(255, 112, 122, 0.08);
	color: var(--afs-danger);
}

.afs-conversation {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	margin-bottom: 1rem;
}

.afs-message {
	max-width: 88%;
	padding: 1rem;
	border: 1px solid rgba(151, 169, 194, 0.3);
	border-radius: 0.85rem;
	background: var(--afs-bg-soft);
}

.afs-message--user {
	align-self: flex-start;
	border-color: rgba(151, 169, 194, 0.23);
}

.afs-message--admin {
	align-self: flex-end;
	border-color: rgba(243, 186, 47, 0.3);
	background: rgba(45, 34, 12, 0.46);
}

.afs-message header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-bottom: 0.65rem;
	border-bottom: 1px solid var(--afs-border);
}

.afs-message header strong {
	color: var(--afs-gold-light);
	font-size: 0.75rem;
}

.afs-message header time {
	color: var(--afs-muted);
	font-size: 0.63rem;
}

.afs-message__body {
	color: var(--afs-text);
	font-size: 0.75rem;
	line-height: 2;
}

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

.afs-attachment {
	margin: 0.7rem 0 0;
}

.afs-attachment a {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	color: var(--afs-gold);
	font-size: 0.67rem;
	text-decoration: none;
}

.afs-attachment a:hover,
.afs-attachment a:focus-visible {
	color: var(--afs-gold-light);
	outline: none;
}

.afs-form-actions {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	flex-wrap: wrap;
}

.afs-close-form {
	margin-top: 0.7rem;
	text-align: left;
}

.afs-closed-notice {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.9rem 1rem;
	border: 1px solid rgba(32, 216, 137, 0.25);
	border-radius: 0.7rem;
	background: rgba(32, 216, 137, 0.06);
	color: var(--afs-success);
	font-size: 0.74rem;
}

.afs-login-notice {
	max-width: 38rem;
	margin: 2rem auto;
	padding: 2.2rem 1.5rem;
	border: 1px solid var(--afs-border);
	border-radius: 1rem;
	background: var(--afs-bg);
	text-align: center;
}

.afs-login-notice h2 {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
}

.afs-login-notice p {
	margin: 0 0 1rem;
	color: var(--afs-muted);
	font-size: 0.76rem;
}

@media (max-width: 680px) {
	.afs-page-heading {
		align-items: flex-start;
		flex-direction: column;
	}

	.afs-page-heading .afs-button {
		width: 100%;
	}

	.afs-form-grid {
		grid-template-columns: 1fr;
	}

	.afs-form-field--wide {
		grid-column: auto;
	}

	.afs-ticket-card {
		align-items: flex-start;
	}

	.afs-ticket-card__top {
		align-items: flex-start;
		flex-direction: column;
		gap: 0.35rem;
	}

	.afs-ticket-card h2,
	.afs-ticket-card p {
		white-space: normal;
	}

	.afs-ticket-card__arrow {
		margin-inline-start: auto;
	}

	.afs-message {
		max-width: 100%;
	}
}

/* Dashboard integration */
.afs-dashboard-ticket-panel {
	margin-top: 1rem;
	padding: 1rem;
	border: 1px solid var(--afs-border);
	border-radius: 0.9rem;
	background: rgba(11, 17, 28, 0.82);
}

.afs-dashboard-ticket-panel a,
.afs-portal a,
.afs-login-notice a {
	text-decoration: none;
}

.afs-dashboard-ticket-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.8rem;
}

.afs-dashboard-ticket-panel__header h2 {
	margin: 0.3rem 0 0;
	color: var(--afs-text);
	font-size: 0.92rem;
}

.afs-dashboard-ticket-panel__header > a {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	color: var(--afs-gold);
	font-size: 0.68rem;
}

.afs-dashboard-ticket-list {
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.afs-dashboard-ticket-item {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.75rem;
	border: 1px solid rgba(151, 169, 194, 0.2);
	border-radius: 0.65rem;
	background: #0d1522;
	color: var(--afs-text);
	transition: border-color 180ms ease, background-color 180ms ease;
}

.afs-dashboard-ticket-item:hover,
.afs-dashboard-ticket-item:focus-visible {
	border-color: var(--afs-border-gold);
	background: var(--afs-bg-hover);
	outline: none;
}

.afs-dashboard-ticket-item > .afs-icon,
.afs-dashboard-ticket-item > svg:last-child {
	color: var(--afs-gold);
}

.afs-dashboard-ticket-item__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	flex: 0 0 2rem;
	border-radius: 0.5rem;
	background: rgba(243, 186, 47, 0.1);
	color: var(--afs-gold);
}

.afs-dashboard-ticket-item__content {
	display: flex;
	flex: 1 1 10rem;
	flex-direction: column;
	min-width: 0;
	gap: 0.15rem;
}

.afs-dashboard-ticket-item__content strong {
	overflow: hidden;
	font-size: 0.72rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.afs-dashboard-ticket-item__content small {
	color: var(--afs-muted);
	font-size: 0.62rem;
}

.afs-dashboard-ticket-item__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.35rem;
}

.afs-dashboard-ticket-item__meta .afs-status,
.afs-dashboard-ticket-item__meta .afs-priority {
	font-size: 0.58rem;
}

.afs-dashboard-ticket-item > .afs-icon:last-child {
	width: 1rem;
	height: 1rem;
	flex: 0 0 1rem;
}

.afs-dashboard-ticket-empty {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.7rem;
	border: 1px dashed var(--afs-border);
	border-radius: 0.65rem;
}

.afs-dashboard-ticket-empty > span {
	color: var(--afs-gold);
}

.afs-dashboard-ticket-empty p {
	flex: 1;
	margin: 0;
	color: var(--afs-muted);
	font-size: 0.7rem;
}

@media (max-width: 680px) {
	.afs-dashboard-ticket-panel__header {
		align-items: flex-start;
		flex-direction: column;
	}

	.afs-dashboard-ticket-item {
		align-items: flex-start;
		flex-wrap: wrap;
	}

	.afs-dashboard-ticket-item__meta {
		width: 100%;
		padding-inline-start: 2.65rem;
		justify-content: flex-start;
	}

	.afs-dashboard-ticket-empty {
		align-items: flex-start;
		flex-wrap: wrap;
		flex-direction: column;
	}

	.afs-dashboard-ticket-empty .afs-button {
		width: 100%;
	}
}

.afs-ticket-detail__heading {
	align-items: flex-start;
	padding-bottom: 1rem;
	border-bottom: 1px solid rgba(151, 169, 194, 0.16);
}

.afs-ticket-detail__heading-main {
	min-width: 0;
	flex: 1 1 auto;
}

.afs-ticket-detail__heading .afs-back-link {
	margin-bottom: 0.85rem;
	padding: 0.35rem 0;
}

.afs-ticket-detail__heading .afs-eyebrow {
	display: flex;
}

.afs-ticket-detail__heading h1 {
	margin-top: 0.35rem;
}

.afs-ticket-detail__heading .afs-ticket-meta {
	padding-top: 2rem;
}

.afs-status,
.afs-priority {
	gap: 0.3rem;
}

.afs-status strong,
.afs-priority strong {
	font-weight: 800;
}

.afs-status span,
.afs-priority span {
	font-weight: 600;
}

@media (max-width: 680px) {
	.afs-ticket-detail__heading .afs-ticket-meta {
		width: 100%;
		padding-top: 0;
		justify-content: flex-start;
	}
}
