/**
 * Candidate Dashboard — Base styles.
 *
 * Tokens, suppression of theme titles, shell (sidebar+main wrapper),
 * shared loading/error/empty states, button system, and the global
 * prefers-reduced-motion guard. Per-section rules live in:
 *
 *   styles/sidebar.css   Sidebar, nav, CTA, user/company row, mobile
 *                        nav-toggle drawer (incl. 1024px @media).
 *   styles/main.css      Main content area, view-panel frame, page
 *                        header, panel base, two-col grid (incl. 640px
 *                        @media for these selectors).
 *   styles/views.css     Per-view rules (applications, bookmarks,
 *                        resumes, overview rows, alerts, profile form,
 *                        settings) and their 640px / 480px @media.
 *   styles/widgets.css   Notification bell, stats cards, welcome card,
 *                        privacy panel, and their @media rules.
 *
 * Each per-section file co-locates its responsive @media rules with
 * the base selectors they override, so the cascade is correct
 * regardless of the order block.json declares the style files.
 *
 * Split per the upscale stabilization plan
 * (plan/upscale-stabilization-plan-2026-05-07.md F4 / Task 5.2) — the
 * single 1356-LOC mega-file slowed editor diff review and mixed
 * concerns.
 *
 * @package WP_Career_Board
 * @since   1.2.2
 */

/* ── Suppress theme page title when candidate dashboard is on the page ─────
 * Themes (Astra, Twenty Twenty-*, BuddyX) frequently ship the page-title
 * rule with their own `!important` declaration to win over child-theme
 * suppressors. Beating that takes another `!important` here; specificity
 * alone won't cross the cascade. The `:has()` ancestor selector keeps the
 * effect scoped to the actual block surface. */
article:has( .wp-block-wp-career-board-candidate-dashboard ) .entry-title,
article:has( .wp-block-wp-career-board-candidate-dashboard ) .page-title,
article:has( .wp-block-wp-career-board-candidate-dashboard ) h1.post-title,
article:has( .wp-block-wp-career-board-candidate-dashboard ) .wp-block-post-title {
	display: none !important;
}

/*
 * Local aliases used throughout this block. --wcb-bg-subtle, --wcb-text-secondary
 * and --wcb-bg-hover are NOT re-declared here — they cascade from the :root
 * definitions in frontend-tokens.css and the html.dark-mode overrides in
 * frontend.css, so both dashboards flip colors consistently in dark mode.
 */
.wcb-dashboard {
	--wcb-text-primary: var(--wcb-contrast, var(--wp--preset--color--wcb-contrast));
	--wcb-text-muted:   var(--wcb-text-tertiary, #9ca3af);
	--wcb-blue:         var(--wcb-primary, var(--wp--preset--color--wcb-primary));
	--wcb-green:        #059669;
	--wcb-radius:       var(--wcb-radius-md);
	font-family: inherit;
	font-size: 1rem;
	color: var(--wcb-text-primary);
}

/* `[hidden]` toggle for data-wp-bind--hidden. (0,2,1) wins over the
 * (0,1,0) `display: flex` rules below on specificity alone. */
.wp-block-wp-career-board-candidate-dashboard [hidden] {
	display: none;
}


/* ── Shell — sidebar + main ──────────────────────────────────────────────── */
.wcb-dashboard-shell {
	display: flex;
	min-height: 600px;
	align-items: stretch;
}

/* ── Shared loading / error ───────────────────────────────────────────────── */
.wcb-cd-loading {
	display: none;
	align-items: center;
	gap: var(--wcb-space-sm);
	color: var(--wcb-text-secondary);
	font-size: var(--wcb-text-base);
	padding: var(--wcb-space-md) 0;
}

.wcb-cd-loading.wcb-shown {
	display: flex;
}

.wcb-cd-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid var( --wcb-border );
	border-top-color: var( --wcb-blue );
	border-radius: 50%;
	animation: wcb-cd-spin 0.7s linear infinite;
}

@keyframes wcb-cd-spin {
	to { transform: rotate( 360deg ); }
}

.wcb-cd-error {
	color: var(--wcb-danger-fg, #b91c1c);
	font-size: var(--wcb-text-base);
	margin: 0 0 var(--wcb-space-lg);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.wcb-cd-empty {
	display: none;
	flex-direction: column;
	align-items: center;
	gap: var(--wcb-space-md);
	padding: var(--wcb-space-4xl) var(--wcb-space-2xl);
	text-align: center;
}

.wcb-cd-empty.wcb-shown {
	display: flex;
}

.wcb-cd-empty-msg {
	font-size: var(--wcb-text-md);
	color: var(--wcb-text-secondary);
	margin: 0;
}

/* Button system (.wcb-cbtn / --primary / --ghost / --danger) is owned
 * by `assets/css/wcb-ui.css`. That file ships parent-prefixed selectors
 * at (0,3,1) which beat Reign / Astra `.entry-content a` cascades
 * without `!important`. Per-block duplication used to live here with
 * six `!important` flags; removed - the wcb-ui rule wins on any page
 * carrying a `wp-block-wp-career-board-*` ancestor. */
.wcb-cbtn--primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Reduced motion — disable transitions/animations across this block ──── */
@media (prefers-reduced-motion: reduce) {
	.wcb-nav-item,
	.wcb-cd-app-row,
	.wcb-cd-bookmark-row,
	.wcb-resume-card,
	.wcb-sidebar-cta,
	.wcb-cbtn,
	.wcb-nav-toggle-icon::after,
	.wcb-cd-spinner {
		transition: none !important;
		animation: none !important;
	}
}
