/**
 * AdFuz Stats Dashboard — admin CSS
 *
 * Tailwind utility classes are used in the template;
 * this file adds all bespoke Stats-specific components that
 * cannot be expressed cleanly as utilities.
 *
 * @since 1.0.0
 */

/* ----------------------------------------------------------------
   Layout wrapper
---------------------------------------------------------------- */
.adfuz-stats-wrap {
	max-width: 1600px;
}

/* ----------------------------------------------------------------
   Top toolbar
---------------------------------------------------------------- */
.adfuz-stats-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px;
	padding: 14px 16px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	margin-bottom: 20px;
}

.adfuz-filter-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.adfuz-filter-label {
	font-size: 11px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.adfuz-select {
	height: 34px;
	padding: 0 28px 0 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	background: #f9fafb;
	color: #111827;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	cursor: pointer;
}

.adfuz-select:focus {
	outline: 2px solid #01696f;
	outline-offset: 1px;
}

.adfuz-select--sm {
	width: 80px;
}

.adfuz-input {
	height: 34px;
	padding: 0 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	background: #f9fafb;
	color: #111827;
}

.adfuz-input:focus {
	outline: 2px solid #01696f;
	outline-offset: 1px;
}

.adfuz-toolbar-actions {
	display: flex;
	gap: 8px;
	margin-left: auto;
}

.adfuz-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 14px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: background .15s, box-shadow .15s;
}

.adfuz-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.adfuz-btn-primary {
	background: #01696f;
	color: #fff;
}

.adfuz-btn-primary:hover {
	background: #0c4e54;
}

.adfuz-btn-secondary {
	background: #f3f4f6;
	color: #374151;
	border: 1px solid #d1d5db;
}

.adfuz-btn-secondary:hover {
	background: #e5e7eb;
}

.hidden {
	display: none !important;
}

/* ----------------------------------------------------------------
   KPI cards
---------------------------------------------------------------- */
.adfuz-kpi-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax(220px, 1fr) );
	gap: 16px;
	margin-bottom: 20px;
}

.adfuz-kpi-card {
	display: flex;
	align-items: center;
	gap: 14px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 18px 20px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.adfuz-kpi-icon {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.adfuz-kpi-icon .dashicons {
	font-size: 22px;
	width: 22px;
	height: 22px;
}

.adfuz-kpi-icon--blue {
	background: #dbeafe;
	color: #1d4ed8;
}

.adfuz-kpi-icon--green {
	background: #dcfce7;
	color: #15803d;
}

.adfuz-kpi-icon--orange {
	background: #ffedd5;
	color: #c2410c;
}

.adfuz-kpi-icon--purple {
	background: #f3e8ff;
	color: #7e22ce;
}

.adfuz-kpi-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.adfuz-kpi-label {
	font-size: 12px;
	color: #6b7280;
	font-weight: 500;
}

.adfuz-kpi-value {
	font-size: 24px;
	font-weight: 700;
	color: #111827;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.adfuz-kpi-delta {
	font-size: 11px;
}

.adfuz-delta--up {
	color: #15803d;
}

.adfuz-delta--down {
	color: #b91c1c;
}

/* ----------------------------------------------------------------
   Chart grid rows
---------------------------------------------------------------- */
.adfuz-charts-row {
	display: grid;
	gap: 16px;
	margin-bottom: 20px;
}

.adfuz-charts-row--2col {
	grid-template-columns: 2fr 1fr;
}

.adfuz-charts-row--3col {
	grid-template-columns: repeat(3, 1fr);
}

@media ( max-width: 1100px ) {
	.adfuz-charts-row--2col,
	.adfuz-charts-row--3col {
		grid-template-columns: 1fr;
	}
}

.adfuz-chart-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 18px 20px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.adfuz-chart-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.adfuz-chart-header h3 {
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	margin: 0;
}

.adfuz-chart-controls {
	display: flex;
	gap: 4px;
}

.adfuz-tab-btn {
	padding: 3px 10px;
	border-radius: 5px;
	font-size: 12px;
	font-weight: 500;
	background: #f3f4f6;
	color: #374151;
	border: none;
	cursor: pointer;
	transition: background .12s, color .12s;
}

.adfuz-tab-btn.active {
	background: #01696f;
	color: #fff;
}

.adfuz-tab-btn:hover:not(.active) {
	background: #e5e7eb;
}

.adfuz-chart-wrap {
	position: relative;
	height: 260px;
}

.adfuz-chart-wrap--donut {
	height: 260px;
}

canvas {
	display: block;
}

/* Skeleton shimmer */
.adfuz-chart-skeleton {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
	background-size: 200% 100%;
	animation: adfuz-shimmer 1.4s ease-in-out infinite;
	border-radius: 6px;
}

@keyframes adfuz-shimmer {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

/* ----------------------------------------------------------------
   Data table card
---------------------------------------------------------------- */
.adfuz-table-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
	overflow: hidden;
}

.adfuz-table-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid #f3f4f6;
	flex-wrap: wrap;
	gap: 10px;
}

.adfuz-table-header h3 {
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	margin: 0;
}

.adfuz-table-toolbar {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	flex-wrap: wrap;
}

.adfuz-table-toolbar .adfuz-input {
	width: 220px;
}

.adfuz-table-wrap {
	overflow-x: auto;
}

.adfuz-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.adfuz-table thead tr {
	background: #f9fafb;
	border-bottom: 2px solid #e5e7eb;
}

.adfuz-table th {
	padding: 10px 14px;
	text-align: left;
	font-size: 12px;
	font-weight: 600;
	color: #374151;
	white-space: nowrap;
	user-select: none;
}

.adfuz-table th.num {
	text-align: right;
}

.adfuz-table th.sortable {
	cursor: pointer;
}

.adfuz-table th.sortable:hover {
	color: #01696f;
}

.adfuz-table th.asc .sort-icon::after {
	content: ' ▲';
}

.adfuz-table th.desc .sort-icon::after {
	content: ' ▼';
}

.adfuz-table td {
	padding: 9px 14px;
	border-bottom: 1px solid #f3f4f6;
	color: #374151;
	vertical-align: middle;
}

.adfuz-table td.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.adfuz-table td.nowrap {
	white-space: nowrap;
}

.adfuz-table tbody tr:last-child td {
	border-bottom: none;
}

.adfuz-table tbody tr:hover {
	background: #fafafa;
}

/* CTR visual bar cell */
.ctr-bar-cell {
	position: relative;
	min-width: 100px;
}

.ctr-bar {
	height: 6px;
	border-radius: 3px;
	transition: width .3s;
	margin-bottom: 2px;
}

.ctr-bar-cell span {
	font-size: 11px;
	color: #6b7280;
	font-variant-numeric: tabular-nums;
}

.adfuz-table-loading,
.adfuz-table-empty {
	text-align: center;
	padding: 40px 0;
	color: #9ca3af;
	font-size: 13px;
}

.adfuz-table-loading .spinner {
	vertical-align: middle;
	margin-right: 6px;
}

/* ----------------------------------------------------------------
   Pagination bar
---------------------------------------------------------------- */
.adfuz-pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 18px;
	border-top: 1px solid #f3f4f6;
	flex-wrap: wrap;
	gap: 8px;
}

.adfuz-pager-info {
	font-size: 12px;
	color: #6b7280;
	padding: 10px;
}

.adfuz-pager-btns {
	display: flex;
	gap: 4px;
	align-items: center;
	flex-wrap: wrap;
	padding: 10px;
}

.adfuz-pager-btn {
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	background: #f9fafb;
	color: #374151;
	border: 1px solid #e5e7eb;
	cursor: pointer;
	transition: background .12s, color .12s;
}

.adfuz-pager-btn:hover:not([disabled]):not(.active) {
	background: #e5e7eb;
}

.adfuz-pager-btn.active {
	background: #01696f;
	color: #fff;
	border-color: #01696f;
}

.adfuz-pager-btn[disabled] {
	opacity: .4;
	cursor: default;
}

.adfuz-pager-ellipsis {
	font-size: 13px;
	color: #9ca3af;
	padding: 0 4px;
}

/* ----------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */
@media ( max-width: 782px ) {
	.adfuz-stats-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.adfuz-toolbar-actions {
		margin-left: 0;
	}

	.adfuz-table-toolbar .adfuz-input {
		width: 100%;
	}

	.adfuz-table-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.adfuz-table-toolbar {
		width: 100%;
	}
}

.adfuz-stats-tabs a {
	text-decoration: none;
}

@media (max-width: 1200px) {
	.adfuz-dashboard-shell {
		grid-template-columns: 1fr !important;
	}
}

/* Slim widget card */
.adfuz-side-widget-item {
	display: block;
	padding: 8px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background: #fff;
	transition: border-color .15s, box-shadow .15s;
}

.adfuz-side-widget-item:hover {
	border-color: #01696f;
	box-shadow: 0 2px 8px rgba(1, 105, 111, 0.08);
}

/* Left: country code label */
.adfuz-side-widget-title {
	font-size: 12px;
	font-weight: 700;
	color: #374151;
	letter-spacing: .04em;
	min-width: 28px;
	text-transform: uppercase;
	padding-bottom: 10px;
}

/* Right: stats group */
.adfuz-side-widget-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

/* Primary stat value */
.adfuz-side-widget-stat {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
	font-variant-numeric: tabular-nums;
	display: flex;
	align-items: center;
	gap: 3px;
}

/* Secondary note */
.adfuz-side-widget-note {
	font-size: 12px;
	font-weight: 500;
	color: #6b7280;
	display: flex;
	align-items: center;
	gap: 3px;
	font-variant-numeric: tabular-nums;
}


.adfuz-export-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px 12px;
}

.adfuz-export-title {
	margin: 0 0 4px;
	font-size: 18px;
	font-weight: 600;
	color: #1e293b;
}

.adfuz-export-subtitle {
	margin: 0;
	font-size: 13px;
	color: #64748b;
}

.adfuz-export-table-wrap {
	overflow-x: auto;
}

.adfuz-export-table {
	min-width: 980px;
	table-layout: fixed;
}

.adfuz-export-table th,
.adfuz-export-table td {
	vertical-align: middle;
}

.adfuz-export-file-cell {
	min-width: 320px;
}

.adfuz-export-file-name {
	font-size: 14px;
	font-weight: 600;
	color: #1e293b;
	word-break: break-word;
}

.adfuz-export-meta {
	margin-top: 4px;
	font-size: 12px;
	color: #64748b;
	word-break: break-word;
}

.adfuz-export-meta.is-error {
	color: #b42318;
}

.adfuz-export-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.adfuz-export-badge.is-queued {
	background: #fff7ed;
	color: #c2410c;
}

.adfuz-export-badge.is-processing {
	background: #eff6ff;
	color: #1d4ed8;
}

.adfuz-export-badge.is-completed {
	background: #ecfdf3;
	color: #027a48;
}

.adfuz-export-badge.is-failed {
	background: #fef3f2;
	color: #b42318;
}

.adfuz-export-badge.is-expired {
	background: #f8fafc;
	color: #475569;
}

.adfuz-export-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.adfuz-export-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #fff;
	color: #0f172a;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
}

.adfuz-export-btn:hover {
	background: #f8fafc;
	border-color: #94a3b8;
}

.adfuz-export-btn.is-download {
	color: #0f766e;
	border-color: #99f6e4;
	background: #f0fdfa;
}

.adfuz-export-btn.is-download:hover {
	background: #ccfbf1;
	border-color: #5eead4;
}

.adfuz-export-btn.is-delete {
	color: #b42318;
	border-color: #fecaca;
	background: #fff;
}

.adfuz-export-btn.is-delete:hover {
	background: #fef2f2;
	border-color: #fca5a5;
}

.adfuz-export-inline-note {
	font-size: 12px;
	color: #64748b;
	white-space: nowrap;
}

.adfuz-export-actions-col {
	width: 220px;
}

.adfuz-spin {
	animation: adfuz-spin-kf 0.8s linear infinite;
	transform-origin: center center;
}

@keyframes adfuz-spin-kf {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.adfuz-nav-pulse-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: #10b981;
	margin-left: 6px;
	vertical-align: middle;
	box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
	animation: adfuz-pulse-ring 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes adfuz-pulse-ring {
	0% {
		box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
	}
	70% {
		box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
	}
}

