/**
 * Falta design system, as used by FlowSync.
 *
 * Token names, scales, radii, shadows and component rules come from
 * flowsync/src/styles.css. The accent is Resala's own.
 *
 * Tokens land on .resala-ui and on the roots this plugin already emits, so a
 * block picks the system up without every renderer growing another class.
 * Nothing is set on :root: these styles sit inside a WordPress admin screen or
 * somebody else's theme and must not leak either way.
 */

.resala-ui,
#resala-admin,
.resala-form,
.resala-apply,
.resala-portal,
.resala-notice,
.resala-errors,
.resala-received,
.resala-transfer,
.resala-programmes,
.resala-scholarship {
	--bg: #f4f6f8;
	--bg-2: #eef2f5;
	--surface: #fff;
	--surface-alt: #f7f9fa;
	--surface-hover: #f0f4f6;
	--border: #d8dfe6;
	--border-strong: #c3ccd4;
	--rule: #eaeef2;
	--text: #10161d;
	--text-2: #33414f;
	--muted: #64748b;
	--muted-2: #8b98a8;
	--accent: #0d6e5c;
	--accent-2: #0f8069;
	--accent-soft: #e3f3ef;
	--accent-ink: #08594a;
	--accent-ring: rgba(13, 110, 92, .16);
	--on-accent: #fff;
	--success: #1d5c32;
	--success-soft: #e9f6ed;
	--success-line: #52a76a;
	--warning: #7c5312;
	--warning-soft: #fdf5e9;
	--warning-line: #e0aa5f;
	--error: #8f2320;
	--error-soft: #fceceb;
	--error-line: #d05a55;
	--info: #1f4e7a;
	--info-soft: #eaf2fa;
	--shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
	--shadow-md: 0 4px 12px rgba(16, 24, 40, .06);
	--shadow-lg: 0 12px 32px -18px rgba(16, 24, 40, .35);
	--radius: 10px;
	--radius-sm: 7px;
	--radius-lg: 14px;
	--row-pad-y: 13px;
	--sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Dark is opt-in through the admin's theme switch. Public pages never set the
   attribute, so they stay light inside a dark theme rather than half-matching
   a surrounding page that is not ours. */
:root[data-resala-theme='dark'] .resala-ui,
:root[data-resala-theme='dark'] #resala-admin {
	--bg: #0e1317;
	--bg-2: #131a20;
	--surface: #171e24;
	--surface-alt: #1c252c;
	--surface-hover: #212b33;
	--border: #35444d;
	--border-strong: #46575f;
	--rule: #26323a;
	--text: #eaf1ef;
	--text-2: #c7d3d2;
	--muted: #97a6a6;
	--muted-2: #7c8b8b;
	--accent: #5fc4ad;
	--accent-2: #7ad3bf;
	--accent-soft: #143830;
	--accent-ink: #a5e6d7;
	--accent-ring: rgba(95, 196, 173, .2);
	--on-accent: #06231d;
	--success: #bfe6cb;
	--success-soft: #142d1c;
	--success-line: #57a46e;
	--warning: #f0dab2;
	--warning-soft: #33280f;
	--warning-line: #c9974f;
	--error: #f0c9c7;
	--error-soft: #331a19;
	--error-line: #c96762;
	--info: #c3dcf5;
	--info-soft: #14283a;
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
	--shadow-md: 0 4px 12px rgba(0, 0, 0, .4);
	--shadow-lg: 0 12px 32px -12px rgba(0, 0, 0, .6);
}

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

.resala-btn,
.resala-table-scroll,
.resala-pill {
	box-sizing: border-box;
}

.resala-btn {
	align-items: center;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
	color: var(--text-2);
	cursor: pointer;
	display: inline-flex;
	font: 600 13px/1 var(--sans);
	gap: 6px;
	padding: 10px 14px;
	text-decoration: none;
	transition: background .12s, border-color .12s, transform .05s;
	white-space: nowrap;
}

.resala-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.resala-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: 0; }
.resala-btn:active { transform: translateY(.5px); }
.resala-btn:disabled { box-shadow: none; cursor: not-allowed; opacity: .45; }

.resala-btn--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.resala-btn--accent:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.resala-btn--quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.resala-btn--quiet:hover { background: var(--surface-hover); color: var(--text); }
.resala-btn--danger { background: var(--error); border-color: var(--error); color: #fff; }
.resala-btn--danger:hover { background: #741c1a; border-color: #741c1a; color: #fff; }
.resala-btn--quiet-danger { color: var(--error); }
.resala-btn--quiet-danger:hover { background: var(--error-soft); border-color: var(--error-line); color: var(--error); }
.resala-btn--sm { font-size: 11.5px; padding: 5px 10px; }
.resala-btn--block { display: flex; justify-content: center; width: 100%; }

/* ─── Tables ─────────────────────────────────────────────────────────── */

.resala-table-scroll {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow-x: auto;
}

.resala-table { border-collapse: collapse; min-width: 640px; width: 100%; }

.resala-table th,
.resala-table td {
	border-bottom: 1px solid var(--rule);
	font: 13px/1.5 var(--sans);
	padding: var(--row-pad-y) 16px;
	text-align: left;
	vertical-align: middle;
}

.resala-table thead th {
	background: var(--surface-alt);
	border-bottom: 1px solid var(--border);
	color: var(--muted);
	font: 600 10.5px/1 var(--sans);
	letter-spacing: .06em;
	text-transform: uppercase;
}

.resala-table tbody th { font-weight: 600; }
.resala-table tbody tr:hover td, .resala-table tbody tr:hover th { background: var(--surface-hover); }
.resala-table tbody tr:last-child th, .resala-table tbody tr:last-child td { border-bottom: 0; }
.resala-table tr.is-selected { background: var(--accent-soft); }
.resala-table .is-numeric { font-variant-numeric: tabular-nums; text-align: right; }

/* ─── Tabs ───────────────────────────────────────────────────────────── */

/* The active tab is a filled block, not an underline. */
.resala-tabs {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 999px;
	display: inline-flex;
	gap: 2px;
	padding: 3px;
}

.resala-tabs > * {
	background: none;
	border: 0;
	border-radius: 999px;
	color: var(--muted);
	cursor: pointer;
	font: 600 13px/1 var(--sans);
	padding: 9px 16px;
	text-decoration: none;
}

.resala-tabs > *:hover { color: var(--text); }
.resala-tabs > .is-active { background: var(--accent-soft); color: var(--accent-ink); }
.resala-tabs > *:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); outline: 0; }

/* ─── Status pills ───────────────────────────────────────────────────── */

.resala-pill {
	align-items: center;
	background: var(--surface-alt);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--muted);
	display: inline-flex;
	font: 600 11px/1 var(--sans);
	gap: 6px;
	padding: 5px 10px;
	white-space: nowrap;
}

.resala-pill--ok { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.resala-pill--warn { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.resala-pill--bad { background: var(--error-soft); border-color: var(--error-line); color: var(--error); }
.resala-pill--accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
