/* Student Profile Manager - frontend search and popup. All rules are scoped to avoid theme and Elementor conflicts. */

.spm-app, .spm-popup {
	--spm-blue: #006fdc;
	--spm-blue-dark: #0057ad;
	--spm-blue-soft: #e8f2fd;
	--spm-black: #000000;
	--spm-white: #ffffff;
	--spm-muted: #5b5f66;
	--spm-border: #e3e6ea;
	font-family: inherit;
	line-height: 1.5;
	color: var(--spm-black);
}
.spm-app *, .spm-app *::before, .spm-app *::after,
.spm-popup *, .spm-popup *::before, .spm-popup *::after { box-sizing: border-box; }

.spm-app { width: 100%; max-width: 760px; margin: 0 auto; }
.spm-app .spm-card { background: var(--spm-white); border: 1px solid var(--spm-border); border-radius: 14px; box-shadow: 0 4px 24px rgba(0, 0, 0, .06); padding: 28px; }
.spm-app .spm-heading { margin: 0 0 8px; padding: 0; font-size: 26px; line-height: 1.25; font-weight: 700; color: var(--spm-black); text-align: left; }
.spm-app .spm-intro { color: var(--spm-muted); margin: 0 0 16px; font-size: 15px; }
.spm-app .spm-intro p { margin: 0 0 8px; }
.spm-app .spm-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.spm-app .spm-search-form { margin: 16px 0 0; padding: 0; }
.spm-app .spm-search-row { position: relative; display: flex; gap: 10px; align-items: stretch; }
.spm-app .spm-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--spm-muted); display: flex; pointer-events: none; }
.spm-app input.spm-search-input {
	flex: 1; min-width: 0; width: auto; height: 52px; margin: 0; padding: 0 16px 0 44px;
	border: 2px solid var(--spm-border); border-radius: 10px; background: #fff; color: var(--spm-black);
	font-size: 16px; font-family: inherit; box-shadow: none; outline: none; -webkit-appearance: none; appearance: none;
}
.spm-app input.spm-search-input:focus { border-color: var(--spm-blue); box-shadow: 0 0 0 3px rgba(0, 111, 220, .15); }

.spm-app .spm-btn, .spm-popup .spm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 52px; margin: 0; padding: 0 24px; border-radius: 10px; border: 2px solid transparent;
	font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1; text-decoration: none; text-transform: none; letter-spacing: normal;
	cursor: pointer; box-shadow: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.spm-app .spm-btn-primary, .spm-popup .spm-btn-primary { background: var(--spm-blue); border-color: var(--spm-blue); color: var(--spm-white); }
.spm-app .spm-btn-primary:hover, .spm-app .spm-btn-primary:focus, .spm-popup .spm-btn-primary:hover, .spm-popup .spm-btn-primary:focus { background: var(--spm-blue-dark); border-color: var(--spm-blue-dark); color: var(--spm-white); }
.spm-app .spm-btn:focus-visible, .spm-popup .spm-btn:focus-visible { outline: 3px solid var(--spm-black); outline-offset: 2px; }
.spm-app .spm-btn[disabled] { opacity: .7; cursor: wait; }

.spm-app .spm-status { margin-top: 14px; font-size: 15px; color: var(--spm-muted); min-height: 0; }
.spm-app .spm-status:empty { display: none; }
.spm-app .spm-status.is-error { color: var(--spm-black); background: #f5f7fa; border-left: 4px solid var(--spm-blue); padding: 12px 14px; border-radius: 6px; }
.spm-app .spm-loading { display: inline-flex; align-items: center; gap: 10px; }
.spm-app .spm-spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--spm-blue-soft); border-top-color: var(--spm-blue); animation: spm-spin .8s linear infinite; }
@keyframes spm-spin { to { transform: rotate(360deg); } }

.spm-app .spm-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #f5f7fa; border-left: 4px solid var(--spm-blue); border-radius: 6px; padding: 14px 16px; margin-top: 12px; }

.spm-app .spm-results { margin-top: 10px; }
.spm-app .spm-results:empty { display: none; }
.spm-app .spm-results-title { font-size: 15px; color: var(--spm-muted); margin: 6px 0 10px; }
.spm-app .spm-result-list { list-style: none; margin: 0; padding: 0; }
.spm-app .spm-result-list li { margin: 0 0 8px; padding: 0; list-style: none; }
.spm-app .spm-result-list li::before { display: none; content: none; }
.spm-app button.spm-result {
	display: flex; align-items: center; gap: 14px; width: 100%; margin: 0; padding: 12px 14px; text-align: left;
	background: #fff; border: 1px solid var(--spm-border); border-radius: 10px; color: var(--spm-black);
	font-family: inherit; font-size: 15px; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: normal; line-height: 1.4;
}
.spm-app button.spm-result:hover, .spm-app button.spm-result:focus { border-color: var(--spm-blue); background: #fafcff; color: var(--spm-black); outline: none; box-shadow: 0 0 0 3px rgba(0, 111, 220, .12); }
.spm-app .spm-result-avatar, .spm-popup .spm-avatar { flex: none; border-radius: 50%; background: var(--spm-blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.spm-app .spm-result-avatar { width: 44px; height: 44px; font-size: 15px; }
.spm-app .spm-result-avatar img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; }
.spm-app .spm-result-text { flex: 1; min-width: 0; }
.spm-app .spm-result-name { display: block; font-weight: 700; }
.spm-app .spm-result-id { display: block; color: var(--spm-muted); font-size: 14px; }
.spm-app .spm-result-cta { color: var(--spm-blue); font-weight: 600; font-size: 14px; white-space: nowrap; }
.spm-app .spm-more-note { color: var(--spm-muted); font-size: 14px; margin: 8px 0 0; }

/* Popup */
.spm-popup { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.spm-popup[hidden] { display: none; }
.spm-popup-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.spm-popup-dialog { position: relative; width: 100%; max-width: 820px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); display: flex; flex-direction: column; overflow: hidden; }
.spm-popup-close {
	position: absolute; top: 14px; right: 14px; z-index: 2; width: 40px; height: 40px; margin: 0; padding: 0;
	border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer;
	display: flex; align-items: center; justify-content: center; box-shadow: none;
}
.spm-popup-close:hover, .spm-popup-close:focus { background: var(--spm-blue); color: #fff; outline: none; }
.spm-popup-content { overflow-y: auto; -webkit-overflow-scrolling: touch; }
body.spm-popup-open { overflow: hidden; }

.spm-popup .spm-profile-head { display: flex; align-items: center; gap: 20px; padding: 28px 64px 28px 28px; background: var(--spm-black); color: #fff; }
.spm-popup .spm-avatar { width: 108px; height: 108px; border: 3px solid var(--spm-blue); }
.spm-popup .spm-avatar img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; max-width: none; }
.spm-popup .spm-avatar span { color: #fff; font-size: 36px; font-weight: 700; }
.spm-popup .spm-profile-title h2 { margin: 0 0 4px; padding: 0; font-size: 26px; line-height: 1.2; color: #fff; font-weight: 700; }
.spm-popup .spm-profile-id { margin: 0; color: #cfd8e3; font-size: 15px; }
.spm-popup .spm-profile-id strong { color: #fff; }
.spm-popup .spm-profile-body { padding: 8px 28px 24px; }
.spm-popup .spm-section { margin-top: 20px; }
.spm-popup .spm-section h3 { margin: 0 0 12px; padding: 0 0 8px; font-size: 13px; line-height: 1.3; text-transform: uppercase; letter-spacing: .06em; color: var(--spm-blue); border-bottom: 2px solid var(--spm-blue-soft); font-weight: 700; }
.spm-popup .spm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; padding: 0; }
.spm-popup .spm-section-notes .spm-grid { grid-template-columns: 1fr; }
.spm-popup .spm-item { border: 1px solid var(--spm-border); border-radius: 10px; padding: 12px 14px; margin: 0; }
.spm-popup .spm-item dt { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--spm-muted); }
.spm-popup .spm-item dd { margin: 0; padding: 0; font-size: 15px; color: var(--spm-black); overflow-wrap: anywhere; }
.spm-popup .spm-item dd p { margin: 0 0 8px; }
.spm-popup .spm-item dd p:last-child { margin-bottom: 0; }
.spm-popup .spm-item a { color: var(--spm-blue); text-decoration: underline; }
.spm-popup .spm-chip { display: inline-block; padding: 3px 10px; margin: 2px 2px 2px 0; border-radius: 99px; background: var(--spm-blue-soft); color: var(--spm-blue); font-weight: 600; font-size: 14px; }
.spm-popup .spm-empty { color: #8a8f96; }
.spm-popup .spm-field-image { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.spm-popup .spm-profile-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 16px 28px; background: #fff; border-top: 1px solid var(--spm-border); }

@media (max-width: 600px) {
	.spm-app .spm-card { padding: 20px 16px; border-radius: 12px; }
	.spm-app input.spm-search-input { font-size: 16px; padding-left: 40px; padding-right: 10px; }
	.spm-app input.spm-search-input::placeholder { font-size: 14px; }
	.spm-app .spm-search-icon { left: 12px; }
	.spm-app button.spm-result { min-height: 64px; }
	.spm-popup .spm-profile-head { gap: 10px; }
	.spm-app .spm-heading { font-size: 22px; }
	.spm-app .spm-search-row { flex-direction: column; }
	.spm-app input.spm-search-input { flex: none; width: 100%; }
	.spm-app .spm-search-icon { top: 26px; }
	.spm-app .spm-search-btn { width: 100%; }
	.spm-app .spm-result-cta { display: none; }
	.spm-popup { padding: 0; align-items: flex-end; }
	.spm-popup-dialog { max-height: 94vh; max-height: 94dvh; border-radius: 16px 16px 0 0; }
	.spm-popup .spm-profile-head { flex-direction: column; text-align: center; padding: 22px 56px 18px; }
	.spm-popup .spm-avatar { width: 80px; height: 80px; }
	.spm-popup .spm-avatar span { font-size: 28px; }
	.spm-popup .spm-grid { grid-template-columns: 1fr; gap: 8px; }
	.spm-popup-close { top: 10px; right: 10px; width: 44px; height: 44px; }
	.spm-popup .spm-profile-title h2 { font-size: 22px; }
	.spm-popup .spm-profile-body { padding: 4px 16px 20px; }
	.spm-popup .spm-profile-foot { padding: 12px 16px; }
	.spm-popup .spm-profile-foot .spm-btn { width: 100%; }
}

@media (max-width: 380px) {
	.spm-app .spm-heading { font-size: 20px; }
	.spm-app .spm-card { padding: 16px 12px; }
}
