/* Future Builders — Global Web Styles */

:root {
	--fb-primary: #0E648F;
	--fb-primary-dark: #0a4f70;
	--fb-secondary: #DF8136;
	--fb-navbar-height: 56px;
	--fb-navbar-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ─── EU Compliance Bar (global — every page) ────────────────────────────────── */

.fb-compliance-bar {
	background: #fff;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	padding: 8px 24px;
}

.fb-compliance-bar-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
	max-width: 960px;
	margin: 0 auto;
}

.fb-compliance-bar-logo {
	max-height: 38px;
	width: auto;
	object-fit: contain;
}

.fb-compliance-bar-separator {
	width: 1px;
	height: 28px;
	background: rgba(0, 0, 0, 0.12);
	flex-shrink: 0;
}

@media (max-width: 768px) {
	.fb-compliance-bar {
		padding: 6px 16px;
	}

	.fb-compliance-bar-inner {
		gap: 16px;
	}

	.fb-compliance-bar-logo {
		max-height: 30px;
	}

	.fb-compliance-bar-separator {
		height: 22px;
	}
}

@media (max-width: 480px) {
	.fb-compliance-bar {
		padding: 6px 12px;
	}

	.fb-compliance-bar-inner {
		gap: 12px;
		flex-wrap: wrap;
	}

	.fb-compliance-bar-logo {
		max-height: 26px;
	}

	.fb-compliance-bar-separator {
		height: 20px;
	}
}

/* ─── Navbar ─────────────────────────────────────────────────────────────────── */

.navbar {
	background: #fff;
	box-shadow: var(--fb-navbar-shadow);
	border-bottom: 2px solid var(--fb-primary);
	padding: 0.4rem 0;
	min-height: var(--fb-navbar-height);
}

/* Brand: logo + text */
.navbar .navbar-brand {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	text-decoration: none;
}

.fb-navbar-logo {
	height: 32px;
	width: auto;
}

.fb-navbar-brand-text {
	font-weight: 700;
	font-size: 1.15rem;
	color: var(--fb-primary);
	letter-spacing: -0.01em;
}

.navbar .navbar-brand:hover .fb-navbar-brand-text {
	color: var(--fb-primary-dark);
}

/* Nav links */
.navbar .navbar-nav .nav-link {
	color: var(--text-color, #333);
	font-weight: 500;
	font-size: 0.92rem;
	padding: 0.65rem 0.85rem;
	border-radius: 6px;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.navbar .navbar-nav .nav-link:hover {
	color: var(--fb-primary);
}

.navbar .navbar-nav .nav-item.active {
	border-bottom: none !important;
}

.navbar .navbar-nav .nav-link.active {
	color: #fff;
	background-color: var(--fb-primary);
}

/* Login button */
.navbar .btn-login-area {
	border: 1.5px solid var(--fb-primary);
	color: var(--fb-primary);
	border-radius: 6px;
	padding: 6px 20px;
	font-weight: 600;
	font-size: 0.9rem;
	transition: background-color 0.2s ease, color 0.2s ease;
	margin-left: 0.5rem;
}

.navbar .btn-login-area:hover {
	background-color: var(--fb-primary);
	color: #fff !important;
}

/* Avatar dropdown */
.navbar #website-post-login .nav-avatar {
	padding: 0.4rem 0.5rem;
}

.navbar #website-post-login .dropdown-menu {
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	padding: 0.35rem 0;
	min-width: 180px;
}

.navbar #website-post-login .dropdown-item {
	font-size: 0.9rem;
	padding: 0.45rem 1rem;
	color: var(--text-color, #333);
	transition: background-color 0.15s ease;
}

.navbar #website-post-login .dropdown-item:hover {
	background-color: rgba(14, 100, 143, 0.06);
	color: var(--fb-primary);
}

/* ─── Navbar Mobile ──────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
	.navbar {
		z-index: 1020;
	}

	.navbar .navbar-toggler {
		border: none;
		padding: 0.4rem;
		outline: none;
	}

	.navbar .navbar-toggler .icon {
		stroke: var(--fb-primary);
	}

	.navbar .navbar-collapse {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: #fff;
		padding: 0.5rem 1rem;
		margin-top: 0;
		border-radius: 0 0 8px 8px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	}

	.navbar .navbar-nav {
		text-align: center;
		width: 100%;
	}

	.navbar .navbar-nav .nav-link {
		padding: 0.7rem 0.5rem;
		border-bottom: none;
		margin-bottom: 0;
		min-height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.navbar .navbar-nav .nav-link.active {
		color: #fff;
		background-color: var(--fb-primary);
		border-radius: 6px;
		border-bottom: none;
	}

	.navbar .btn-login-area {
		margin: 0.5rem 0;
		display: block;
		text-align: center;
		width: 100%;
	}
}

/* Login / Signup / Forgot pages — primary button override */
.for-login .btn-primary,
.for-signup .btn-primary,
.for-forgot .btn-primary,
.for-login-with-email-link .btn-primary {
	background-color: var(--fb-primary);
	border-color: var(--fb-primary);
}

.for-login .btn-primary:hover,
.for-signup .btn-primary:hover,
.for-forgot .btn-primary:hover,
.for-login-with-email-link .btn-primary:hover {
	background-color: var(--fb-primary-dark);
	border-color: var(--fb-primary-dark);
}

.for-login .btn-primary:focus,
.for-signup .btn-primary:focus,
.for-forgot .btn-primary:focus,
.for-login-with-email-link .btn-primary:focus {
	box-shadow: 0 0 0 0.2rem rgba(14, 100, 143, 0.25);
}

/* Page card heading color */
.page-card-head h4 {
	color: var(--fb-primary);
}

/* Sign-up message link color */
.sign-up-message a {
	color: var(--fb-primary);
}

.sign-up-message a:hover {
	color: var(--fb-primary-dark);
}

/* ─── Competency bar visualisation (reusable — shared by Student Profile & Positions) ─── */

.fb-competency-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fb-competency-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.fb-competency-name {
	width: 160px;
	flex-shrink: 0;
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--text-color);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.fb-competency-bar {
	display: flex;
	gap: 3px;
	align-items: center;
}

.fb-competency-segment {
	width: 28px;
	height: 8px;
	border-radius: 2px;
	background-color: #dcdcdc;
}

/* Filled segment colours — all filled segments in a row share the level colour */
.fb-competency-segment.filled.level-1 { background-color: #e74c3c; }
.fb-competency-segment.filled.level-2 { background-color: #e67e22; }
.fb-competency-segment.filled.level-3 { background-color: #f1c40f; }
.fb-competency-segment.filled.level-4 { background-color: #2ecc71; }
.fb-competency-segment.filled.level-5 { background-color: #27ae60; }

.fb-competency-level-label {
	font-size: 12px;
	color: var(--text-muted);
	white-space: nowrap;
}

@media (max-width: 600px) {
	.fb-competency-name {
		width: 100px;
	}

	.fb-competency-segment {
		width: 20px;
	}
}

/* ─── Language tags (shared, pill style) ──────────────────────────────────── */

.fb-language-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.fb-language-tag {
	display: inline-block;
	padding: 4px 12px;
	font-size: var(--text-sm);
	font-weight: 500;
	border-radius: 20px;
	background: rgba(14, 100, 143, 0.08);
	color: var(--fb-primary);
}

/* ─── Utility Classes ─────────────────────────────────────────────────────── */

/* Common page wrapper — base for portal pages (override max-width per page) */
.fb-page-container {
	max-width: 960px;
	margin: 40px auto;
	padding: 0 16px 40px;
}

.fb-page-container--narrow {
	max-width: 720px;
}

/* Page title — standard heading for list/browse pages */
.fb-page-title {
	color: var(--fb-primary);
	font-size: 1.6rem;
	font-weight: 700;
	margin: 0 0 24px;
}

/* Base interactive card — hover-lift with FB primary accent */
.fb-card {
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius-lg);
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.fb-card:hover {
	box-shadow: 0 4px 16px rgba(14, 100, 143, 0.10);
	border-color: var(--fb-primary);
	transform: translateY(-2px);
	text-decoration: none;
	color: inherit;
}

/* Primary action button */
.fb-btn-primary {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	font-weight: 600;
	font-size: var(--text-sm);
	color: #fff;
	background: var(--fb-primary);
	border: none;
	border-radius: var(--border-radius-lg);
	text-decoration: none;
	transition: background 0.2s, transform 0.15s;
	cursor: pointer;
}

.fb-btn-primary:hover {
	background: var(--fb-primary-dark);
	transform: translateY(-1px);
	text-decoration: none;
	color: #fff;
}

/* ─── Section cards (shared by profile, detail, edit pages) ───────────────── */

.fb-section {
	padding: 24px;
	margin-bottom: 16px;
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius-lg);
}

.fb-section-title {
	color: var(--fb-primary);
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid rgba(14, 100, 143, 0.15);
}

/* ─── Profile header (shared by student & company profile) ────────────────── */

.fb-profile-container {
	max-width: 720px;
	margin: 40px auto;
	padding: 0 16px 40px;
}

.fb-profile-header {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 24px;
	margin-bottom: 24px;
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius-lg);
}

.fb-profile-photo-section {
	flex-shrink: 0;
}

.fb-profile-header-info {
	flex: 1;
	min-width: 0;
}

.fb-profile-name {
	color: var(--fb-primary);
	margin: 0 0 4px;
	font-size: 1.4rem;
	font-weight: 600;
}

.fb-profile-email {
	font-size: var(--text-sm);
}

/* ─── Filter bar (shared by students, companies, positions) ───────────────── */

.fb-filter-bar {
	display: flex;
	gap: 16px;
	padding: 20px 24px;
	margin-bottom: 24px;
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius-lg);
}

.fb-filter-group {
	flex: 1;
	min-width: 0;
}

.fb-filter-label {
	display: block;
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--text-color);
	margin-bottom: 6px;
}

.fb-filter-dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 50;
	max-height: 200px;
	overflow-y: auto;
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	margin-top: 2px;
}

.fb-filter-dropdown-item {
	padding: 8px 12px;
	font-size: var(--text-sm);
	cursor: pointer;
	transition: background 0.1s;
}

.fb-filter-dropdown-item:hover {
	background: rgba(14, 100, 143, 0.06);
}

.fb-filter-dropdown-empty {
	padding: 8px 12px;
	font-size: var(--text-sm);
	color: var(--text-muted);
	font-style: italic;
}

.fb-filter-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.fb-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 10px;
	font-size: 12px;
	font-weight: 500;
	color: var(--fb-primary);
	background: rgba(14, 100, 143, 0.08);
	border-radius: 12px;
}

.fb-filter-chip-remove {
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	opacity: 0.6;
	transition: opacity 0.15s;
	line-height: 1;
}

.fb-filter-chip-remove:hover {
	opacity: 1;
}

/* ─── Form grid (shared by profile & edit pages) ──────────────────────────── */

.fb-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

.fb-form-group-full {
	grid-column: 1 / -1;
}

.fb-form-label {
	display: block;
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--text-color);
	margin-bottom: 4px;
}

.fb-form-group .form-control {
	font-size: var(--text-base);
}

.fb-readonly {
	background-color: var(--control-bg) !important;
	cursor: not-allowed;
}

/* ─── Child table rows (shared by profile & edit pages) ───────────────────── */

.fb-child-table {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fb-child-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.fb-child-field {
	flex: 1;
	min-width: 0;
}

.fb-child-field .form-control {
	font-size: var(--text-base);
}

.fb-remove-row-btn {
	flex-shrink: 0;
	padding: 6px;
	color: var(--text-muted);
	border: none;
	background: transparent;
	border-radius: var(--border-radius);
	transition: color 0.15s, background 0.15s;
	line-height: 1;
}

.fb-remove-row-btn:hover {
	color: var(--red-500);
	background: rgba(220, 53, 69, 0.08);
}

.fb-add-row-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding: 6px 14px;
	font-size: var(--text-sm);
	color: var(--fb-primary);
	border: 1.5px dashed var(--fb-primary);
	background: transparent;
	border-radius: var(--border-radius);
	transition: background 0.15s, color 0.15s;
}

.fb-add-row-btn:hover {
	background: rgba(14, 100, 143, 0.06);
	color: var(--fb-primary-dark);
}

/* ─── Search dropdown (shared by profile & edit pages) ────────────────────── */

.fb-competency-search-wrapper {
	position: relative;
}

.fb-search-dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 50;
	max-height: 180px;
	overflow-y: auto;
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	margin-top: 2px;
}

.fb-search-item {
	padding: 8px 12px;
	font-size: var(--text-sm);
	cursor: pointer;
	transition: background 0.1s;
}

.fb-search-item:hover {
	background: rgba(14, 100, 143, 0.06);
}

.fb-search-empty {
	color: var(--text-muted);
	cursor: default;
	font-style: italic;
}

.fb-search-empty:hover {
	background: transparent;
}

/* ─── Action buttons (shared by profile & edit pages) ─────────────────────── */

.fb-actions {
	display: flex;
	gap: 12px;
	margin-top: 24px;
}

.fb-save-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background-color: var(--fb-primary) !important;
	border-color: var(--fb-primary) !important;
	color: #fff !important;
	font-weight: 500;
	padding: 8px 24px;
}

.fb-save-btn:hover {
	background-color: var(--fb-primary-dark) !important;
	border-color: var(--fb-primary-dark) !important;
}

.fb-save-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.fb-spin {
	animation: fb-spin 1s linear infinite;
}

@keyframes fb-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ─── Read-only info grid (shared by profile pages) ───────────────────────── */

.fb-info-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

.fb-info-item-full {
	grid-column: 1 / -1;
}

.fb-info-label {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin-bottom: 2px;
}

.fb-info-value {
	display: block;
	font-size: var(--text-base);
	color: var(--text-color);
}

/* ─── Breadcrumb suppression (landing + list pages) ───────────────────────── */

body[data-path="index"] .breadcrumb,
body[data-path=""] .breadcrumb,
body[data-path="students"] .breadcrumb,
body[data-path="companies"] .breadcrumb,
body[data-path="positions"] .breadcrumb,
body[data-path="knowledge-base"] .breadcrumb {
	display: none !important;
}

/* ─── Navbar ↔ Landing Page integration ───────────────────────────────────── */

/* Remove default content padding so hero flows edge-to-edge after navbar */
body[data-path="index"] .main-section,
body[data-path=""] .main-section {
	padding-top: 0;
	margin-top: 0;
}

body[data-path="index"] .container.page-body,
body[data-path=""] .container.page-body {
	max-width: 100%;
	padding: 0;
	width: 100%;
}

body[data-path="index"] section.page-content,
body[data-path="index"] .page-content,
body[data-path=""] section.page-content,
body[data-path=""] .page-content {
	max-width: 100%;
	padding: 0;
}

/* ─── Shared responsive — filter bar (≤768px) ────────────────────────────── */

@media (max-width: 768px) {
	.fb-filter-bar {
		flex-direction: column;
		gap: 12px;
		padding: 16px;
	}
}

/* ─── Shared responsive — profile & form components (≤600px) ──────────────── */

@media (max-width: 600px) {
	.fb-profile-container {
		margin: 20px auto;
	}

	.fb-profile-header {
		flex-direction: column;
		text-align: center;
		gap: 12px;
		padding: 20px 16px;
	}

	.fb-form-grid {
		grid-template-columns: 1fr;
	}

	.fb-info-grid {
		grid-template-columns: 1fr;
	}

	.fb-child-row {
		flex-wrap: wrap;
	}

	.fb-child-field {
		flex: 1 1 calc(50% - 4px);
		min-width: 120px;
	}

	.fb-remove-row-btn {
		flex: 0 0 auto;
	}

	.fb-actions {
		flex-direction: column;
	}

	.fb-save-btn {
		width: 100%;
		justify-content: center;
	}
}

/* ─── Auth flash prevention (FOUC) ──────────────────────────────────────── */
/* Frappe renders both the login button and the profile icon in HTML,
   then relies on JS (frappe.render_user) to toggle visibility.
   These rules use the server-set body attribute to fix the flash
   BEFORE JavaScript executes. */

body[frappe-session-status="logged-in"] .btn-login-area {
	display: none !important;
}

body[frappe-session-status="logged-in"] #website-post-login {
	display: list-item !important;
}

/* Placeholder avatar circle while JS loads the real one */
body[frappe-session-status="logged-in"] #website-post-login .user-image-wrapper:empty::before {
	content: "";
	display: inline-block;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--gray-300, #d1d5db);
	animation: fb-avatar-pulse 1.2s ease-in-out infinite;
}

@keyframes fb-avatar-pulse {
	0%, 100% { opacity: 0.5; }
	50% { opacity: 1; }
}
