/**
 * TalkFirst Dashboard Framework
 *
 * Основни цветове:
 * Primary:    #355548
 * Accent:     #63AFA3
 * Background: #F7F6F2
 * Text:       #24463D
 */

:root {
	--tf-color-primary: #355548;
	--tf-color-primary-dark: #24463d;
	--tf-color-accent: #63afa3;
	--tf-color-background: #f7f6f2;
	--tf-color-surface: #ffffff;
	--tf-color-border: #dde5e1;
	--tf-color-text: #24463d;
	--tf-color-muted: #6b7f78;
	--tf-color-danger: #b54747;
	--tf-color-warning: #a87322;
	--tf-color-success: #39745c;

	--tf-sidebar-width: 280px;
	--tf-header-height: 88px;

	--tf-radius-small: 8px;
	--tf-radius: 10px;
	--tf-radius-large: 16px;

	--tf-shadow-small: 0 2px 8px rgba(36, 70, 61, 0.06);
	--tf-shadow-card: 0 8px 28px rgba(36, 70, 61, 0.08);

	--tf-space-1: 4px;
	--tf-space-2: 8px;
	--tf-space-3: 12px;
	--tf-space-4: 16px;
	--tf-space-5: 20px;
	--tf-space-6: 24px;
	--tf-space-7: 32px;
	--tf-space-8: 40px;
	--tf-space-9: 48px;

	--tf-transition: 180ms ease;
}

/* =========================================================
   Dashboard page
   ========================================================= */

body.tf-dashboard-page {
	background: var(--tf-color-background);
}

body.tf-dashboard-page #page-container {
	overflow: visible;
}

.tf-dashboard {
	position: relative;
	display: grid;
	grid-template-columns: var(--tf-sidebar-width) minmax(0, 1fr);
	width: 100vw;
	max-width: none;
	min-height: 760px;
	margin-right: calc(50% - 50vw);
	margin-left: calc(50% - 50vw);
	background: var(--tf-color-background);
	color: var(--tf-color-text);
	font-size: 16px;
	line-height: 1.5;
	box-sizing: border-box;
}

.tf-dashboard *,
.tf-dashboard *::before,
.tf-dashboard *::after {
	box-sizing: border-box;
}

.tf-dashboard a {
	color: inherit;
	text-decoration: none;
}

.tf-dashboard button,
.tf-dashboard input,
.tf-dashboard select,
.tf-dashboard textarea {
	font: inherit;
}

/* =========================================================
   Sidebar
   ========================================================= */

.tf-dashboard__sidebar {
	position: relative;
	z-index: 30;
	display: flex;
	flex-direction: column;
	width: var(--tf-sidebar-width);
	min-width: 0;
	min-height: 100%;
	background: var(--tf-color-primary-dark);
	color: #ffffff;
}

.tf-dashboard__brand {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--tf-header-height);
	padding: var(--tf-space-5) var(--tf-space-6);
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tf-dashboard__brand-link {
	display: flex;
	flex-direction: column;
	gap: 2px;
	color: #ffffff;
}

.tf-dashboard__brand-name {
	font-size: 25px;
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.1;
}

.tf-dashboard__brand-context {
	color: rgba(255, 255, 255, 0.7);
	font-size: 12px;
	line-height: 1.4;
}

.tf-dashboard__sidebar-close {
	display: none;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: var(--tf-radius-small);
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
	font-size: 27px;
	line-height: 1;
	cursor: pointer;
}

.tf-dashboard__navigation {
	flex: 1;
	padding: var(--tf-space-6) var(--tf-space-4);
}

.tf-dashboard__menu {
	display: flex;
	flex-direction: column;
	gap: var(--tf-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.tf-dashboard__menu-item {
	margin: 0;
	padding: 0;
}

.tf-dashboard__menu-link {
	display: flex;
	align-items: center;
	gap: var(--tf-space-3);
	min-height: 48px;
	padding: 11px 14px;
	border-radius: var(--tf-radius);
	color: rgba(255, 255, 255, 0.78);
	font-weight: 500;
	transition:
		background-color var(--tf-transition),
		color var(--tf-transition),
		transform var(--tf-transition);
}

.tf-dashboard__menu-link:hover,
.tf-dashboard__menu-link:focus-visible {
	background: rgba(255, 255, 255, 0.09);
	color: #ffffff;
}

.tf-dashboard__menu-link.is-active {
	background: var(--tf-color-accent);
	color: var(--tf-color-primary-dark);
	font-weight: 700;
	box-shadow: var(--tf-shadow-small);
}

.tf-dashboard__menu-icon {
	position: relative;
	display: inline-flex;
	flex: 0 0 20px;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: 2px solid currentColor;
	border-radius: 6px;
	opacity: 0.9;
}

.tf-dashboard__menu-icon--dashboard::before {
	content: "";
	position: absolute;
	inset: 4px;
	border-top: 2px solid currentColor;
	border-left: 2px solid currentColor;
}

.tf-dashboard__sidebar-footer {
	display: flex;
	flex-direction: column;
	gap: var(--tf-space-4);
	padding: var(--tf-space-5);
	border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.tf-dashboard__profile-link {
	display: flex;
	align-items: center;
	gap: var(--tf-space-3);
	min-width: 0;
	color: #ffffff;
}

.tf-dashboard-user__avatar {
	display: block;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border: 2px solid rgba(255, 255, 255, 0.22);
	border-radius: 50%;
	object-fit: cover;
}

.tf-dashboard__profile-details {
	display: flex;
	min-width: 0;
	flex-direction: column;
}

.tf-dashboard__profile-name {
	overflow: hidden;
	color: #ffffff;
	font-size: 14px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tf-dashboard__profile-action {
	color: rgba(255, 255, 255, 0.65);
	font-size: 12px;
}

.tf-dashboard__logout-link {
	color: rgba(255, 255, 255, 0.72);
	font-size: 13px;
}

.tf-dashboard__logout-link:hover {
	color: #ffffff;
}

/* =========================================================
   Main area and header
   ========================================================= */

.tf-dashboard__main {
	min-width: 0;
	background: var(--tf-color-background);
}

.tf-dashboard__header {
	position: relative;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--tf-header-height);
	padding: var(--tf-space-4) var(--tf-space-8);
	border-bottom: 1px solid var(--tf-color-border);
	background: rgba(255, 255, 255, 0.94);
	box-shadow: var(--tf-shadow-small);
}

.tf-dashboard__header-start,
.tf-dashboard__header-end {
	display: flex;
	align-items: center;
	gap: var(--tf-space-4);
	min-width: 0;
}

.tf-dashboard__heading {
	min-width: 0;
}

.tf-dashboard__eyebrow {
	margin: 0 0 2px;
	color: var(--tf-color-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.tf-dashboard__title {
	margin: 0;
	color: var(--tf-color-text);
	font-size: clamp(22px, 2vw, 30px);
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.2;
}

.tf-dashboard__header-user {
	display: flex;
	align-items: center;
	gap: var(--tf-space-3);
}

.tf-dashboard__header-user .tf-dashboard-user__avatar {
	width: 40px;
	height: 40px;
	flex-basis: 40px;
	border-color: var(--tf-color-border);
}

.tf-dashboard__header-user-name {
	max-width: 180px;
	overflow: hidden;
	font-size: 14px;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tf-dashboard__menu-toggle {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid var(--tf-color-border);
	border-radius: var(--tf-radius);
	background: #ffffff;
	cursor: pointer;
}

.tf-dashboard__menu-toggle span {
	display: block;
	width: 19px;
	height: 2px;
	border-radius: 2px;
	background: var(--tf-color-primary-dark);
}

/* =========================================================
   Dashboard content
   ========================================================= */

.tf-dashboard__content {
	width: 100%;
	max-width: none;
	margin: 0 auto;
	padding: var(--tf-space-8);
	outline: none;
}

.tf-dashboard__section {
	width: 100%;
}

/* =========================================================
   Overview
   ========================================================= */

.tf-overview {
	display: flex;
	flex-direction: column;
	gap: var(--tf-space-7);
}

.tf-overview__welcome {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--tf-space-6);
	padding: var(--tf-space-7);
	border: 1px solid var(--tf-color-border);
	border-radius: var(--tf-radius-large);
	background:
		linear-gradient(
			135deg,
			rgba(99, 175, 163, 0.14),
			rgba(255, 255, 255, 0.98) 55%
		);
	box-shadow: var(--tf-shadow-card);
}

.tf-overview__eyebrow {
	margin: 0 0 var(--tf-space-2);
	color: var(--tf-color-accent);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.045em;
	text-transform: uppercase;
}

.tf-overview__welcome-title {
	margin: 0 0 var(--tf-space-3);
	color: var(--tf-color-primary-dark);
	font-size: clamp(28px, 3vw, 42px);
	font-weight: 700;
	letter-spacing: -0.035em;
	line-height: 1.15;
}

.tf-overview__welcome-text {
	max-width: 720px;
	margin: 0;
	color: var(--tf-color-muted);
	font-size: 16px;
	line-height: 1.65;
}

.tf-overview__welcome-actions:empty {
	display: none;
}

/* =========================================================
   Statistic cards
   ========================================================= */

.tf-stats-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--tf-space-5);
}

.tf-stat-card {
	position: relative;
	display: flex;
	min-width: 0;
	min-height: 150px;
	flex-direction: column;
	justify-content: space-between;
	padding: var(--tf-space-6);
	border: 1px solid var(--tf-color-border);
	border-radius: var(--tf-radius-large);
	background: var(--tf-color-surface);
	box-shadow: var(--tf-shadow-small);
	transition:
		transform var(--tf-transition),
		box-shadow var(--tf-transition),
		border-color var(--tf-transition);
}

.tf-stat-card:hover {
	transform: translateY(-2px);
	border-color: rgba(99, 175, 163, 0.55);
	box-shadow: var(--tf-shadow-card);
}

.tf-stat-card__label {
	margin: 0;
	color: var(--tf-color-muted);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.tf-stat-card__value {
	margin: var(--tf-space-3) 0 0;
	color: var(--tf-color-primary-dark);
	font-size: 38px;
	font-weight: 700;
	letter-spacing: -0.04em;
	line-height: 1;
}

.tf-stat-card__link {
	align-self: flex-start;
	margin-top: var(--tf-space-4);
	color: var(--tf-color-primary);
	font-size: 13px;
	font-weight: 700;
}

.tf-stat-card__link:hover {
	color: var(--tf-color-accent);
}

/* =========================================================
   Dashboard cards and grids
   ========================================================= */

.tf-overview-grid {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
	gap: var(--tf-space-5);
	align-items: start;
}

.tf-dashboard-card {
	overflow: hidden;
	border: 1px solid var(--tf-color-border);
	border-radius: var(--tf-radius-large);
	background: var(--tf-color-surface);
	box-shadow: var(--tf-shadow-small);
}

.tf-dashboard-card__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--tf-space-4);
	padding: var(--tf-space-6);
	border-bottom: 1px solid var(--tf-color-border);
}

.tf-dashboard-card__title {
	margin: 0;
	color: var(--tf-color-primary-dark);
	font-size: 21px;
	font-weight: 700;
	line-height: 1.3;
}

.tf-dashboard-card__subtitle {
	margin: var(--tf-space-2) 0 0;
	color: var(--tf-color-muted);
	font-size: 14px;
	line-height: 1.55;
}

.tf-dashboard-card__content {
	padding: var(--tf-space-6);
}

/* =========================================================
   Empty states
   ========================================================= */

.tf-empty-state {
	display: flex;
	min-height: 180px;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	padding: var(--tf-space-6);
	border: 1px dashed var(--tf-color-border);
	border-radius: var(--tf-radius);
	background: var(--tf-color-background);
}

.tf-empty-state__title {
	margin: 0 0 var(--tf-space-2);
	color: var(--tf-color-primary-dark);
	font-size: 18px;
	font-weight: 700;
}

.tf-empty-state__text {
	max-width: 620px;
	margin: 0;
	color: var(--tf-color-muted);
	font-size: 14px;
	line-height: 1.6;
}

/* =========================================================
   Notices and buttons
   ========================================================= */

.tf-dashboard-notice {
	max-width: 760px;
	margin: var(--tf-space-8) auto;
	padding: var(--tf-space-7);
	border: 1px solid var(--tf-color-border);
	border-radius: var(--tf-radius-large);
	background: #ffffff;
	box-shadow: var(--tf-shadow-card);
}

.tf-dashboard-notice h2 {
	margin: 0 0 var(--tf-space-3);
	color: var(--tf-color-primary-dark);
}

.tf-dashboard-notice p {
	margin: 0 0 var(--tf-space-5);
	color: var(--tf-color-muted);
}

.tf-dashboard-notice--error {
	border-left: 4px solid var(--tf-color-danger);
}

.tf-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 18px;
	border: 0;
	border-radius: var(--tf-radius);
	font-weight: 700;
	cursor: pointer;
	transition:
		background-color var(--tf-transition),
		transform var(--tf-transition);
}

.tf-button--primary {
	background: var(--tf-color-primary);
	color: #ffffff !important;
}

.tf-button--primary:hover {
	background: var(--tf-color-primary-dark);
	transform: translateY(-1px);
}

/* =========================================================
   Overlay
   ========================================================= */

.tf-dashboard__overlay {
	position: fixed;
	z-index: 25;
	inset: 0;
	background: rgba(20, 35, 30, 0.55);
	opacity: 0;
	visibility: hidden;
	transition:
		opacity var(--tf-transition),
		visibility var(--tf-transition);
}

.tf-dashboard__overlay[hidden] {
	display: none;
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 1200px) {
	.tf-dashboard__content {
		padding: var(--tf-space-7);
	}

	.tf-stats-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* =========================================================
   Mobile navigation
   ========================================================= */

@media (max-width: 980px) {
	.tf-dashboard {
		display: block;
		min-height: 650px;
	}

	.tf-dashboard__sidebar {
		position: fixed;
		z-index: 40;
		top: 0;
		bottom: 0;
		left: 0;
		width: min(86vw, 320px);
		min-height: 100vh;
		overflow-y: auto;
		box-shadow: 18px 0 50px rgba(20, 35, 30, 0.2);
		transform: translateX(-105%);
		transition: transform 220ms ease;
	}

	body.admin-bar .tf-dashboard__sidebar {
		top: 32px;
		min-height: calc(100vh - 32px);
	}

	.tf-dashboard.is-sidebar-open .tf-dashboard__sidebar {
		transform: translateX(0);
	}

	.tf-dashboard__sidebar-close,
	.tf-dashboard__menu-toggle {
		display: flex;
	}

	.tf-dashboard.is-sidebar-open .tf-dashboard__overlay {
		display: block;
		opacity: 1;
		visibility: visible;
	}

	.tf-dashboard__header {
		min-height: 76px;
		padding: var(--tf-space-4) var(--tf-space-6);
	}

	.tf-dashboard__header-user-name {
		display: none;
	}

	.tf-dashboard__content {
		padding: var(--tf-space-6);
	}

	.tf-overview-grid {
		grid-template-columns: 1fr;
	}
}

/* =========================================================
   Small screens
   ========================================================= */

@media (max-width: 600px) {
	body.admin-bar .tf-dashboard__sidebar {
		top: 46px;
		min-height: calc(100vh - 46px);
	}

	.tf-dashboard__header {
		padding: var(--tf-space-3) var(--tf-space-4);
	}

	.tf-dashboard__header-end {
		gap: var(--tf-space-2);
	}

	.tf-dashboard__content {
		padding: var(--tf-space-4);
	}

	.tf-overview {
		gap: var(--tf-space-5);
	}

	.tf-overview__welcome {
		display: block;
		padding: var(--tf-space-5);
	}

	.tf-overview__welcome-title {
		font-size: 29px;
	}

	.tf-stats-grid {
		grid-template-columns: 1fr;
		gap: var(--tf-space-4);
	}

	.tf-stat-card {
		min-height: 128px;
		padding: var(--tf-space-5);
	}

	.tf-stat-card__value {
		font-size: 34px;
	}

	.tf-dashboard-card__header,
	.tf-dashboard-card__content {
		padding: var(--tf-space-5);
	}

	.tf-empty-state {
		min-height: 150px;
		padding: var(--tf-space-5);
	}
}

/* =========================================================
   Accessibility and reduced motion
   ========================================================= */

.tf-dashboard a:focus-visible,
.tf-dashboard button:focus-visible {
	outline: 3px solid rgba(99, 175, 163, 0.55);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.tf-dashboard *,
	.tf-dashboard *::before,
	.tf-dashboard *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}
body.tf-dashboard-menu-open {
	overflow: hidden;
}

body.tf-dashboard-menu-open {
	overflow: hidden;
}

/* =========================================================
   Divi full-width dashboard fix
   ========================================================= */

.tf-dashboard {
	position: relative;
	left: 50%;
	width: 100vw !important;
	max-width: 100vw !important;
	margin-right: 0 !important;
	margin-left: 0 !important;
	transform: translateX(-50%);
}

/*
 * Освобождава само Divi контейнерите,
 * в които действително има TalkFirst Dashboard.
 */
.et_pb_section:has(.tf-dashboard),
.et_pb_row:has(.tf-dashboard),
.et_pb_column:has(.tf-dashboard),
.et_pb_module:has(.tf-dashboard),
.et_pb_code:has(.tf-dashboard),
.et_pb_code_inner:has(.tf-dashboard) {
	width: 100% !important;
	max-width: none !important;
	margin-right: 0 !important;
	margin-left: 0 !important;
	padding-right: 0 !important;
	padding-left: 0 !important;
}

.et_pb_section:has(.tf-dashboard),
.et_pb_row:has(.tf-dashboard) {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.tf-dashboard__content {
	width: 100% !important;
	max-width: none !important;
	padding: 40px 48px;
}

body.tf-dashboard-page {
	overflow-x: hidden;
}
/* =========================================================
   Dashboard Widgets Engine
   ========================================================= */

.tf-widget-area {
	display: grid;
	gap: var(--tf-space-5);
	width: 100%;
}

.tf-widget-area--stats {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tf-widget {
	min-width: 0;
}

.tf-widget--stat {
	position: relative;
	display: flex;
	min-height: 150px;
	flex-direction: column;
	padding: var(--tf-space-6);
	border: 1px solid var(--tf-color-border);
	border-radius: var(--tf-radius-large);
	background: var(--tf-color-surface);
	box-shadow: var(--tf-shadow-small);
	transition:
		transform var(--tf-transition),
		box-shadow var(--tf-transition),
		border-color var(--tf-transition);
}

.tf-widget--stat:hover {
	transform: translateY(-2px);
	border-color: rgba(99, 175, 163, 0.55);
	box-shadow: var(--tf-shadow-card);
}

.tf-widget--stat .tf-widget__header {
	margin-bottom: auto;
}

.tf-widget--stat .tf-widget__title {
	margin: 0;
	color: var(--tf-color-muted);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.tf-widget--stat .tf-widget__content {
	margin-top: var(--tf-space-4);
}

@media (max-width: 1200px) {
	.tf-widget-area--stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.tf-widget-area--stats {
		grid-template-columns: 1fr;
	}

	.tf-widget--stat {
		min-height: 128px;
		padding: var(--tf-space-5);
	}
}

/* =========================================================
   Dashboard widgets – width correction
   ========================================================= */

.tf-overview > .tf-widget-area,
.tf-widget-area.tf-widget-area--stats {
	display: grid !important;
	width: 100% !important;
	min-width: 0 !important;
	max-width: none !important;
	align-self: stretch !important;
	grid-template-columns: repeat(4, minmax(180px, 1fr)) !important;
	gap: var(--tf-space-5) !important;
}

.tf-widget-area--stats > .tf-widget,
.tf-widget-area--stats > .tf-widget--small,
.tf-widget-area--stats > .tf-widget--stat {
	display: flex !important;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	flex-basis: auto !important;
}

.tf-widget--stat .tf-widget__header,
.tf-widget--stat .tf-widget__content {
	width: 100% !important;
	min-width: 0 !important;
}

.tf-widget--stat .tf-widget__title {
	width: 100% !important;
	overflow-wrap: normal !important;
	word-break: normal !important;
	white-space: normal !important;
}

/* Tablet */
@media (max-width: 1200px) {
	.tf-overview > .tf-widget-area,
	.tf-widget-area.tf-widget-area--stats {
		grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
	}
}

/* Mobile */
@media (max-width: 600px) {
	.tf-overview > .tf-widget-area,
	.tf-widget-area.tf-widget-area--stats {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}