/*!
 * `[hafdz_profile]` dashboard — visual language matched to hafdz-donations
 * (cream surfaces, deep-green accent, Inter Tight + JetBrains Mono).
 *
 * All tokens live under `.hafdz-profile` so the shortcode renders the same
 * regardless of the surrounding theme.
 */

.hafdz-profile {
	--hp-bg:            #fafaf7;
	--hp-surface:       #ffffff;
	--hp-surface-2:     #f5f4ef;
	--hp-border:        #e8e6df;
	--hp-border-strong: #d8d5cc;
	--hp-ink:           #1a1a17;
	--hp-ink-2:         #4a4a44;
	--hp-ink-3:         #8a8880;
	--hp-ink-4:         #b8b6ad;
	--hp-accent:        #0d5c4a;
	--hp-accent-hover:  #0a4a3b;
	--hp-accent-soft:   #e6efec;
	--hp-accent-ink:    #073128;
	--hp-warm-soft:     #f6ecd9;
	--hp-warm-ink:      #8a5a1f;
	--hp-success:       #2e7d5b;
	--hp-danger:        #b3261e;
	--hp-danger-soft:   #fbe9e7;

	--hp-radius-sm: 6px;
	--hp-radius-md: 10px;

	--hp-font-sans: "Inter Tight", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--hp-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	color: var(--hp-ink);
	font-family: var(--hp-font-sans);
	font-size: 14px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	font-feature-settings: "ss01", "cv11";

	/* No outer max-width — the host page template (e.g. .wrap) decides
	 * how wide the profile dashboard sits. Mirrors .hafdz-dua-wall and
	 * .ziswaf-projects so all hafdz shortcodes fill their column. */
	margin: 32px 0;
	width: 100%;
}

.hafdz-profile *,
.hafdz-profile *::before,
.hafdz-profile *::after { box-sizing: border-box; }

/* ─── Dashboard layout ────────────────────────────────────────── */

.hafdz-profile--dashboard {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: 20px;
	align-items: start;
}

.hafdz-profile__sidebar {
	position: sticky;
	top: 24px;
	background: var(--hp-surface);
	border: 1px solid var(--hp-border);
	border-radius: var(--hp-radius-md);
	overflow: hidden;
}

.hafdz-profile__user {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 18px 16px;
	background: var(--hp-surface-2);
	border-bottom: 1px solid var(--hp-border);
}
.hafdz-profile__user-avatar {
	width: 44px; height: 44px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--hp-border-strong);
	background: var(--hp-surface);
}
.hafdz-profile__user-info { min-width: 0; }
.hafdz-profile__user-name {
	font-size: 14px; font-weight: 600;
	color: var(--hp-ink);
	letter-spacing: -0.005em;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hafdz-profile__user-handle {
	font-family: var(--hp-font-mono);
	font-size: 11px;
	color: var(--hp-ink-3);
	letter-spacing: 0.02em;
}

.hafdz-profile__nav {
	display: flex; flex-direction: column;
	padding: 10px;
	gap: 1px;
}
.hafdz-profile__nav-item {
	display: flex; align-items: center; gap: 10px;
	padding: 9px 12px;
	border-radius: var(--hp-radius-sm);
	color: var(--hp-ink-2);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	transition: background 120ms ease, color 120ms ease;
}
.hafdz-profile__nav-item:hover { background: var(--hp-surface-2); color: var(--hp-ink); }
.hafdz-profile__nav-item.is-active {
	background: var(--hp-accent-soft);
	color: var(--hp-accent-ink);
}
.hafdz-profile__nav-icon {
	display: inline-flex; flex: 0 0 16px;
	line-height: 0;
	color: var(--hp-ink-3);
}
.hafdz-profile__nav-item.is-active .hafdz-profile__nav-icon { color: var(--hp-accent); }
.hafdz-profile__nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hafdz-profile__sidebar-foot {
	border-top: 1px solid var(--hp-border);
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.hafdz-profile__nav-item--logout {
	color: var(--hp-ink-3);
}
.hafdz-profile__nav-item--logout:hover {
	background: var(--hp-danger-soft);
	color: var(--hp-danger);
}
.hafdz-profile__nav-item--logout:hover .hafdz-profile__nav-icon { color: var(--hp-danger); }

/* ─── Main panel ──────────────────────────────────────────────── */

.hafdz-profile__main { min-width: 0; }

.hafdz-profile__main-head {
	margin-bottom: 18px;
}
.hafdz-profile__main-eyebrow {
	font-family: var(--hp-font-mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hp-ink-3);
	font-weight: 500;
	margin-bottom: 6px;
}
.hafdz-profile__main-title {
	margin: 0 0 4px;
	font-size: 22px;
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.2;
	color: var(--hp-ink);
}
.hafdz-profile__main-sub {
	margin: 0;
	font-size: 13px;
	color: var(--hp-ink-3);
}
.hafdz-profile__main-body { display: grid; gap: 14px; }

/* ─── Notice ──────────────────────────────────────────────────── */

.hafdz-profile__notice {
	padding: 12px 14px;
	border-radius: var(--hp-radius-sm);
	margin-bottom: 14px;
	font-size: 13px;
	border: 1px solid transparent;
}
.hafdz-profile__notice.is-success { background: var(--hp-accent-soft); color: var(--hp-success); border-color: #b9dcc6; }
.hafdz-profile__notice.is-error   { background: var(--hp-danger-soft);  color: var(--hp-danger);  border-color: #f3c4c4; }

/* ─── Panel cards ─────────────────────────────────────────────── */

.hafdz-profile__panel {
	padding: 22px 24px;
	background: var(--hp-surface);
	border: 1px solid var(--hp-border);
	border-radius: var(--hp-radius-md);
}

.hafdz-profile__h3 {
	margin: 0 0 14px;
	font-family: var(--hp-font-mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hp-ink-3);
	font-weight: 500;
}

/* ─── Forms ───────────────────────────────────────────────────── */

.hafdz-profile__form { display: grid; gap: 14px; }
.hafdz-profile__form label {
	display: grid; gap: 6px;
	font-size: 12px;
	color: var(--hp-ink-3);
	font-weight: 500;
}
.hafdz-profile__form input,
.hafdz-profile__form textarea {
	padding: 10px 12px;
	border: 1px solid var(--hp-border-strong);
	border-radius: var(--hp-radius-sm);
	background: var(--hp-surface);
	font-family: inherit;
	font-size: 14px;
	color: var(--hp-ink);
	transition: border-color 120ms ease, box-shadow 120ms ease;
}
.hafdz-profile__form input:focus,
.hafdz-profile__form textarea:focus {
	outline: 0;
	border-color: var(--hp-accent);
	box-shadow: 0 0 0 3px var(--hp-accent-soft);
}
.hafdz-profile__form textarea { resize: vertical; min-height: 80px; }

/* ─── Buttons ────────────────────────────────────────────────── */

.hafdz-profile__btn {
	display: inline-flex; align-items: center; justify-content: center;
	gap: 6px;
	padding: 9px 16px;
	border: 1px solid var(--hp-accent);
	background: var(--hp-accent);
	color: #fff;
	border-radius: var(--hp-radius-sm);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.hafdz-profile__btn:hover {
	background: var(--hp-accent-hover);
	border-color: var(--hp-accent-hover);
	color: #fff;
}
.hafdz-profile__btn--ghost {
	background: transparent;
	color: var(--hp-ink-2);
	border-color: var(--hp-border-strong);
}
.hafdz-profile__btn--ghost:hover {
	background: var(--hp-surface-2);
	color: var(--hp-ink);
	border-color: var(--hp-border-strong);
}
.hafdz-profile__btn--danger {
	background: var(--hp-danger);
	border-color: var(--hp-danger);
	color: #fff;
}
.hafdz-profile__btn--danger:hover {
	background: #971e1a;
	border-color: #971e1a;
	color: #fff;
}
.hafdz-profile__btn:disabled { opacity: 0.6; cursor: progress; }

.hafdz-profile__hint {
	font-size: 12px;
	color: var(--hp-ink-3);
	margin: 4px 0 0;
}
.hafdz-profile__hint code {
	padding: 1px 5px;
	background: var(--hp-surface-2);
	border-radius: 3px;
	font-family: var(--hp-font-mono);
	font-size: 11px;
	color: var(--hp-accent-ink);
}

/* ─── Dashboard ───────────────────────────────────────────────── */

.hafdz-profile__welcome-line {
	margin: 0 0 4px;
	font-family: "Instrument Serif", Georgia, serif;
	font-size: 22px;
	font-weight: 400;
	letter-spacing: -0.005em;
	color: var(--hp-ink);
}
.hafdz-profile__welcome-line strong { font-weight: 500; }
.hafdz-profile__welcome-sub {
	margin: 0;
	color: var(--hp-ink-3);
	font-size: 13px;
}

.hafdz-profile__widgets {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 12px;
}
.hafdz-profile__widget {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 14px;
	background: var(--hp-surface-2);
	border: 1px solid var(--hp-border);
	border-radius: var(--hp-radius-sm);
	color: var(--hp-ink);
	text-decoration: none;
	transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
a.hafdz-profile__widget:hover {
	background: var(--hp-accent-soft);
	border-color: #b9d4cb;
	transform: translateY(-1px);
}
.hafdz-profile__widget-icon {
	flex: 0 0 32px;
	width: 32px; height: 32px;
	display: inline-flex;
	align-items: center; justify-content: center;
	background: var(--hp-surface);
	border: 1px solid var(--hp-border);
	border-radius: 50%;
	color: var(--hp-accent);
}
.hafdz-profile__widget-body { min-width: 0; }
.hafdz-profile__widget-label {
	font-family: var(--hp-font-mono);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hp-ink-3);
	font-weight: 500;
	margin-bottom: 4px;
}
.hafdz-profile__widget-value {
	font-size: 22px;
	font-weight: 600;
	letter-spacing: -0.015em;
	color: var(--hp-ink);
	font-variant-numeric: tabular-nums;
}
.hafdz-profile__widget-sub {
	font-size: 12px;
	color: var(--hp-ink-3);
	margin-top: 2px;
}

/* ─── Avatar ──────────────────────────────────────────────────── */

.hafdz-profile__avatar { display: flex; gap: 18px; align-items: flex-start; }
.hafdz-profile__avatar-img {
	width: 96px; height: 96px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--hp-border-strong);
	background: var(--hp-surface-2);
}
.hafdz-profile__avatar-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hafdz-profile__avatar-actions label.hafdz-profile__btn { cursor: pointer; }

/* ─── Danger zone ─────────────────────────────────────────────── */

.hafdz-profile__danger {
	background: var(--hp-danger-soft);
	border-color: #f3c4c4;
}
.hafdz-profile__danger .hafdz-profile__h3 { color: var(--hp-danger); }

/* ─── Devices list (rendered inside the auth-owned section) ─── */

.hafdz-profile__devices {
	list-style: none; margin: 0; padding: 0;
	display: grid; gap: 8px;
}
.hafdz-profile__devices-empty {
	padding: 14px 16px;
	color: var(--hp-ink-3);
	font-size: 13px;
	background: var(--hp-surface-2);
	border: 1px dashed var(--hp-border);
	border-radius: var(--hp-radius-sm);
}

.hafdz-profile__device {
	display: flex; align-items: center; gap: 16px;
	padding: 12px 14px;
	background: var(--hp-surface);
	border: 1px solid var(--hp-border);
	border-radius: var(--hp-radius-sm);
}
.hafdz-profile__device.is-current {
	background: var(--hp-accent-soft);
	border-color: #b9d4cb;
}
.hafdz-profile__device.is-revoked { opacity: 0.6; }
.hafdz-profile__device-main { flex: 1; min-width: 0; }
.hafdz-profile__device-name {
	font-size: 14px; font-weight: 600;
	color: var(--hp-ink);
	margin-bottom: 2px;
}
.hafdz-profile__device-meta {
	font-size: 12px;
	color: var(--hp-ink-3);
	font-variant-numeric: tabular-nums;
}
.hafdz-profile__device-actions { flex: 0 0 auto; }
.hafdz-profile__device-tag {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 500;
	color: var(--hp-accent);
	background: var(--hp-accent-soft);
	border-radius: 999px;
	vertical-align: middle;
}
.hafdz-profile__device-tag.is-muted {
	color: var(--hp-ink-3);
	background: var(--hp-surface-2);
}

/* ─── Guest state ─────────────────────────────────────────────── */

.hafdz-profile--guest {
	max-width: 480px;
	margin: 32px auto;
	padding: 32px;
	text-align: center;
	background: var(--hp-surface);
	border: 1px dashed var(--hp-border-strong);
	border-radius: var(--hp-radius-md);
	color: var(--hp-ink-2);
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 720px) {
	.hafdz-profile--dashboard {
		grid-template-columns: 1fr;
	}
	.hafdz-profile__sidebar {
		position: static;
	}
	.hafdz-profile__user {
		padding: 14px 16px;
	}
	.hafdz-profile__nav {
		flex-direction: row;
		overflow-x: auto;
		gap: 4px;
		padding: 8px;
		-webkit-overflow-scrolling: touch;
	}
	.hafdz-profile__nav-item {
		flex: 0 0 auto;
		padding: 7px 12px;
	}
	.hafdz-profile__sidebar-foot {
		flex-direction: row;
		padding: 8px;
		border-top: 1px solid var(--hp-border);
	}
	.hafdz-profile__nav-item--logout {
		flex: 0 0 auto;
		padding: 7px 12px;
	}
	.hafdz-profile__panel {
		padding: 18px;
	}
}
