/* ════════════════════════════════════════════════════════════════════════════
 * profile-modal.css — the redesigned dark profile / settings modal
 * (partials/_profile-modal.html). Loaded by that partial itself, so every
 * page that ships the modal automatically ships its styles.
 *
 * Self-contained on purpose: the modal appears on Docs, Notes, Assessments,
 * Tool Dev, Referrals AND admin — pages with wildly different legacy CSS —
 * so the overlay, card, fields, tabs and combobox are all (re)defined here,
 * scoped under #profileModal, and depend on nothing else.
 *
 * JS contract (js/profile.js + js/app.js) — do not rename ids/classes:
 *   .hidden toggles the overlay · .merr/.show errors · inline display on
 *   #profileSuc/#pwSuc/#pfAvatarImg/#pfAvatarInitials/#pfStrengthWrap ·
 *   tab colors set inline by switchProfileTab() · .icms-combobox handled
 *   by initCollegeCombo() (is-open / icms-combo-opt classes).
 * ══════════════════════════════════════════════════════════════════════════*/

#profileModal {
	--pfm-pad: 26px;
	position: fixed;
	inset: 0;
	z-index: 8600; /* above topbar chrome (120/200), below auth stack (9000+) */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	background: rgba(6, 11, 26, 0.74);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	overflow-y: auto;
	font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}
#profileModal.hidden { display: none !important; }

/* ── Card ── */
#profileModal .pfm-card {
	width: 100%;
	max-width: 560px;
	background: linear-gradient(180deg, #0a1228 0%, #11203f 100%);
	border: 1px solid rgba(212, 163, 90, 0.28);
	border-radius: 20px;
	box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
	overflow: hidden;
	animation: pfmPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pfmPop {
	from { transform: scale(0.94) translateY(10px); opacity: 0; }
	to   { transform: none; opacity: 1; }
}

/* ── Header: avatar + name + completeness + tabs ── */
#profileModal .pfm-head {
	position: relative;
	padding: 22px var(--pfm-pad) 0;
	background: rgba(255, 255, 255, 0.025);
	border-bottom: 1px solid rgba(212, 163, 90, 0.25);
}
#profileModal .pfm-close {
	position: absolute;
	top: 14px;
	right: 16px;
	z-index: 2;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 9px;
	color: #8fa1c7;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
#profileModal .pfm-close:hover { background: rgba(255, 255, 255, 0.16); color: #ffffff; }

#profileModal .pfm-identity {
	display: flex;
	align-items: flex-end;
	gap: 18px;
	margin-bottom: 18px;
}
#profileModal .pfm-avatar { position: relative; flex-shrink: 0; }
#profileModal .pfm-avatar > svg {
	position: absolute;
	top: -4px;
	left: -4px;
	pointer-events: none;
}
#profileModal #pfAvatarWrap {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid rgba(251, 191, 36, 0.45);
	cursor: pointer;
	position: relative;
	background: #1e293b;
	box-sizing: border-box;
}
#profileModal #pfAvatarImg { width: 100%; height: 100%; object-fit: cover; }
#profileModal #pfAvatarInitials {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	font-weight: 800;
	color: #fbbf24;
	line-height: 1;
}
#profileModal .pfm-avatar-hover {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	font-size: 18px;
	opacity: 0;
	transition: opacity 0.2s ease;
}
#profileModal #pfAvatarWrap:hover .pfm-avatar-hover { opacity: 1; }
#profileModal #pfCompletePct {
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	background: #fbbf24;
	color: #0f172a;
	font-size: 10px;
	font-weight: 800;
	padding: 2px 8px;
	border-radius: 20px;
	white-space: nowrap;
	border: 2px solid #0a1228;
}

#profileModal .pfm-title { flex: 1; min-width: 0; padding-bottom: 4px; }
#profileModal #profileModalTitle {
	margin: 0 0 3px;
	font-size: 18px;
	font-weight: 800;
	color: #fbbf24;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#profileModal #pfHeaderName { margin: 0 0 8px; font-size: 13px; color: #b7c4e0; font-weight: 500; }
#profileModal .pfm-progress { display: flex; align-items: center; gap: 8px; }
#profileModal .pfm-progress-track {
	flex: 1;
	height: 5px;
	background: rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	overflow: hidden;
}
#profileModal #pfCompleteBar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #f59e0b, #fbbf24);
	border-radius: 10px;
	transition: width 0.6s ease;
}
#profileModal #pfCompleteLabel { font-size: 10px; color: #8fa1c7; white-space: nowrap; font-weight: 600; }

/* Avatar upload progress (shown by js/profile.js while uploading) */
#profileModal #pfAvatarProgress { margin-bottom: 12px; }
#profileModal .pfm-upload-track {
	height: 3px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 4px;
	overflow: hidden;
}
#profileModal #pfAvatarProgressBar {
	height: 100%;
	width: 0;
	background: #fbbf24;
	border-radius: 4px;
	transition: width 0.3s ease;
}
#profileModal #pfAvatarProgressLabel {
	font-size: 11px;
	color: #8fa1c7;
	margin: 4px 0 0;
	text-align: center;
}

/* Tabs (active colors are re-applied inline by switchProfileTab) */
#profileModal .pfm-tabs {
	display: flex;
	margin: 0 calc(-1 * var(--pfm-pad));
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}
#profileModal .pfm-tabs button {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 8px;
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	color: #8fa1c7;
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: color 0.15s ease;
}
#profileModal .pfm-tabs button:hover { color: #e2e8f0; }

/* ── Scrollable body ── */
#profileModal .pfm-body { max-height: 65vh; overflow-y: auto; }
#profileModal .pfm-body::-webkit-scrollbar { width: 8px; }
#profileModal .pfm-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
#profileModal #profileTabPanel,
#profileModal #passwordTabPanel { padding: 22px var(--pfm-pad); }

/* ── Alerts ── */
#profileModal .merr {
	display: none;
	background: rgba(248, 113, 113, 0.1);
	border: 1px solid rgba(248, 113, 113, 0.35);
	border-radius: 10px;
	padding: 10px 14px;
	color: #fecaca;
	font-size: 12.5px;
	line-height: 1.6;
	margin-bottom: 12px;
}
#profileModal .merr.show { display: block; }
#profileModal .pfm-success {
	background: rgba(34, 197, 94, 0.1);
	border: 1px solid rgba(34, 197, 94, 0.35);
	border-radius: 10px;
	padding: 10px 14px;
	color: #86efac;
	font-size: 12.5px;
	margin-bottom: 12px;
	align-items: center;
	gap: 8px;
}

/* ── Completeness checklist ── */
#profileModal .pfm-checklist {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 16px;
}
#profileModal .pfm-checklist-title {
	font-size: 11px;
	font-weight: 700;
	color: #8fa1c7;
	margin: 0 0 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
#profileModal .pfm-checklist-title i { margin-right: 5px; color: #fbbf24; }
#profileModal #pfChecklistItems {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 12px;
	font-size: 11.5px;
}

/* ── Form fields ──
   The legacy sheets (modals.css / tweaks.css / responsive.css) style
   .mfield with !important for the old LIGHT modals, so the dark overrides
   here must also carry !important — the #profileModal id scope then wins
   on specificity. */
#profileModal .mfield { margin-bottom: 14px; }
#profileModal .mfield label {
	display: flex !important;
	align-items: center;
	gap: 7px;
	color: #c7d2ea !important;
	font-size: 11.5px !important;
	font-weight: 700 !important;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 6px;
}
#profileModal .mfield label i { color: #fbbf24 !important; font-size: 11px; }
#profileModal .mfield input,
#profileModal .mfield textarea {
	width: 100%;
	box-sizing: border-box;
	background: rgba(255, 255, 255, 0.05) !important;
	border: 1px solid rgba(255, 255, 255, 0.14) !important;
	border-radius: 10px !important;
	color: #ffffff !important;
	font-family: inherit;
	font-size: 13.5px !important;
	padding: 10px 12px !important;
	outline: none;
	transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
#profileModal .mfield input:focus,
#profileModal .mfield textarea:focus {
	border-color: rgba(251, 191, 36, 0.55) !important;
	background: rgba(255, 255, 255, 0.08) !important;
	box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12) !important;
}
#profileModal .mfield input::placeholder,
#profileModal .mfield textarea::placeholder { color: #5b6c93 !important; opacity: 1; }
#profileModal .mfield input[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
	background: rgba(255, 255, 255, 0.03) !important;
}
#profileModal .pfm-grid2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 6px;
}
#profileModal .pfm-grid2 .mfield { margin-bottom: 0; }
#profileModal .pfm-hint { font-size: 10px; color: #7f90b6; margin: 3px 0 0; }
#profileModal .pfm-hint--names { margin: 0 0 12px; padding-left: 2px; }
#profileModal .pfm-optional { font-weight: 400; color: #7f90b6; font-size: 11px; text-transform: none; letter-spacing: 0; }
#profileModal .pfm-count-row { display: flex; justify-content: flex-end; }
#profileModal #pfBioCount { font-size: 10px; color: #94a3b8; margin-top: 3px; }
#profileModal #pfBio { resize: vertical; min-height: 72px; max-height: 160px; }

/* ── Primary buttons ── */
#profileModal .mbtn {
	display: flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100% !important;
	margin-top: 18px;
	padding: 12px 16px !important;
	background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
	border: none !important;
	border-radius: 10px !important;
	color: #0f172a !important;
	font-family: inherit;
	font-size: 13px !important;
	font-weight: 800 !important;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.1s ease;
}
#profileModal .mbtn:hover { filter: brightness(1.07); }
#profileModal .mbtn:active { transform: translateY(1px); }
#profileModal .mbtn[disabled] { opacity: 0.6; cursor: wait; }

/* ── Password fields ── */
#profileModal .pw-wrap { position: relative; }
#profileModal .pw-wrap input { padding-right: 40px; }
#profileModal .pw-eye {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: #8fa1c7;
	font-size: 12px;
	cursor: pointer;
}
#profileModal .pw-eye:hover { color: #fbbf24; }
#profileModal .pfm-strength-track {
	height: 4px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.12);
	overflow: hidden;
}
#profileModal #pfStrengthBar {
	height: 100%;
	width: 0;
	border-radius: 4px;
	transition: width 0.3s ease, background 0.3s ease;
}
#profileModal #pfStrengthLabel { font-size: 10px; color: #8fa1c7; margin-top: 3px; }
#profileModal #pfMatchMsg { font-size: 10px; margin-top: 3px; }
#profileModal .pfm-reqs {
	background: rgba(59, 130, 246, 0.08);
	border: 1px solid rgba(59, 130, 246, 0.3);
	border-radius: 10px;
	padding: 10px 14px;
	margin-top: 14px;
	font-size: 11px;
	color: #93c5fd;
	line-height: 1.9;
}
#profileModal .pfm-reqs strong { display: block; margin-bottom: 4px; font-size: 12px; color: #bfdbfe; }
#profileModal .pfm-reqs span { display: block; }

/* ── Institution combobox (driven by initCollegeCombo in js/app.js) ── */
#profileModal .icms-combobox { position: relative; }
#profileModal .icms-combobox input { padding-right: 34px; }
#profileModal .icms-combobox-caret {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: #8fa1c7;
	font-size: 11px;
	pointer-events: none;
}
#profileModal .icms-combobox-list {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 30;
	max-height: 210px;
	overflow-y: auto;
	background: #0d1830;
	border: 1px solid rgba(212, 163, 90, 0.3);
	border-radius: 10px;
	box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
}
#profileModal .icms-combobox.is-open .icms-combobox-list { display: block; }
#profileModal .icms-combo-opt {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 12.5px;
	color: #e2e8f0;
}
#profileModal .icms-combo-opt:hover,
#profileModal .icms-combo-opt.is-active { background: rgba(251, 191, 36, 0.12); }
#profileModal .icms-combo-opt b { color: #fbbf24; }
#profileModal .icms-combo-opt__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profileModal .icms-combo-opt__tag {
	flex-shrink: 0;
	font-size: 9.5px;
	font-weight: 700;
	color: #8fa1c7;
	background: rgba(255, 255, 255, 0.07);
	border-radius: 999px;
	padding: 2px 8px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
#profileModal .icms-combo-opt__tag--poly { color: #fbbf24; background: rgba(251, 191, 36, 0.12); }
#profileModal .icms-combo-opt--other { color: #fbbf24; justify-content: flex-start; }
#profileModal .icms-combo-opt--other i { font-size: 10px; }
#profileModal .icms-combo-empty { padding: 10px 12px; font-size: 12px; color: #7f90b6; }

/* ── Phones: full-screen sheet ── */
@media (max-width: 560px) {
	#profileModal { padding: 0; align-items: stretch; }
	#profileModal .pfm-card {
		--pfm-pad: 18px;
		max-width: none;
		min-height: 100%;
		border-radius: 0;
		border: none;
		display: flex;
		flex-direction: column;
	}
	#profileModal .pfm-head { padding-top: 18px; }
	#profileModal .pfm-body { max-height: none; flex: 1; }
	#profileModal .pfm-grid2 { grid-template-columns: 1fr; }
}

/* ── Appearance picker (Tab 1) ─────────────────────────────────────────
   Three-way theme choice wired to js/theme.js (.icms-theme-opt +
   data-theme-choice). The modal is permanently dark-navy, so the base
   palette here matches the dark variant; css/dark.css re-pins the same
   look under the dark gate. */
#profileModal .pfm-theme-picker {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}
#profileModal .icms-theme-opt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 9px 8px;
	border-radius: 10px;
	background: #0f1828;
	border: 1px solid #33415c;
	color: #e6ebf5;
	font: inherit;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
#profileModal .icms-theme-opt i { color: #aab4cc; font-size: 13px; }
#profileModal .icms-theme-opt:hover { border-color: #4b5b78; }
#profileModal .icms-theme-opt.is-active {
	border-color: #d4a35a;
	background: rgba(212, 163, 90, 0.14);
	box-shadow: 0 0 0 3px rgba(212, 163, 90, 0.22);
}
#profileModal .icms-theme-opt.is-active i { color: #e3bd83; }
@media (max-width: 420px) {
	#profileModal .pfm-theme-picker { grid-template-columns: 1fr; }
}
