/* ==========================================================================
   CMI PEF theme
   Loaded after bulma.min.css and FormPages.css. Restyles the whole app
   (calm indigo, serif headlines, soft cards) without touching page markup.
   ========================================================================== */

:root {
	--ink: #0f1a33;
	--ink-2: #334155;
	--muted: #64748b;
	--line: #e4e7f1;
	--line-strong: #cfd4e6;
	--brand: #4338ca;
	--brand-600: #3730a3;
	--brand-500: #5146d9;
	--brand-50: #eef0ff;
	--brand-100: #e0e4ff;
	--mark: #5b2fd6;
	--accent: #c2410c;
	--good: #15803d;
	--warn: #b45309;
	--bad: #dc2626;
	--bg: #ffffff;
	--bg-soft: #f7f8fc;
	--night: #141537;
	--night-2: #1e2050;
	--radius: 14px;
	--radius-lg: 20px;
	--shadow-sm: 0 1px 2px rgba(15, 26, 51, 0.05), 0 1px 3px rgba(15, 26, 51, 0.06);
	--shadow: 0 10px 30px -12px rgba(30, 32, 80, 0.22), 0 2px 6px rgba(15, 26, 51, 0.05);
	--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--font-serif: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
}

html {
	scroll-behavior: smooth;
	-webkit-font-smoothing: antialiased;
}

body {
	font-family: var(--font-sans);
	color: var(--ink-2);
	background: var(--bg);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, .title {
	font-family: var(--font-serif);
	color: var(--ink);
	font-weight: 600;
	letter-spacing: -0.01em;
}
.subtitle { color: var(--muted); font-family: var(--font-sans); }
strong { color: var(--ink); }
.label { color: var(--ink); font-weight: 600; font-size: 0.875rem; }
.has-text-grey { color: var(--muted) !important; }

a { color: var(--brand); }
a:hover { color: var(--brand-600); text-decoration: none; }

/* ---------- Navbar ---------- */
.navbar,
header.navbar {
	background: rgba(255, 255, 255, 0.92) !important;
	backdrop-filter: saturate(1.4) blur(10px);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--line);
	position: sticky !important;
	top: 0;
	z-index: 1000;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 clamp(1rem, 3vw, 2.5rem) !important;
	min-height: 4rem;
	box-shadow: none;
}
.navbar > .navbar-brand,
.navbar > .navbar-menu { max-width: none; }
.navbar-item, .navbar-link {
	color: var(--muted);
	font-weight: 500;
	font-size: 0.95rem;
	border-radius: 8px;
}
a.navbar-item:hover, a.navbar-item:focus,
.navbar-link:hover, .navbar-item.has-dropdown:hover > .navbar-link {
	background: transparent !important;
	color: var(--ink) !important;
}
.navbar-item.is-active { color: var(--brand) !important; }
.navbar-dropdown {
	border: 1px solid var(--line);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 0.4rem;
	margin-top: 4px;
}
.navbar-dropdown .navbar-item { padding: 0.55rem 0.9rem; }
.navbar-dropdown a.navbar-item:hover { background: var(--brand-50) !important; color: var(--brand) !important; }
.navbar-brand .navbar-item { padding-left: 0; }
.navbar-menu { background: transparent; }
@media screen and (max-width: 1023px) {
	.navbar-menu {
		background: #fff;
		border: 1px solid var(--line);
		border-radius: 12px;
		box-shadow: var(--shadow);
		margin: 0 -0.25rem 0.75rem;
	}
	.navbar-burger { color: var(--ink); }
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	text-decoration: none !important;
}
.brand-mark {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 9px;
	background: var(--mark);
	color: #fff;
	font-size: 0.95rem;
	box-shadow: 0 4px 10px -3px rgba(91, 47, 214, 0.55);
}
.brand-word {
	font-family: var(--font-serif);
	font-weight: 600;
	font-size: 1.2rem;
	color: var(--ink);
	letter-spacing: -0.01em;
	line-height: 1;
}
.brand-word small {
	display: block;
	font-family: var(--font-sans);
	font-size: 0.62rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	margin-top: 4px;
}

/* ---------- Buttons ---------- */
button, .button, input[type="button"], input[type="submit"] {
	margin-top: 0;
}
.button {
	font-family: var(--font-sans);
	font-weight: 600;
	font-size: 0.95rem;
	border-radius: 10px;
	border: 1px solid var(--line-strong);
	color: var(--ink);
	background: #fff;
	box-shadow: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.button:focus:not(:active) { box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.2); border-color: var(--brand); }

.button.is-primary, .button.is-link, .button.is-info, .button.is-success {
	background: var(--brand);
	border-color: var(--brand);
	color: #fff;
}
.button.is-primary:hover, .button.is-link:hover, .button.is-info:hover, .button.is-success:hover {
	background: var(--brand-600);
	border-color: var(--brand-600);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 8px 18px -8px rgba(67, 56, 202, 0.7);
}
.button.is-primary.is-light, .button.is-link.is-light, .button.is-info.is-light, .button.is-success.is-light {
	background: var(--brand-50);
	border-color: var(--brand-100);
	color: var(--brand);
}
.button.is-primary.is-outlined, .button.is-link.is-outlined, .button.is-info.is-outlined, .button.is-success.is-outlined {
	background: transparent;
	border-color: var(--brand);
	color: var(--brand);
}
.button.is-primary.is-outlined:hover, .button.is-link.is-outlined:hover,
.button.is-info.is-outlined:hover, .button.is-success.is-outlined:hover {
	background: var(--brand);
	color: #fff;
}
.button.is-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.button.is-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.button.is-danger.is-light { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.button.is-warning { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.button.is-light, .button.is-white { background: var(--bg-soft); border-color: var(--line); color: var(--ink-2); }
.button[disabled], .button:disabled { opacity: 0.5; }

/* ---------- Forms ---------- */
.input, .textarea, .select select {
	border-radius: 10px;
	border: 1px solid var(--line-strong);
	background: #fff;
	color: var(--ink);
	box-shadow: none;
	font-family: var(--font-sans);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:hover, .textarea:hover, .select select:hover { border-color: #aab1cf; }
.input:focus, .textarea:focus, .select select:focus,
.input:active, .textarea:active, .select select:active {
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.16);
}
.input::placeholder, .textarea::placeholder { color: #94a3b8; }
.select:not(.is-multiple):not(.is-loading)::after { border-color: var(--brand); }
.control.has-icons-left .icon, .control.has-icons-right .icon { color: #94a3b8; }
input:required:invalid { border-color: var(--line-strong); }
input:required:valid { border-color: var(--line-strong); }
input:required:invalid:focus { border-color: var(--brand); }
.checkbox:hover, .radio:hover { color: var(--brand); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.help { color: var(--muted); }

/* ---------- Cards / boxes ---------- */
.box {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	color: var(--ink-2);
}
.box[style*="background-color"] { background: var(--bg-soft) !important; border-color: var(--line) !important; }
.card { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.ActionBox {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
}

/* ---------- Page canvas ---------- */
main { background: var(--bg-soft); }
main:has(.pef-landing) { background: #fff; }
.section { padding-top: 2.25rem; }
.title.is-3, .title.is-4 { font-weight: 600; }
.title.is-3 { font-size: 2rem; }

/* ---------- Tables ---------- */
.table {
	background: transparent;
	color: var(--ink-2);
}
.table thead th, thead th {
	background: var(--bg-soft) !important;
	color: var(--muted) !important;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--line) !important;
	border-width: 0 0 1px;
}
.table td, .table th { border-color: var(--line); vertical-align: middle; }
.table.is-striped tbody tr:not(.is-selected):nth-child(even) { background: #fafbfe; }
.table.is-hoverable tbody tr:not(.is-selected):hover,
.ClickableTable tbody tr:hover { background: var(--brand-50) !important; }
th:hover { background: inherit; }
.table-container { border-radius: var(--radius); }

/* ---------- Tags, notifications ---------- */
.tag { border-radius: 999px; font-weight: 600; }
.tag.is-info, .tag.is-link, .tag.is-primary { background: var(--brand-50); color: var(--brand); }
.tag.is-success { background: #dcfce7; color: #166534; }
.tag.is-warning { background: #fef3c7; color: #92400e; }
.tag.is-danger { background: #fee2e2; color: #991b1b; }
.tag.is-light { background: var(--bg-soft); color: var(--muted); }

.notification { border-radius: 12px; border: 1px solid transparent; }
.notification.is-danger.is-light { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.notification.is-success.is-light { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.notification.is-info, .notification.is-info.is-light { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-600); }
.notification.is-warning, .notification.is-warning.is-light { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- Modal ---------- */
.modal-background { background: rgba(20, 21, 55, 0.55); backdrop-filter: blur(3px); }
.modal-card { border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 30px 80px -20px rgba(20, 21, 55, 0.5); }
.modal-card-head { background: #fff; border-bottom: 1px solid var(--line); }
.modal-card-title { font-family: var(--font-serif); color: var(--ink); }
.modal-card-foot { background: var(--bg-soft); border-top: 1px solid var(--line); gap: 0.5rem; }

/* ---------- Hero (login etc.) ---------- */
.hero.is-success {
	background:
		radial-gradient(900px 420px at 85% -10%, rgba(91, 47, 214, 0.14), transparent 60%),
		radial-gradient(700px 380px at 0% 110%, rgba(194, 65, 12, 0.08), transparent 60%),
		linear-gradient(180deg, #fff 0%, var(--bg-soft) 100%);
	color: var(--ink-2);
}
.hero.is-success .box { box-shadow: var(--shadow); padding: 2rem; text-align: left; }
.hero.is-success .icon.is-large i { color: var(--mark) !important; }
.hero.is-success .title { color: var(--ink); }
.hero.is-success .subtitle { color: var(--muted); }

/* ---------- Misc ---------- */
hr { background: var(--line); height: 1px; }
.loading-screen { background: rgba(255, 255, 255, 0.7) !important; backdrop-filter: blur(2px); }
.spinner { border: 5px solid var(--brand-100) !important; border-top-color: var(--brand) !important; }
.info-label { color: var(--muted); }
.tabs.is-boxed li.is-active a { border-color: var(--line); color: var(--brand); }
.tabs li.is-active a { color: var(--brand); border-bottom-color: var(--brand); }
.pagination-link.is-current { background: var(--brand); border-color: var(--brand); }
.progress::-webkit-progress-value { background: var(--brand); }

/* Legacy inline colours used across pages */
[style*="#3273dc"] { border-color: var(--brand) !important; }
[style*="background-color: #e8f4f8"] { background-color: var(--brand-50) !important; }

.footer {
	background: #fff !important;
	border-top: 1px solid var(--line);
	color: var(--muted);
	padding: 2rem 1.5rem !important;
}

:focus-visible { outline: 3px solid rgba(67, 56, 202, 0.35); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	* { transition: none !important; animation: none !important; }
}

/* ---------- Bulma state overrides (disabled/active/focus) ---------- */
.button.is-primary[disabled], fieldset[disabled] .button.is-primary,
.button.is-success[disabled], fieldset[disabled] .button.is-success,
.button.is-link[disabled], fieldset[disabled] .button.is-link,
.button.is-info[disabled], fieldset[disabled] .button.is-info {
	background: var(--brand);
	border-color: var(--brand);
	color: #fff;
	opacity: 0.45;
	box-shadow: none;
	transform: none;
}
.button.is-primary:active, .button.is-success:active, .button.is-link:active, .button.is-info:active,
.button.is-primary:focus:not(:active), .button.is-success:focus:not(:active),
.button.is-link:focus:not(:active), .button.is-info:focus:not(:active) {
	background: var(--brand-600);
	border-color: var(--brand-600);
	color: #fff;
}
.button.is-primary.is-loading::after, .button.is-success.is-loading::after { border-color: transparent transparent #fff #fff !important; }

/* keep field icons vertically centred (legacy input margin-top) */
.control input, .control textarea, .control select { margin-top: 0; }
.control.has-icons-left .input { padding-left: 2.5em; }

/* ---------- Navbar fit (admin has many links) ----------
   Keep every item inside the window: tighten spacing on mid-size screens,
   and let the links wrap onto a second row instead of running off the edge. */
@media screen and (min-width: 1024px) {
	.navbar > .navbar-menu { flex-shrink: 1; min-width: 0; }
	.navbar > .navbar-brand { flex-shrink: 0; }
	.navbar-start { flex-wrap: wrap; min-width: 0; }
	.navbar-end { flex-shrink: 0; }
}
@media screen and (min-width: 1024px) and (max-width: 1800px) {
	.navbar-start > .navbar-item,
	.navbar-end > .navbar-item { padding-left: 0.5rem; padding-right: 0.5rem; }
	.navbar-item, .navbar-link { font-size: 0.9rem; }
	.brand-word small { display: none; }
}
