/* Profile page — theme-aware modern layout */
.profile-page {
	--pf-bg: transparent;
	--pf-surface: #1a1a1a;
	--pf-surface-elevated: #272727;
	--pf-border: #393d40;
	--pf-text: #f1f1f1;
	--pf-text-muted: #9ca3af;
	--pf-input-bg: #121212;
	--pf-input-border: #393d40;
	--pf-input-focus: var(--lm-accent, #0d0dff);
	--pf-accent: var(--lm-accent, #0d0dff);
	--pf-accent-hover: var(--lm-accent-hover, #0b0bcc);
	--pf-on-accent: #ffffff;
	--pf-success-bg: rgba(34, 197, 94, 0.14);
	--pf-success-text: #4ade80;
	--pf-error-bg: rgba(239, 68, 68, 0.14);
	--pf-error-text: #f87171;
	--pf-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
	--pf-radius-lg: 20px;
	--pf-radius-md: 12px;
	--pf-radius-sm: 10px;
	color: var(--pf-text);
}

body.light-mode .profile-page {
	--pf-surface: #ffffff;
	--pf-surface-elevated: #f8fafc;
	--pf-border: #d8dee9;
	--pf-text: #0f172a;
	--pf-text-muted: #64748b;
	--pf-input-bg: #f8fafc;
	--pf-input-border: #c5ced8;
	--pf-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}

.profile-page.custom-profile-container {
	display: grid;
	grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
	gap: 24px;
	max-width: none;
	width: 100%;
	margin: 0;
	padding: 0;
	direction: rtl;
	align-items: start;
}

.profile-page .profile-sidebar {
	width: auto;
	background: var(--pf-surface);
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-radius-lg);
	padding: 28px 20px;
	text-align: center;
	box-shadow: var(--pf-shadow);
	position: sticky;
	top: 88px;
	z-index: 2;
	display: flex;
	flex-direction: column;
}

.profile-page .profile-avatar {
	position: relative;
	width: 120px;
	height: 120px;
	margin: 0 auto 16px;
	cursor: pointer;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid var(--pf-border);
	transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-page .profile-avatar:hover,
.profile-page .profile-avatar:focus-visible {
	border-color: var(--pf-accent);
	transform: scale(1.04);
	box-shadow: 0 0 0 4px rgba(65, 64, 255, 0.25);
	outline: none;
}

.profile-page .profile-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	box-shadow: none;
}

.profile-page .avatar-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	opacity: 0;
	transition: opacity 0.2s ease, background-color 0.2s ease;
	z-index: 1;
	text-align: center;
	padding: 8px;
	line-height: 1.3;
}

.profile-page .profile-avatar:hover .avatar-overlay,
.profile-page .profile-avatar:focus-visible .avatar-overlay,
.profile-page .profile-avatar.is-uploading .avatar-overlay,
.profile-page .profile-avatar.is-saved .avatar-overlay,
.profile-page .profile-avatar.is-error .avatar-overlay {
	opacity: 1;
}

.profile-page .profile-avatar.is-uploading {
	pointer-events: none;
	cursor: wait;
	border-color: var(--pf-accent);
}

.profile-page .profile-avatar.is-uploading img {
	opacity: 0.55;
	filter: saturate(0.85);
}

.profile-page .profile-avatar.is-uploading::after {
	content: '';
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	border: 2px solid transparent;
	border-top-color: #ffffff;
	border-right-color: rgba(255, 255, 255, 0.35);
	animation: pf-avatar-spin 0.75s linear infinite;
	z-index: 2;
	pointer-events: none;
}

.profile-page .profile-avatar.is-saved {
	border-color: var(--pf-success-text);
	box-shadow: 0 0 0 4px var(--pf-success-bg);
	animation: pf-avatar-saved-pop 0.9s ease;
}

.profile-page .profile-avatar.is-saved .avatar-overlay {
	background: rgba(22, 101, 52, 0.72);
}

.profile-page .profile-avatar.is-error {
	border-color: var(--pf-error-text);
	box-shadow: 0 0 0 4px var(--pf-error-bg);
	animation: pf-avatar-error-shake 0.55s ease;
}

.profile-page .profile-avatar.is-error .avatar-overlay {
	background: rgba(127, 29, 29, 0.7);
}

@keyframes pf-avatar-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes pf-avatar-saved-pop {
	0% {
		transform: scale(1);
	}
	35% {
		transform: scale(1.06);
	}
	100% {
		transform: scale(1);
	}
}

@keyframes pf-avatar-error-shake {
	0%,
	100% {
		transform: translateX(0);
	}
	20% {
		transform: translateX(-3px);
	}
	40% {
		transform: translateX(3px);
	}
	60% {
		transform: translateX(-2px);
	}
	80% {
		transform: translateX(2px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.profile-page .profile-avatar.is-uploading::after {
		animation: none;
		border-color: rgba(255, 255, 255, 0.55);
		border-top-color: #ffffff;
	}

	.profile-page .profile-avatar.is-saved,
	.profile-page .profile-avatar.is-error {
		animation: none;
	}
}

.profile-page .profile-name {
	margin: 0 0 24px;
	font-size: 18px;
	font-weight: 700;
	color: var(--pf-text) !important;
}

.profile-page .profile-tabs {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.profile-page .profile-tabs .tab-btn {
	padding: 12px 16px;
	width: 100%;
	text-align: right;
	border: 1px solid transparent;
	background: transparent;
	border-radius: var(--pf-radius-md);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
	color: var(--pf-text) !important;
}

.profile-page .profile-tabs .tab-btn:hover:not(.active),
.profile-page .profile-tabs .tab-btn:focus-visible:not(.active) {
	background: rgba(255, 255, 255, 0.08) !important;
	color: var(--pf-text) !important;
	outline: none;
}

.profile-page .profile-tabs .tab-btn.active {
	background: var(--pf-accent) !important;
	color: var(--pf-on-accent) !important;
	border-color: var(--pf-accent);
	box-shadow: 0 4px 14px rgba(65, 64, 255, 0.35);
}

.profile-page .profile-sidebar-actions {
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--pf-border);
}

.profile-page .profile-logout-btn {
	display: block;
	width: 100%;
	padding: 12px 16px;
	text-align: right;
	border: 1px solid rgba(239, 68, 68, 0.35);
	background: rgba(239, 68, 68, 0.1);
	border-radius: var(--pf-radius-md);
	font-size: 14px;
	font-weight: 600;
	color: var(--pf-error-text) !important;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.profile-page .profile-logout-btn:hover,
.profile-page .profile-logout-btn:focus-visible {
	background: rgba(239, 68, 68, 0.18);
	border-color: rgba(239, 68, 68, 0.55);
	color: #fca5a5 !important;
	outline: none;
}

.profile-page .profile-content {
	flex: 1;
	background: var(--pf-surface);
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-radius-lg);
	padding: 28px 32px 32px;
	box-shadow: var(--pf-shadow);
	min-width: 0;
}

.profile-page .tab-panel-header {
	margin-bottom: 28px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--pf-border);
}

.profile-page .tab-panel-title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
	color: var(--pf-text) !important;
}

.profile-page .tab-panel-desc {
	margin: 0;
	font-size: 14px;
	color: var(--pf-text-muted) !important;
	line-height: 1.6;
}

.profile-page .tab-content {
	display: none;
	animation: pf-fade-in 0.2s ease;
}

.profile-page .tab-content.active {
	display: block;
}

@keyframes pf-fade-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.profile-page .custom-profile-form {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.profile-page .cpf-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px 24px;
	margin-bottom: 8px;
}

.profile-page .cpf-field {
	position: relative;
	margin-bottom: 0;
}

.profile-page .cpf-field--full {
	grid-column: 1 / -1;
}

.profile-page .cpf-field label,
.profile-page .cpf-field .cpf-field-label {
	position: static;
	display: block;
	margin-bottom: 8px;
	padding: 0;
	color: var(--pf-text-muted) !important;
	font-size: 13px;
	font-weight: 600;
	text-align: right;
}

.profile-page .cpf-field input {
	padding: 0 16px;
	border-radius: var(--pf-radius-md);
	width: 100%;
	height: 48px;
	border: 1px solid var(--pf-input-border);
	background: var(--pf-input-bg);
	color: var(--pf-text) !important;
	font-size: 15px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-page .cpf-field input::placeholder {
	color: var(--pf-text-muted);
	opacity: 0.7;
}

.profile-page .cpf-field input:focus {
	border-color: var(--pf-input-focus);
	box-shadow: 0 0 0 3px rgba(65, 64, 255, 0.2);
}

.profile-page .cpf-field input[readonly] {
	cursor: not-allowed;
	background: var(--pf-input-bg-muted, rgba(255, 255, 255, 0.04));
	color: var(--pf-text-muted) !important;
	border-color: var(--pf-border);
	box-shadow: none;
}

.profile-page .cpf-field input[readonly]:focus {
	border-color: var(--pf-border);
	box-shadow: none;
}

.profile-page .cpf-field-value {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0 16px;
	border-radius: var(--pf-radius-md);
	width: 100%;
	min-height: 48px;
	border: 1px solid var(--pf-border);
	background: var(--pf-input-bg-muted, rgba(255, 255, 255, 0.04));
	color: var(--pf-text) !important;
	font-size: 15px;
	line-height: 1.5;
	user-select: text;
}

.profile-page .cpf-field-value--empty {
	color: var(--pf-text-muted) !important;
}

.profile-page .cpf-contact-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.profile-page .cpf-contact-head .cpf-field-label {
	margin-bottom: 0;
}

.profile-page .cpf-link-btn {
	border: none;
	background: transparent;
	color: var(--pf-accent) !important;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	padding: 4px 0;
	text-decoration: none;
}

.profile-page .cpf-link-btn:hover,
.profile-page .cpf-link-btn:focus-visible {
	text-decoration: underline;
	outline: none;
}

.profile-page .cpf-contact-panel {
	margin-top: 14px;
	padding: 16px;
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-radius-md);
	background: var(--pf-surface-elevated);
}

.profile-page .cpf-grid--nested {
	margin-bottom: 0;
	gap: 16px;
}

.profile-page .cpf-contact-hint {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.6;
	color: var(--pf-text-muted) !important;
}

.profile-page .cpf-field-hint {
	display: block;
	margin: 10px 0 0;
	padding: 0;
	max-width: 42rem;
	color: var(--pf-text-muted) !important;
	font-size: 12.5px !important;
	font-weight: 500 !important;
	line-height: 1.7 !important;
	text-align: right !important;
	direction: rtl;
	opacity: 0.92;
}

.profile-page .cpf-contact-hint strong {
	color: var(--pf-text) !important;
	font-weight: 700;
}

.profile-page .cpf-contact-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

.profile-page .cpf-btn--sm {
	min-width: 0;
	height: 42px;
	padding: 0 18px;
	font-size: 14px;
	box-shadow: none;
}

.profile-page .cpf-btn--ghost {
	background: transparent !important;
	color: var(--pf-text-muted) !important;
	border: 1px solid var(--pf-border) !important;
	box-shadow: none;
}

.profile-page .cpf-btn--ghost:hover,
.profile-page .cpf-btn--ghost:focus-visible {
	background: var(--pf-input-bg) !important;
	color: var(--pf-text) !important;
	transform: none;
	box-shadow: none;
}

.profile-page .cpf-btn.is-busy,
.profile-page .cpf-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

.profile-page .cpf-field-ltr {
	direction: ltr;
	text-align: left;
}

.profile-page .cpf-password-field__control {
	position: relative;
	direction: ltr;
}

.profile-page .cpf-password-field__control input[type="password"],
.profile-page .cpf-password-field__control input[type="text"] {
	width: 100%;
	box-sizing: border-box;
	direction: ltr;
	text-align: left;
	padding-left: 48px;
	padding-right: 16px;
}

.profile-page .cpf-password-toggle {
	position: absolute;
	top: 50%;
	left: 8px;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	border: 0 !important;
	border-radius: 8px;
	background: transparent !important;
	color: var(--pf-text-muted);
	opacity: 0.7;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.profile-page .cpf-password-toggle:hover,
.profile-page .cpf-password-toggle:focus-visible {
	opacity: 1;
	color: var(--pf-text);
	background: rgba(65, 64, 255, 0.1) !important;
	outline: none;
}

.profile-page .cpf-password-toggle__icon {
	display: inline-flex;
	line-height: 0;
}

.profile-page .cpf-password-toggle__icon[hidden] {
	display: none !important;
}

.profile-page .cpf-otp-digits {
	display: flex;
	gap: 8px;
	direction: ltr;
	justify-content: flex-start;
}

.profile-page .cpf-otp-digit {
	width: 44px;
	height: 48px;
	padding: 0;
	text-align: center;
	font-size: 18px;
	font-weight: 700;
	border-radius: var(--pf-radius-sm);
	border: 1px solid var(--pf-input-border);
	background: var(--pf-input-bg);
	color: var(--pf-text) !important;
	outline: none;
}

.profile-page .cpf-otp-digit:focus {
	border-color: var(--pf-input-focus);
	box-shadow: 0 0 0 3px rgba(65, 64, 255, 0.2);
}

.profile-page .cpf-contact-flash {
	margin-bottom: 20px;
}

.profile-page .cpf-actions {
	display: flex;
	justify-content: flex-start;
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid var(--pf-border);
}

.profile-page .cpf-btn {
	width: auto;
	min-width: 180px;
	height: 48px;
	padding: 0 28px;
	background: var(--pf-accent) !important;
	color: var(--pf-on-accent) !important;
	border: none !important;
	border-radius: var(--pf-radius-md);
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
	box-shadow: 0 4px 14px rgba(65, 64, 255, 0.3);
}

.profile-page .cpf-btn:hover,
.profile-page .cpf-btn:focus-visible {
	background: var(--pf-accent-hover) !important;
	color: var(--pf-on-accent) !important;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(65, 64, 255, 0.4);
	outline: none;
}

.profile-page .cpf-btn:active {
	transform: translateY(0);
}

.profile-page .cpf-success {
	background: var(--pf-success-bg);
	color: var(--pf-success-text) !important;
	padding: 14px 18px;
	border-radius: var(--pf-radius-md);
	margin-bottom: 20px;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	border: 1px solid rgba(74, 222, 128, 0.25);
}

.profile-page .cpf-error {
	background: var(--pf-error-bg);
	color: var(--pf-error-text) !important;
	padding: 14px 18px;
	border-radius: var(--pf-radius-md);
	margin-bottom: 20px;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	border: 1px solid rgba(248, 113, 113, 0.25);
}

.profile-page .profile-shell-status {
	margin: 2rem auto;
	text-align: center;
	font-size: 15px;
	opacity: 0.75;
}

.profile-page .cpf-contact-flash.cpf-success,
.profile-page .cpf-contact-flash.cpf-error {
	display: block;
}

/* Saved items tab — theme overrides */
.profile-page .saved-items-panel {
	margin-top: 4px;
}

.profile-page .saved-filter-btn {
	border: 1px solid var(--pf-border);
	background: var(--pf-input-bg);
	color: var(--pf-text-muted) !important;
	border-radius: var(--pf-radius-sm);
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.15s ease;
}

.profile-page .saved-filter-btn:hover,
.profile-page .saved-filter-btn.active {
	background: var(--pf-accent) !important;
	color: var(--pf-on-accent) !important;
	border-color: var(--pf-accent);
}

.profile-page .content-card {
	--cc-border: var(--pf-border);
	--cc-title: var(--pf-text);
	--cc-muted: var(--pf-text-muted);
	--cc-remove-bg: var(--pf-input-bg);
	--cc-remove-fg: var(--pf-text-muted);
	--cc-bg: var(--pf-surface-elevated);
}

body.light-mode .profile-page .content-card {
	--cc-remove-bg: #a1acb2;
	--cc-remove-fg: #0f172a;
}

.profile-page .saved-items-grid .content-card__title,
.profile-page .saved-items-grid .content-card .content-card__title.elementor-heading-title {
	color: var(--pf-text) !important;
	font-size: clamp(13px, 1.5vw, 16px) !important;
	font-weight: 700 !important;
	line-height: 1.4 !important;
}

.profile-page .saved-items-grid .content-card__excerpt {
	font-size: clamp(12px, 1.4vw, 13px);
	line-height: 1.55;
}

.profile-page .content-card__title,
.profile-page .content-card .content-card__title.elementor-heading-title {
	color: var(--pf-text) !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.45 !important;
}

.profile-page .content-card__badge {
	font-size: 12px !important;
	font-weight: 600 !important;
	padding: 5px 10px !important;
	color: var(--pf-accent) !important;
	background: rgba(65, 64, 255, 0.14) !important;
}

.profile-page .saved-items-empty {
	color: var(--pf-text-muted) !important;
}

@media (max-width: 1023px) {
	.profile-page.custom-profile-container {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.profile-page .profile-sidebar {
		position: static;
		padding: 24px 20px;
	}

	.profile-page .profile-tabs {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px;
	}

	.profile-page .profile-tabs .tab-btn {
		flex: 1 1 calc(50% - 4px);
		min-width: 0;
		text-align: center;
		font-size: 13px;
		padding: 10px 12px;
	}
}

@media (max-width: 639px) {
	.profile-account {
		padding-block: 16px 32px;
	}

	.profile-page .profile-content {
		padding: 20px 16px 24px;
	}

	.profile-page .profile-sidebar {
		padding: 20px 16px;
	}

	.profile-page .cpf-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.profile-page .cpf-actions,
	.profile-page .cpf-contact-actions {
		justify-content: stretch;
	}

	.profile-page .cpf-btn,
	.profile-page .cpf-contact-actions .cpf-btn {
		width: 100%;
		min-width: 0;
	}

	.profile-page .cpf-otp-digit {
		flex: 1 1 0;
		width: auto;
		min-width: 0;
	}

	.profile-page .profile-tabs .tab-btn {
		flex: 1 1 100%;
	}
}
