/* AFED Member Portal - standalone front-end styling, no WP admin/theme dependency. */

:root {
	/* Overridden per-site via AFED Manager > Dashboard > Portal Branding
	   (see AFED_Portal_Router::print_theme_style()) - these are just the
	   defaults if nothing has been configured yet. */
	--afed-primary: #1e2a45;
	--afed-primary-light: #2c3b5c;
	--afed-accent: #2271b1;
	--afed-accent-dark: #195a8d;
}

* { box-sizing: border-box; }

body.afed-portal {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: #f4f5f7;
	color: #1d2327;
	line-height: 1.5;
}

.afed-portal-header {
	background: var(--afed-primary);
	color: #fff;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 28px;
	flex-wrap: wrap;
	gap: 10px;
	box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.afed-portal-brand {
	display: inline-flex;
	align-items: center;
	font-size: 18px;
	font-weight: 600;
	color: #fff;
	text-decoration: none;
}

.afed-portal-brand span {
	font-weight: 400;
	opacity: 0.75;
	margin-left: 6px;
	font-size: 14px;
}

.afed-portal-brand-logo img {
	max-height: 38px;
	width: auto;
	display: block;
}

.afed-portal-nav {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
}

.afed-portal-nav a {
	color: #cfd6e4;
	text-decoration: none;
	font-size: 14px;
	padding: 8px 2px;
	border-bottom: 2px solid transparent;
	transition: color 0.15s ease;
}

.afed-portal-nav a:hover {
	color: #fff;
}

.afed-portal-nav a.active {
	color: #fff;
	border-bottom-color: var(--afed-accent);
}

.afed-portal-nav a.afed-portal-logout {
	color: #f3b6b6;
}

.afed-portal-main {
	max-width: 1100px;
	margin: 0 auto;
	padding: 32px 24px 60px;
}

.afed-portal-main h1 {
	margin: 0 0 6px;
	font-size: 26px;
}

.afed-portal-lead {
	color: #646970;
	margin: 0 0 24px;
}

.afed-portal-account-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 18px;
}

.afed-portal-account-badge {
	display: inline-block;
	background: #eef4fc;
	color: var(--afed-primary);
	border: 1px solid #cddcf0;
	border-radius: 999px;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 600;
}

.afed-portal-cards {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 20px;
}

.afed-portal-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 20px 24px;
	min-width: 140px;
	box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.afed-portal-card-number {
	display: block;
	font-size: 32px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--afed-primary);
}

.afed-portal-card-label {
	display: block;
	color: #646970;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .04em;
	margin-top: 4px;
}

.afed-portal-quick-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 32px;
}

.afed-portal-quick-actions .afed-btn {
	margin-top: 0;
}

.afed-portal-columns {
	display: flex;
	gap: 28px;
	align-items: flex-start;
	flex-wrap: wrap;
}

.afed-portal-column-main {
	flex: 2;
	min-width: 280px;
	overflow-x: auto;
}

.afed-portal-column-side {
	flex: 1;
	min-width: 260px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 20px 24px;
}

.afed-portal-column-side h2 {
	margin-top: 0;
	font-size: 17px;
}

/* ---------------------------------------------------------------------
   Uniform form styling - applies to every form anywhere in the portal
   (Add/Edit School, Add Branch, Host an Event, Link a User, Login,
   Register...), not just the ones inside a sidebar column. Previously
   this block-display/spacing treatment only applied inside
   .afed-portal-column-side, which is why the Edit School page and the
   Events "Host a New Event" form (both rendered elsewhere on the page)
   showed every label/field crammed onto one line - fixed by scoping this
   to .afed-portal-main instead, plus a visual pass (rounder inputs, a
   focus ring, consistent spacing, styled checkboxes/selects) so every
   form on the platform now looks the same, deliberately, in one place.
------------------------------------------------------------------------ */
.afed-portal-main form label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	color: #3c434a;
	margin: 18px 0 6px;
}

.afed-portal-main form label:first-of-type {
	margin-top: 0;
}

.afed-portal-main form input[type="text"],
.afed-portal-main form input[type="email"],
.afed-portal-main form input[type="password"],
.afed-portal-main form input[type="number"],
.afed-portal-main form input[type="url"],
.afed-portal-main form input[type="date"],
.afed-portal-main form input[type="datetime-local"],
.afed-portal-main form select,
.afed-portal-main form textarea {
	display: block;
	width: 100%;
	max-width: 480px;
	padding: 10px 14px;
	border: 1px solid #d5d8dc;
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	color: #1d2327;
	background-color: #fff;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.afed-portal-main form select {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23646970'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	padding-right: 36px;
}

.afed-portal-main form textarea {
	resize: vertical;
	min-height: 70px;
}

.afed-portal-main form input:focus,
.afed-portal-main form select:focus,
.afed-portal-main form textarea:focus {
	border-color: var(--afed-accent);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
	outline: none;
}

.afed-portal-main form input:disabled {
	background-color: #f0f0f1;
	color: #8c8f94;
	cursor: not-allowed;
}

/* Checkbox rows (School Type, Remember Me) get a bit more breathing room
   and a slightly larger, easier-to-tap box - these deliberately don't
   inherit the block/max-width treatment above, since a checkbox sitting
   on its own line looks worse, not better. */
.afed-portal-main form input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--afed-accent);
	vertical-align: middle;
}

.afed-portal-hint {
	color: #646970;
	font-size: 12px;
	margin: 4px 0 0;
}

.afed-btn {
	display: inline-block;
	margin-top: 18px;
	padding: 10px 20px;
	border-radius: 6px;
	border: 1px solid var(--afed-accent);
	background: #fff;
	color: var(--afed-accent);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.afed-btn:hover {
	background: var(--afed-accent);
	color: #fff;
}

.afed-btn-primary {
	background: var(--afed-accent);
	color: #fff;
}

.afed-btn-primary:hover {
	background: var(--afed-accent-dark);
	border-color: var(--afed-accent-dark);
	color: #fff;
}

.afed-btn-small {
	margin-top: 8px;
	padding: 5px 12px;
	font-size: 13px;
}


.afed-portal-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	overflow: hidden;
}

.afed-portal-table th,
.afed-portal-table td {
	text-align: left;
	padding: 10px 14px;
	border-bottom: 1px solid #eee;
	font-size: 14px;
}

.afed-portal-table th {
	background: #f6f7f8;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: #646970;
}

.afed-portal-tree, .afed-portal-tree ul {
	list-style: none;
	margin: 0 0 0 20px;
	padding: 0;
}

.afed-portal-tree {
	margin-left: 0;
}

.afed-portal-tree li {
	margin: 6px 0;
}

/* Collapsible tree: children hidden by default, shown only when the
   parent <li> carries .is-expanded (added/removed by portal.js). */
.afed-portal-tree-children {
	display: none;
}

.afed-portal-tree-item.is-expanded > .afed-portal-tree-children {
	display: block;
}

.afed-portal-tree-toggle {
	background: #f0f0f1;
	border: 1px solid #dcdcde;
	border-radius: 50%;
	width: 26px;
	height: 26px;
	padding: 0;
	margin: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--afed-accent);
	flex-shrink: 0;
}

.afed-portal-tree-toggle:hover {
	background: var(--afed-accent);
	color: #fff;
}

.afed-portal-tree-toggle-icon {
	display: block;
	transition: transform 0.15s ease;
}

.afed-portal-tree-item.is-expanded > .afed-portal-node .afed-portal-tree-toggle-icon {
	transform: rotate(90deg);
}

.afed-portal-node {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 10px 14px;
	flex-wrap: wrap;
}

.afed-portal-node-level {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .04em;
	background: #f0f0f1;
	border-radius: 3px;
	padding: 2px 6px;
	color: #50575e;
}

.afed-portal-node code {
	white-space: nowrap;
}

.afed-portal-node-state .afed-portal-node-level { background: var(--afed-primary); color: #fff; }
.afed-portal-node-chapter .afed-portal-node-level { background: #72aee6; color: #fff; }
.afed-portal-node-zone .afed-portal-node-level { background: #d5e5f5; color: #1d2327; }

.afed-portal-badge {
	font-size: 11px;
	border-radius: 3px;
	padding: 2px 6px;
}

.afed-portal-badge-active { background: #edfaef; color: #1a7f37; }
.afed-portal-badge-inactive { background: #fcf0f1; color: #a02b2b; }
.afed-portal-badge-pending { background: #fef6e7; color: #9a6700; }

.afed-portal-inline-edit-form {
	margin: 6px 0 6px 20px;
}

.afed-portal-inline-edit-form input[type="text"] {
	padding: 5px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
}

.afed-portal-deactivate-link {
	color: #b32d2e;
}

.afed-portal-notice {
	padding: 12px 16px;
	border-radius: 6px;
	margin-bottom: 20px;
	font-size: 14px;
}

.afed-portal-notice-success {
	background: #edfaef;
	color: #1a7f37;
	border: 1px solid #b8e6c1;
}

.afed-portal-notice-error {
	background: #fcf0f1;
	color: #a02b2b;
	border: 1px solid #f0c2c2;
}

.afed-portal-notice-pending {
	background: #fef6e7;
	color: #9a6700;
	border: 1px solid #f5ddaa;
}

.afed-portal-pending-list {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 16px 20px;
	margin: 0;
}

.afed-portal-honeypot {
	position: absolute;
	left: -9999px;
	top: -9999px;
}

.afed-portal-main-narrow {
	max-width: 640px;
}

.afed-portal-register-form {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 24px 28px 32px;
}

.afed-portal-register-form h3 {
	margin: 24px 0 4px;
	font-size: 15px;
	border-top: 1px solid #eee;
	padding-top: 20px;
}

.afed-portal-register-form h3:first-of-type {
	border-top: none;
	padding-top: 0;
}

.afed-reg-school-type-row {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 10px 0;
}

.afed-reg-checkbox-label {
	display: flex !important;
	align-items: center;
	gap: 6px;
	font-weight: normal !important;
	margin: 0 !important;
	min-width: 110px;
}

.afed-reg-checkbox-label input[type="checkbox"] {
	width: auto;
	margin: 0;
}

.afed-reg-school-type-row input[type="number"] {
	width: 140px;
}

.afed-reg-school-type-row input[type="number"]:disabled {
	background: #f0f0f1;
	color: #a7aaad;
}

.afed-portal-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------------
   Profile Details panel - Schools/EXCO "View Details" and the School
   account's own Dashboard profile card.
------------------------------------------------------------------------ */
.afed-profile-detail {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 20px 24px;
	margin-bottom: 28px;
}

.afed-profile-detail-header {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.afed-profile-detail-header h2 {
	margin: 0;
	font-size: 20px;
}

.afed-profile-detail-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px 24px;
	margin-bottom: 24px;
}

.afed-profile-field-wide {
	grid-column: 1 / -1;
}

.afed-profile-label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #646970;
	margin-bottom: 3px;
}

.afed-profile-value {
	display: block;
	font-size: 14px;
	color: #1d2327;
	word-break: break-word;
}

/* ---------------------------------------------------------------------
   Member Login page (/afed-portal/login/) - the front door for members,
   replacing wp-login.php in normal use.
------------------------------------------------------------------------ */
.afed-portal-login-form {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 28px 32px 32px;
}

.afed-portal-checkbox-label {
	display: flex !important;
	align-items: center;
	gap: 6px;
	font-weight: normal !important;
	margin: 14px 0 !important;
}

.afed-portal-checkbox-label input[type="checkbox"] {
	width: auto;
}

.afed-portal-login-links {
	margin-top: 20px;
	font-size: 13px;
	color: #646970;
}

.afed-portal-login-links a {
	color: var(--afed-accent);
	text-decoration: none;
}

/* ---------------------------------------------------------------------
   Mobile breakpoint (phones and small tablets).
------------------------------------------------------------------------ */
@media (max-width: 680px) {
	.afed-portal-header {
		padding: 12px 16px;
	}

	.afed-portal-brand {
		font-size: 16px;
	}

	.afed-portal-nav {
		gap: 12px 16px;
		width: 100%;
	}

	.afed-portal-nav a {
		font-size: 13px;
		padding: 8px 2px; /* taller tap target on touch screens */
	}

	.afed-portal-main {
		padding: 20px 16px 40px;
	}

	.afed-portal-main h1 {
		font-size: 21px;
	}

	.afed-portal-cards {
		gap: 10px;
	}

	.afed-portal-card {
		flex: 1 1 calc(50% - 10px);
		min-width: 120px;
		padding: 14px 16px;
	}

	.afed-portal-card-number {
		font-size: 24px;
	}

	.afed-portal-columns {
		flex-direction: column;
		gap: 20px;
	}

	.afed-portal-column-main,
	.afed-portal-column-side {
		min-width: 0;
		width: 100%;
	}

	.afed-portal-column-side {
		padding: 16px 18px;
	}

	.afed-portal-node {
		font-size: 13px;
		gap: 6px;
		padding: 10px;
	}

	.afed-portal-node strong {
		flex-basis: 100%;
	}

	.afed-portal-inline-edit-form {
		margin-left: 0;
	}

	.afed-portal-inline-edit-form input[type="text"] {
		width: 100%;
		max-width: 260px;
	}

	.afed-portal-table th,
	.afed-portal-table td {
		padding: 8px 10px;
		font-size: 13px;
	}

	.afed-btn {
		width: 100%;
		text-align: center;
	}

	.afed-btn-small {
		width: auto;
	}

	.afed-portal-quick-actions {
		flex-direction: column;
	}

	.afed-portal-quick-actions .afed-btn {
		width: 100%;
	}

	.afed-portal-register-form,
	.afed-portal-login-form,
	.afed-portal-column-side {
		padding-left: 16px;
		padding-right: 16px;
	}

	.afed-profile-detail-grid {
		grid-template-columns: 1fr;
	}
}

/* Required-field marker, kept consistent with the wp-admin version. */
.afed-required {
	color: #b32d2e;
}

/* ---------------------------------------------------------------------
   Multi-branch dashboard (branch switcher + Add Another Branch).
------------------------------------------------------------------------ */
.afed-portal-branch-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

.afed-portal-branch-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 14px 18px;
	flex-wrap: wrap;
}

.afed-portal-branch-card.is-active {
	border-color: var(--afed-accent);
	box-shadow: 0 0 0 1px var(--afed-accent);
}

.afed-portal-branch-card form {
	margin: 0;
}

.afed-portal-add-branch {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 16px 20px;
	margin-top: 8px;
}

.afed-portal-add-branch summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--afed-accent);
}

.afed-portal-add-branch form {
	margin-top: 16px;
}
