/*
Theme Name: Coursesdata Theme
Theme URI: https://coursesdata.com
Author: Coursesdata Team
Author URI: https://coursesdata.com
Description: A modern, high-performance, SEO-optimized WordPress theme for international scholarships, study abroad guides, and academic programs.
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: coursesdata
Tags: education, scholarship, study-abroad, clean, responsive, grid-layout, custom-post-type
*/

/* ==========================================================================
   Design Tokens & Color Pattern
   ========================================================================== */
:root {
	--ink: #16343a;
	--muted: #5b7376;
	--brand: #0d8b83;
	--brand-dark: #07645f;
	--mint: #e7f5f1;
	--sand: #fff8ed;
	--white: #ffffff;
	--line: #d9e5e2;
	--shadow: 0 20px 50px rgba(22, 52, 58, .1);
	--shadow-subtle: 0 4px 20px rgba(22, 52, 58, .05);
	--shadow-hover: 0 14px 34px rgba(13, 139, 131, .15);
	--radius: 18px;
	--radius-sm: 10px;
	--radius-pill: 999px;
	--max-width: 1380px;

	--font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	--font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	font-size: 16px;
	line-height: 1.65;
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

body {
	font-family: var(--font-main);
	color: var(--ink);
	background-color: #f7faf9;
	margin: 0;
	padding: 0;
	overflow-x: hidden;
	direction: ltr;
	text-align: left;
}

body.cd-menu-locked {
	overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-heading);
	color: var(--ink);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.02em;
}

p {
	margin-bottom: 1.25rem;
	color: var(--ink);
}

p:last-child {
	margin-bottom: 0;
}

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

a:hover,
a:focus {
	color: var(--brand-dark);
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

button, input, select, textarea {
	font-family: inherit;
	font-size: 1rem;
	color: inherit;
}

button {
	cursor: pointer;
	border: none;
	background: none;
}

/* Screen reader text utility */
.cd-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cd-skip-link:focus {
	position: fixed;
	top: 15px;
	left: 15px;
	z-index: 999999;
	padding: 12px 20px;
	background: var(--ink);
	color: var(--white);
	border-radius: var(--radius-sm);
	text-decoration: underline;
}

/* ==========================================================================
   Container & Layout Utilities
   ========================================================================== */
.cd-container {
	width: 100%;
	max-width: var(--max-width);
	margin-left: auto;
	margin-right: auto;
	padding-left: 20px;
	padding-right: 20px;
}

/* Section pills & headings */
.cd-section-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	font-size: 0.82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--brand-dark);
	background: var(--mint);
	border-radius: var(--radius-pill);
	margin-bottom: 12px;
}

/* Buttons */
.cd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 24px;
	font-size: 0.95rem;
	font-weight: 600;
	border-radius: var(--radius-pill);
	transition: var(--transition);
	white-space: nowrap;
}

.cd-btn-brand {
	background: var(--brand);
	color: var(--white);
	box-shadow: 0 4px 15px rgba(13, 139, 131, 0.25);
}

.cd-btn-brand:hover {
	background: var(--brand-dark);
	color: var(--white);
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(13, 139, 131, 0.35);
}

.cd-btn-outline {
	background: var(--white);
	color: var(--ink);
	border: 1px solid var(--line);
}

.cd-btn-outline:hover {
	background: var(--mint);
	color: var(--brand-dark);
	border-color: var(--brand);
	transform: translateY(-2px);
}

.cd-btn-ghost {
	background: transparent;
	color: var(--muted);
	border: 1px solid transparent;
}

.cd-btn-ghost:hover {
	background: var(--mint);
	color: var(--ink);
}

.cd-btn-telegram {
	background: #229ed9;
	color: var(--white);
}

.cd-btn-telegram:hover {
	background: #1980b3;
	color: var(--white);
	transform: translateY(-2px);
}

.cd-btn-block {
	width: 100%;
}

/* Breadcrumbs */
.cd-breadcrumbs {
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 16px;
}

.cd-breadcrumbs a {
	color: var(--muted);
}

.cd-breadcrumbs a:hover {
	color: var(--brand);
}

.cd-breadcrumbs .separator {
	margin: 0px;
	color: var(--line);
}

/* ==========================================================================
   Card Component & Grid (.cd-posts-grid & .cd-card)
   ========================================================================== */
.cd-posts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 26px;
}

.cd-card {
	display: flex;
	flex-direction: column;
	background: var(--white);
	border-radius: var(--radius);
	border: 1px solid var(--line);
	overflow: hidden;
	box-shadow: var(--shadow-subtle);
	transition: var(--transition);
	position: relative;
}

.cd-card:hover {
	transform: translateY(-5px);
	box-shadow: var(--shadow-hover);
	border-color: rgba(13, 139, 131, 0.3);
}

.cd-card-media-wrap {
	position: relative;
	width: 100%;
	height: 200px;
	overflow: hidden;
	background: var(--ink);
}

.cd-card-thumb-link {
	display: block;
	width: 100%;
	height: 100%;
}

.cd-card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.cd-card:hover .cd-card-img {
	transform: scale(1.05);
}

/* Card Gradient Fallback when no thumbnail is assigned */
.cd-card-gradient-bg {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

.cd-card-gradient-pattern {
	position: absolute;
	inset: 0;
	background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1.5px, transparent 1.5px);
	background-size: 14px 14px;
	opacity: 0.6;
}

.cd-card-gradient-badge {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	color: var(--white);
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.cd-card-gradient-badge i {
	font-size: 2.2rem;
}

.cd-card-gradient-badge span {
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

/* Card Pill Overlay */
.cd-card-pill-overlay {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	pointer-events: none;
	z-index: 3;
}

.cd-card-pill-overlay a,
.cd-card-pill-overlay span {
	pointer-events: auto;
}

.cd-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 11px;
	border-radius: var(--radius-pill);
	font-size: 0.75rem;
	font-weight: 700;
	backdrop-filter: blur(8px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cd-badge-type {
	background: rgba(22, 52, 58, 0.85);
	color: var(--white);
}

.cd-badge-country {
	background: rgba(255, 255, 255, 0.95);
	color: var(--brand-dark);
}

.cd-badge-country:hover {
	background: var(--brand);
	color: var(--white);
}

.cd-badge-cat {
	background: rgba(255, 255, 255, 0.95);
	color: var(--ink);
}

.cd-term-icon-img {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	object-fit: cover;
	display: inline-block;
}

/* Card Body */
.cd-card-body {
	display: flex;
	flex-direction: column;
	padding: 20px;
	flex-grow: 1;
}

.cd-card-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 0.78rem;
	color: var(--muted);
	margin-bottom: 10px;
}

.cd-card-meta i {
	color: var(--brand);
	margin-right: 3px;
}

.cd-card-title {
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.4;
	margin-bottom: 10px;
}

.cd-card-title a {
	color: var(--ink);
}

.cd-card-title a:hover {
	color: var(--brand);
}

.cd-card-excerpt {
	font-size: 0.88rem;
	color: var(--muted);
	line-height: 1.5;
	margin-bottom: 16px;
	flex-grow: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Terms Pills list inside card */
.cd-card-terms-list {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 0.78rem;
	margin-bottom: 16px;
}

.cd-terms-label {
	color: var(--muted);
	font-weight: 600;
}

.cd-term-pill {
	display: inline-block;
	padding: 2px 8px;
	background: var(--mint);
	color: var(--brand-dark);
	border-radius: 4px;
	font-weight: 600;
}

.cd-term-more {
	padding: 2px 6px;
	background: var(--line);
	color: var(--muted);
	border-radius: 4px;
	font-size: 0.7rem;
}

/* Card Footer */
.cd-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-top: 14px;
	border-top: 1px solid var(--line);
}

.cd-btn-readmore {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--brand);
}

.cd-btn-readmore i {
	transition: transform 0.2s ease;
}

.cd-card:hover .cd-btn-readmore i {
	transform: translateX(4px);
}

.cd-card-ext-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--sand);
	color: #b45309;
	font-size: 0.85rem;
	transition: var(--transition);
}

.cd-card-ext-link:hover {
	background: #f59e0b;
	color: var(--white);
	transform: scale(1.1);
}

/* Empty State Box */
.cd-no-posts-box {
	text-align: center;
	padding: 50px 20px;
	background: var(--white);
	border-radius: var(--radius);
	border: 1px solid var(--line);
	color: var(--muted);
}

.cd-no-posts-box i {
	font-size: 3rem;
	color: var(--brand);
	margin-bottom: 12px;
	display: inline-block;
}

.cd-no-posts-box h3 {
	font-size: 1.3rem;
	margin-bottom: 8px;
	color: var(--ink);
}

/* ==========================================================================
   Infinite Scroll Sentinel & Spinner
   ========================================================================== */
.cd-infinite-sentinel {
	margin-top: 40px;
	text-align: center;
	padding: 20px;
}

.cd-infinite-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: var(--muted);
	font-weight: 600;
}

.cd-spinner {
	width: 26px;
	height: 26px;
	border: 3px solid var(--line);
	border-top-color: var(--brand);
	border-radius: 50%;
	animation: cdSpin 0.75s linear infinite;
}

@keyframes cdSpin {
	to { transform: rotate(360deg); }
}

.cd-infinite-end {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: var(--muted);
	font-size: 0.92rem;
	font-weight: 600;
	background: var(--white);
	border: 1px dashed var(--line);
	border-radius: var(--radius-pill);
	padding: 10px 24px;
	display: inline-flex;
}

.cd-infinite-end i {
	color: var(--brand);
}

/* ==========================================================================
   Sitewide Floating Telegram Side Button
   ========================================================================== */
.cd-floating-telegram {
	position: fixed;
	right: 20px;
	bottom: 30px;
	z-index: 9999;
}

.cd-telegram-floating-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: #229ed9;
	color: var(--white);
	padding: 12px 20px;
	border-radius: var(--radius-pill);
	font-weight: 700;
	font-size: 0.95rem;
	box-shadow: 0 8px 25px rgba(34, 158, 217, 0.4);
	position: relative;
	transition: var(--transition);
}

.cd-telegram-floating-btn i {
	font-size: 1.3rem;
}

.cd-telegram-pulse {
	position: absolute;
	inset: 0;
	border-radius: var(--radius-pill);
	border: 2px solid #229ed9;
	animation: cdPulse 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
	pointer-events: none;
}

@keyframes cdPulse {
	0% {
		transform: scale(0.95);
		opacity: 0.8;
	}
	70% {
		transform: scale(1.25);
		opacity: 0;
	}
	100% {
		transform: scale(1.3);
		opacity: 0;
	}
}

.cd-telegram-floating-btn:hover {
	background: #1980b3;
	color: var(--white);
	transform: translateY(-3px) scale(1.02);
	box-shadow: 0 12px 30px rgba(34, 158, 217, 0.5);
}

@media (max-width: 768px) {
	.cd-telegram-floating-label {
		display: none;
	}
	.cd-telegram-floating-btn {
		padding: 12px;
		width: 48px;
		height: 48px;
		border-radius: 50%;
		justify-content: center;
	}
}

/* Back to Top Button */
.cd-back-to-top {
	position: fixed;
	right: 20px;
	bottom: 90px;
	z-index: 9998;
	width: 42px;
	height: 42px;
	background: var(--white);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-subtle);
	opacity: 0;
	visibility: hidden;
	transition: var(--transition);
}

.cd-back-to-top.cd-visible {
	opacity: 1;
	visibility: visible;
}

.cd-back-to-top:hover {
	background: var(--brand);
	color: var(--white);
	transform: translateY(-2px);
}

/* ==========================================================================
   Google AdSense Layouts
   ========================================================================== */
.cd-ad-wrapper {
	margin: 24px auto;
	padding: 12px;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	text-align: center;
	position: relative;
	overflow: hidden;
}

.cd-ad-label {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
	margin-bottom: 8px;
}

.cd-ad-section-small {
	margin: 20px 0;
}

/* Scroller Ad (Bottom Left Sticky) */
.cd-scroller-ad {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 9990;
	background: var(--white);
	padding: 10px;
	border-radius: var(--radius-sm);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	border: 1px solid var(--line);
}

.cd-ad-close-btn {
	position: absolute;
	top: -12px;
	right: -12px;
	width: 26px;
	height: 26px;
	background: var(--ink);
	color: var(--white);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.cd-ad-close-btn:hover {
	background: var(--brand);
}

@media (max-width: 600px) {
	.cd-scroller-ad {
		left: 10px;
		right: 10px;
		bottom: 10px;
		width: calc(100% - 20px);
		text-align: center;
	}
}
