/**
 * EduNexa — ادونکسا
 * Topbar Announcement & Contact Bar Widget Styles (نوار اعلان و تماس بالای سایت)
 *
 * @package EduNexa
 * @since 1.2.0
 */

/* ==========================================================================
   1. MAIN TOPBAR CONTAINER
   ========================================================================== */
.kn-topbar {
	position: relative;
	width: 100%;
	direction: rtl;
	background: linear-gradient(135deg, #090d16 0%, #0f172a 50%, #1e293b 100%);
	color: #f8fafc;
	font-family: inherit;
	overflow: hidden;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	box-sizing: border-box;
}

/* Pattern Overlay */
.kn-topbar-pattern {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 1;
	opacity: 0.12;
	background-image: radial-gradient(circle, #ffffff 1px, transparent 1px);
	background-size: 16px 16px;
	mix-blend-mode: overlay;
}

.kn-topbar-pattern.pattern-grid {
	background-image: 
		linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
	background-size: 20px 20px;
}

.kn-topbar-pattern.pattern-lines {
	background: repeating-linear-gradient(
		45deg,
		rgba(255, 255, 255, 0.04),
		rgba(255, 255, 255, 0.04) 2px,
		transparent 2px,
		transparent 10px
	);
}

/* Inner Container */
.kn-topbar-inner {
	position: relative;
	z-index: 2;
	max-width: 1320px;
	margin: 0 auto;
	padding: 7px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 44px;
	box-sizing: border-box;
}

/* ==========================================================================
   2. ANNOUNCEMENT MESSAGE
   ========================================================================== */
.kn-topbar-message {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.84rem;
	color: #cbd5e1;
	line-height: 1.6;
	flex: 1;
	min-width: 0;
}

.kn-topbar-message-icon {
	color: #FAB237;
	font-size: 1.15rem;
	line-height: 1;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	filter: drop-shadow(0 0 6px rgba(250, 178, 55, 0.5));
}

.kn-topbar-message-icon.has-pulse {
	animation: knSparklePulse 2.4s infinite ease-in-out;
}

@keyframes knSparklePulse {
	0%, 100% {
		transform: scale(1);
		opacity: 0.9;
		filter: drop-shadow(0 0 6px rgba(250, 178, 55, 0.4));
	}
	50% {
		transform: scale(1.22);
		opacity: 1;
		filter: drop-shadow(0 0 12px rgba(250, 178, 55, 0.85));
	}
}

.kn-topbar-message-text {
	color: #e2e8f0;
	font-weight: 400;
	word-break: break-word;
}

.kn-topbar-message-text strong {
	color: #FAB237;
	font-weight: 700;
	text-shadow: 0 0 12px rgba(250, 178, 55, 0.25);
}

/* Optional CTA Button inside/beside Topbar Message */
.kn-topbar-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 14px;
	background: rgba(250, 178, 55, 0.15);
	border: 1px solid rgba(250, 178, 55, 0.38);
	border-radius: 999px;
	color: #FAB237;
	font-size: 0.77rem;
	font-weight: 700;
	text-decoration: none;
	margin-right: 10px;
	flex-shrink: 0;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	white-space: nowrap;
}

.kn-topbar-btn:hover {
	background: #FAB237;
	color: #0f172a;
	border-color: #FAB237;
	box-shadow: 0 0 16px rgba(250, 178, 55, 0.45);
	transform: translateY(-1px);
}

/* ==========================================================================
   3. CONTACT & CONSULTATION PILL
   ========================================================================== */
.kn-topbar-contact {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 4px 12px 4px 14px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	text-decoration: none;
	color: #ffffff;
	flex-shrink: 0;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.kn-topbar-contact:hover {
	background: rgba(250, 178, 55, 0.14);
	border-color: rgba(250, 178, 55, 0.45);
	box-shadow: 0 4px 18px rgba(250, 178, 55, 0.18);
	transform: translateY(-1px);
}

.kn-topbar-contact-icon {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: rgba(250, 178, 55, 0.16);
	color: #FAB237;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kn-topbar-contact-icon svg {
	width: 14px;
	height: 14px;
	display: block;
}

.kn-topbar-contact:hover .kn-topbar-contact-icon {
	background: #FAB237;
	color: #0f172a;
	transform: scale(1.08) rotate(-10deg);
}

.kn-topbar-contact-content {
	display: flex;
	flex-direction: column;
	text-align: right;
	line-height: 1.18;
}

.kn-topbar-contact-label {
	font-size: 0.65rem;
	color: #94a3b8;
	font-weight: 500;
	margin-bottom: 2px;
	letter-spacing: -0.2px;
}

.kn-topbar-contact-number {
	font-size: 0.86rem;
	font-weight: 800;
	color: #ffffff;
	direction: ltr;
	text-align: right;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	letter-spacing: 0.5px;
	transition: color 0.2s ease;
}

.kn-topbar-contact:hover .kn-topbar-contact-number {
	color: #FAB237;
}

.kn-topbar-contact-arrow {
	width: 14px;
	height: 14px;
	color: #94a3b8;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.25s ease, color 0.25s ease;
}

.kn-topbar-contact-arrow svg {
	width: 14px;
	height: 14px;
	display: block;
}

.kn-topbar-contact:hover .kn-topbar-contact-arrow {
	color: #FAB237;
	transform: translateX(-3px);
}

/* Sticky Topbar Mode */
.kn-topbar.is-sticky {
	position: sticky;
	top: 0;
	z-index: 997;
}

body.admin-bar .kn-topbar.is-sticky {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .kn-topbar.is-sticky {
		top: 46px;
	}
}

/* ==========================================================================
   4. RESPONSIVE MEDIA QUERIES & MOBILE LAYOUT MODES
   ========================================================================== */
@media (max-width: 991px) {
	.kn-topbar-inner {
		padding: 6px 16px;
		gap: 12px;
	}
	.kn-topbar-message {
		font-size: 0.8rem;
	}
}

@media (max-width: 768px) {
	.kn-topbar {
		max-width: 100vw;
		box-sizing: border-box;
		overflow: hidden;
	}
	.kn-topbar-contact-label {
		display: none;
	}
	.kn-topbar-contact {
		padding: 4px 10px;
		gap: 6px;
	}
	.kn-topbar-contact-number {
		font-size: 0.78rem;
	}
	.kn-topbar-message {
		font-size: 0.75rem;
		min-width: 0;
	}
	.kn-topbar-message-icon {
		font-size: 1rem;
	}
	.kn-topbar-btn {
		padding: 2px 10px;
		font-size: 0.72rem;
		margin-right: 6px;
	}
}

/* Mode 1: Smart Responsive Fit (Default - No horizontal scroll, perfectly balanced) */
.kn-topbar.mobile-fit .kn-topbar-inner {
	padding: 5px 12px;
	gap: 8px;
	flex-wrap: nowrap;
	justify-content: space-between;
}

.kn-topbar.mobile-fit .kn-topbar-message {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
}

.kn-topbar.mobile-fit .kn-topbar-message-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Mode 2: Horizontal Smooth Scroll */
.kn-topbar.mobile-scroll .kn-topbar-inner {
	padding: 5px 12px;
	gap: 8px;
	flex-wrap: nowrap;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.kn-topbar.mobile-scroll .kn-topbar-inner::-webkit-scrollbar {
	display: none;
}

.kn-topbar.mobile-scroll .kn-topbar-message {
	white-space: nowrap;
	flex: none;
}

.kn-topbar.mobile-scroll .kn-topbar-message-text {
	white-space: nowrap;
}

/* Mode 3: Stacking Mode on Mobile */
.kn-topbar.mobile-stack .kn-topbar-inner {
	flex-direction: column;
	text-align: center;
	padding: 7px 12px;
	gap: 6px;
}

.kn-topbar.mobile-stack .kn-topbar-message {
	justify-content: center;
	white-space: normal;
	width: 100%;
}

/* Mode 4: Hide Contact on Mobile */
@media (max-width: 768px) {
	.kn-topbar.mobile-hide-contact .kn-topbar-contact {
		display: none !important;
	}
	.kn-topbar.mobile-hide-contact .kn-topbar-inner {
		justify-content: center;
		text-align: center;
	}
	.kn-topbar.mobile-hide-contact .kn-topbar-message {
		justify-content: center;
	}
}

/* Mode 5: Hide Topbar Completely on Mobile */
@media (max-width: 768px) {
	.kn-topbar.mobile-hide-all {
		display: none !important;
	}
}

/* Small Smartphone Optimizations (< 440px) */
@media (max-width: 440px) {
	.kn-topbar-inner {
		padding: 4px 10px;
		gap: 6px;
	}
	.kn-topbar-contact {
		padding: 3px 8px;
		gap: 5px;
	}
	.kn-topbar-contact-arrow {
		display: none !important;
	}
	.kn-topbar-contact-number {
		font-size: 0.74rem;
	}
	.kn-topbar-message-text {
		font-size: 0.72rem;
	}
	.kn-topbar-btn {
		padding: 2px 7px;
		font-size: 0.68rem;
		margin-right: 4px;
	}
}

/* Ultra-Narrow Screens (< 360px) */
@media (max-width: 360px) {
	.kn-topbar.mobile-fit .kn-topbar-btn {
		display: none; /* Hide button on ultra-narrow screens to keep message + contact visible */
	}
	.kn-topbar-inner {
		padding: 4px 6px;
	}
}