/**
 * Authority Mailer Dashboard Widgets Styles
 *
 * Styles specific to WordPress dashboard widgets.
 *
 * @package Authority_Mailer
 * @since   1.0.0
 */

/* ===================================================================
   Dashboard Widget Container
   =================================================================== */

#authority_mailer_analytics_widget .inside {
	margin: 0;
	padding: 0;
	max-width: 100%;
	overflow: hidden;
}

#authority_mailer_health_widget .inside {
	margin: 0;
	padding: 0;
	max-width: 100%;
	overflow: hidden;
}

.am-dashboard-widget {
	padding: var(--am-space-4);
	max-width: 100%;
	box-sizing: border-box;
}

/* ===================================================================
   Stats Grid
   =================================================================== */

#authority_mailer_analytics_widget .am-dashboard-stats,
#authority_mailer_health_widget .am-dashboard-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
	margin: 20px 0;
	max-width: 100%;
	overflow: hidden;
}

@media (max-width: 1200px) {
	#authority_mailer_analytics_widget .am-dashboard-stats,
	#authority_mailer_health_widget .am-dashboard-stats {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	#authority_mailer_analytics_widget .am-dashboard-stats,
	#authority_mailer_health_widget .am-dashboard-stats {
		grid-template-columns: 1fr;
	}
}

/* Stat Card */
.am-dashboard-stat {
	background: linear-gradient(135deg, var(--am-primary) 0%, var(--am-info) 100%);
	border-radius: var(--am-radius-lg);
	padding: var(--am-space-4);
	color: #fff;
	position: relative;
	overflow: hidden;
}

.am-dashboard-stat::before {
	content: "";
	position: absolute;
	top: -50%;
	right: -20%;
	width: 200px;
	height: 200px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 50%;
}

.am-dashboard-stat-label {
	display: block;
	font-size: var(--am-text-xs);
	font-weight: var(--am-weight-medium);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.9;
	margin-bottom: var(--am-space-2);
}

.am-dashboard-stat-value {
	display: block;
	font-size: var(--am-text-2xl);
	font-weight: var(--am-weight-bold);
	line-height: 1.2;
}

.am-dashboard-stat.success {
	background: linear-gradient(135deg, var(--am-success) 0%, #059669 100%);
}

.am-dashboard-stat.error {
	background: linear-gradient(135deg, var(--am-error) 0%, #DC2626 100%);
}

.am-dashboard-stat.warning {
	background: linear-gradient(135deg, var(--am-warning) 0%, #D97706 100%);
}

/* ===================================================================
   Quick Actions
   =================================================================== */

.am-dashboard-actions {
	display: flex;
	gap: var(--am-space-3);
	padding: var(--am-space-4);
	background: var(--am-gray-50);
	border-radius: var(--am-radius-md);
	margin-bottom: var(--am-space-6);
}

@media (max-width: 782px) {
	.am-dashboard-actions {
		flex-direction: column;
	}
}

.am-dashboard-action {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--am-space-3);
	background: #fff;
	border: 1px solid var(--am-gray-200);
	border-radius: var(--am-radius-md);
	text-decoration: none;
	color: var(--am-gray-700);
	font-size: var(--am-text-sm);
	font-weight: var(--am-weight-medium);
	transition: all var(--am-transition-fast);
}

.am-dashboard-action:hover {
	background: var(--am-primary);
	color: #fff;
	border-color: var(--am-primary);
	transform: translateY(-1px);
	box-shadow: var(--am-shadow-sm);
}

/* ===================================================================
   Recent Activity
   =================================================================== */

.am-dashboard-activity {
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-dashboard-activity-item {
	display: flex;
	align-items: flex-start;
	gap: var(--am-space-3);
	padding: var(--am-space-3);
	border-bottom: 1px solid var(--am-gray-200);
}

.am-dashboard-activity-item:last-child {
	border-bottom: none;
}

.am-dashboard-activity-icon {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--am-gray-100);
	border-radius: 50%;
	color: var(--am-gray-600);
	font-size: var(--am-text-sm);
}

.am-dashboard-activity-icon.success {
	background: var(--am-success-light);
	color: var(--am-success);
}

.am-dashboard-activity-icon.error {
	background: var(--am-error-light);
	color: var(--am-error);
}

.am-dashboard-activity-content {
	flex: 1;
}

.am-dashboard-activity-title {
	font-size: var(--am-text-sm);
	font-weight: var(--am-weight-medium);
	color: var(--am-gray-900);
	margin: 0 0 var(--am-space-1) 0;
}

.am-dashboard-activity-time {
	font-size: var(--am-text-xs);
	color: var(--am-gray-500);
}

/* ===================================================================
   Chart Container
   =================================================================== */

.am-dashboard-chart {
	padding: var(--am-space-4);
	background: #fff;
	border: 1px solid var(--am-gray-200);
	border-radius: var(--am-radius-lg);
	margin-bottom: 32px;
}

.am-dashboard-chart-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--am-space-4);
	padding-bottom: var(--am-space-3);
	border-bottom: 1px solid var(--am-gray-200);
}

.am-dashboard-chart-title {
	font-size: var(--am-text-base);
	font-weight: var(--am-weight-semibold);
	color: var(--am-gray-900);
	margin: 0;
}

.am-dashboard-chart-legend {
	display: flex;
	gap: var(--am-space-4);
}

.am-dashboard-chart-legend-item {
	display: flex;
	align-items: center;
	gap: var(--am-space-2);
	font-size: var(--am-text-xs);
	color: var(--am-gray-600);
}

.am-dashboard-chart-legend-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.am-dashboard-chart-body {
	position: relative;
	height: 200px;
}

/* ===================================================================
   Email Analytics Chart (Next-Gen Dashboard)
   =================================================================== */

.am-chart-card {
	margin-bottom: 32px;
	background: #fff;
	border-radius: var(--am-radius-lg);
	box-shadow: var(--am-shadow-sm);
	border: 1px solid var(--am-gray-200);
	overflow: hidden;
	transition: all var(--am-transition);
}

.am-chart-card:hover {
	box-shadow: var(--am-shadow-md);
}

.am-chart-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	padding: 24px;
	border-bottom: 1px solid var(--am-gray-200);
	background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

.am-chart-title-wrapper {
	display: flex;
	align-items: center;
	gap: 12px;
}

.am-chart-title-wrapper .am-card-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--am-gray-900);
	display: flex;
	align-items: center;
	gap: 10px;
}

.am-chart-title-wrapper svg {
	color: var(--am-brand-primary);
}

/* Chart Toggle Buttons */
.am-chart-toggle-buttons {
	display: flex;
	gap: 8px;
	background: var(--am-gray-100);
	padding: 4px;
	border-radius: 8px;
}

.am-chart-toggle {
	padding: 8px 16px;
	border: none;
	background: transparent;
	color: var(--am-gray-600);
	font-size: 13px;
	font-weight: 500;
	border-radius: 6px;
	cursor: pointer;
	transition: all var(--am-transition-fast);
	font-family: var(--am-font-sans);
}

.am-chart-toggle:hover {
	background: rgba(99, 102, 241, 0.1);
	color: var(--am-brand-primary);
}

.am-chart-toggle.active {
	background: var(--am-brand-primary);
	color: #fff;
	box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.am-chart-toggle:focus {
	outline: 2px solid var(--am-brand-primary);
	outline-offset: 2px;
}

/* Chart Body */
.am-chart-body {
	padding: 24px;
}

.am-chart-legend {
	display: flex;
	gap: 24px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.am-chart-legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--am-gray-700);
	font-weight: 500;
}

.am-chart-legend-dot {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	flex-shrink: 0;
}

.am-chart-container {
	position: relative;
	height: 350px;
	width: 100%;
}

.am-chart-container canvas {
	max-height: 350px;
}

/* Responsive Design */
@media (max-width: 1199px) {
	.am-chart-container {
		height: 300px;
	}
	
	.am-chart-container canvas {
		max-height: 300px;
	}
}

@media (max-width: 768px) {
	.am-chart-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}
	
	.am-chart-toggle-buttons {
		width: 100%;
	}
	
	.am-chart-toggle {
		flex: 1;
		text-align: center;
		padding: 10px 12px;
		font-size: 12px;
	}
	
	.am-chart-container {
		height: 250px;
	}
	
	.am-chart-container canvas {
		max-height: 250px;
	}
	
	.am-chart-legend {
		gap: 16px;
	}
}

/* ===================================================================
   Empty State
   =================================================================== */

.am-dashboard-empty {
	text-align: center;
	padding: var(--am-space-8);
	color: var(--am-gray-500);
}

.am-dashboard-empty-icon {
	font-size: 48px;
	opacity: 0.3;
	margin-bottom: var(--am-space-4);
}

.am-dashboard-empty-title {
	font-size: var(--am-text-lg);
	font-weight: var(--am-weight-semibold);
	color: var(--am-gray-700);
	margin: 0 0 var(--am-space-2) 0;
}

.am-dashboard-empty-text {
	font-size: var(--am-text-sm);
	color: var(--am-gray-500);
	margin: 0 0 var(--am-space-4) 0;
}

/* ===================================================================
   Health Indicator
   =================================================================== */

.am-dashboard-health {
	display: flex;
	align-items: center;
	gap: var(--am-space-3);
	padding: var(--am-space-4);
	background: var(--am-gray-50);
	border-radius: var(--am-radius-lg);
	margin-bottom: var(--am-space-6);
}

.am-dashboard-health-icon {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-size: var(--am-text-xl);
}

.am-dashboard-health.healthy .am-dashboard-health-icon {
	background: var(--am-success-light);
	color: var(--am-success);
}

.am-dashboard-health.warning .am-dashboard-health-icon {
	background: var(--am-warning-light);
	color: var(--am-warning);
}

.am-dashboard-health.critical .am-dashboard-health-icon {
	background: var(--am-error-light);
	color: var(--am-error);
}

.am-dashboard-health-content {
	flex: 1;
}

.am-dashboard-health-title {
	font-size: var(--am-text-base);
	font-weight: var(--am-weight-semibold);
	color: var(--am-gray-900);
	margin: 0 0 var(--am-space-1) 0;
}

.am-dashboard-health-text {
	font-size: var(--am-text-sm);
	color: var(--am-gray-600);
	margin: 0;
}

/* ===================================================================
   Widget Footer
   =================================================================== */

.am-dashboard-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--am-space-4);
	border-top: 1px solid var(--am-gray-200);
	margin-top: var(--am-space-6);
}

.am-dashboard-footer-link {
	font-size: var(--am-text-sm);
	color: var(--am-primary);
	text-decoration: none;
	font-weight: var(--am-weight-medium);
	transition: color var(--am-transition-fast);
}

.am-dashboard-footer-link:hover {
	color: var(--am-primary-hover);
}

.am-dashboard-footer-meta {
	font-size: var(--am-text-xs);
	color: var(--am-gray-500);
}

/* ===================================================================
   Chart Empty State
   =================================================================== */

.am-chart-empty-state {
	text-align: center;
	padding: 80px 24px;
	background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
	border-radius: var(--am-radius-md);
}

.am-chart-empty-icon {
	margin-bottom: 24px;
	color: #cbd5e1;
}

.am-chart-empty-icon svg {
	width: 64px;
	height: 64px;
	opacity: 0.5;
}

.am-chart-empty-title {
	font-size: 20px;
	font-weight: 600;
	color: #1f2937;
	margin: 0 0 12px 0;
}

.am-chart-empty-desc {
	font-size: 15px;
	color: #6b7280;
	margin: 0 0 28px 0;
	line-height: 1.6;
	max-width: 400px;
	margin-left: auto;
	margin-right: auto;
}

.am-chart-empty-state .am-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
}

/* Reduced height for empty chart state */
.am-chart-empty-reduced {
	padding: 48px 24px;
	min-height: 300px;
}

.am-chart-empty-reduced .am-empty-illustration svg {
	width: 100px;
	height: 100px;
}

.am-empty-state-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	margin-top: 20px;
}

.am-empty-state-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--am-gray-900);
	margin: 16px 0 8px;
}

.am-empty-state-description {
	font-size: 14px;
	color: var(--am-gray-600);
	margin: 0 0 20px;
	line-height: 1.6;
}

/* ===================================================================
   Accessibility Improvements
   =================================================================== */

/* Skip to content link */
.am-skip-to-content {
	position: absolute;
	top: -40px;
	left: 0;
	background: var(--am-brand-primary);
	color: white;
	padding: 8px 16px;
	text-decoration: none;
	border-radius: 4px;
	z-index: 100;
}

.am-skip-to-content:focus {
	top: 10px;
	left: 10px;
}

/* Improved focus states for chart toggle buttons */
.am-chart-toggle:focus {
	outline: 2px solid var(--am-brand-primary);
	outline-offset: 2px;
}

.am-chart-toggle:focus:not(:focus-visible) {
	outline: none;
}

/* Ensure stat card tooltips are accessible */
.am-stat-card[title] {
	cursor: help;
}

/* Better keyboard navigation for interactive elements */
.am-view-all-link:focus,
.am-stat-trend a:focus {
	outline: 2px solid var(--am-brand-primary);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ===================================================================
   Tooltip Enhancements
   =================================================================== */

/* Stat card info icon for tooltips */
.am-stat-info-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	margin-left: 4px;
	color: rgba(255, 255, 255, 0.7);
	cursor: help;
	vertical-align: middle;
}

.am-stat-info-icon:hover {
	color: rgba(255, 255, 255, 0.9);
}

/* ===================================================================
   Responsive Empty State
   =================================================================== */

@media (max-width: 768px) {
	.am-chart-empty-state {
		padding: 60px 20px;
	}

	.am-chart-empty-icon svg {
		width: 48px;
		height: 48px;
	}

	.am-chart-empty-title {
		font-size: 18px;
	}

	.am-chart-empty-desc {
		font-size: 14px;
	}
}
