/**
 * Analytics Dashboard Styles
 * 
 * Styles for the Flexible Fees Manager analytics dashboard.
 * Matches the existing plugin design system.
 * 
 * @package Flexible_Fees_Manager_For_WooCommerce
 * @since 1.0.0
 */

/* Dashboard Container */
.ffmw-analytics-dashboard {
	margin: 0;
	padding: 0;
	min-height: 100vh;
}

/* Dashboard Header */
.ffmw-dashboard-header {
	background: #fff;
	border-bottom: 1px solid #e0e0e0;
	padding: 20px 30px;
	margin: 0 0 30px;
}

.ffmw-dashboard-header .header_label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 15px;
}

.ffmw-dashboard-header .header_label p {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #333;
}

.ffmw-dashboard-header .nav_shadow {
	height: 1px;
	background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
	margin: 15px 0;
}

.ffmw-dashboard-header .nav_tab_wrapper {
	display: flex;
	align-items: center;
	gap: 15px;
}

.ffmw-dashboard-header .nav_tab_wrapper img {
	width: 32px;
	height: 32px;
}

.ffmw-dashboard-header .nav_tab_link {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	color: #666;
	font-size: 14px;
	transition: color 0.2s;
}

.ffmw-dashboard-header .nav_tab_link:hover {
	color: #5441ea;
}

.ffmw-dashboard-header .nav_tab_link--active {
	color: #5441ea;
	font-weight: 600;
}

/* Dashboard Content */
.ffmw-dashboard-content {
	padding: 0 30px 30px;
}

.dashboard-header-section {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 30px;
	flex-wrap: wrap;
	gap: 20px;
}

.dashboard-title {
	margin: 0;
	font-size: 28px;
	font-weight: 600;
	color: #333;
}

.dashboard-controls {
	display: flex;
	align-items: center;
	gap: 15px;
}

/* Date Range Picker */
.ffmw-date-range-picker {
	position: relative;
	display: inline-block;
}

.ffmw-date-range-input {
	padding: 8px 40px 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	cursor: pointer;
	background: #fff;
	min-width: 250px;
}

.ffmw-date-range-input:hover {
	border-color: #5441ea;
}

.ffmw-date-range-picker .calendar-icon {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 18px;
	height: 18px;
	cursor: pointer;
	pointer-events: none;
}

.ffmw-clear-filter {
	display: flex;
	align-items: center;
	gap: 5px;
}

/* Metrics Grid */
.ffmw-metrics-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}

.ffmw-metric-card {
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 4px 0 rgb(0 0 0 / .21);
    background-color: #fff0;
}

.ffmw-metric-card:hover {
	transform: translateY(-2px);
	background: #FBFBFB;
    box-shadow: 0 0 4px 0 rgb(0 0 0 / .21);
}

.metric-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 15px;
}

.metric-header h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	color: #666;
	line-height: 1.4;
}

.metric-info-icon {
	cursor: help;
	position: relative;
	cursor: help;
	opacity: 0.6;
	transition: opacity 0.2s;
}

.metric-info-icon:hover {
	opacity: 1;
}

.metric-info-icon .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	color: #999;
}

.metric-value {
	font-size: 32px;
	font-weight: 700;
	color: #333;
	margin-bottom: 10px;
	line-height: 1.2;
}

.metric-change {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
}

.change-indicator {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
}

.change-indicator.positive {
	border-bottom: 6px solid #4caf50;
}

.change-indicator.negative {
	border-top: 6px solid #f44336;
}

.change-indicator.neutral {
	display: none;
}

.change-text {
	color: #666;
}

/* Chart Sections */
.ffmw-chart-section {
	margin-bottom: 30px;
}

.chart-card {
	background: #fff;
	border-radius: 8px;
	padding: 25px;
	box-shadow: 0 0 4px 0 rgb(0 0 0 / .21);
}

.chart-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.chart-header h2 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

.chart-legend {
	display: flex;
	gap: 20px;
}

.chart-legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #666;
}

.chart-legend-color {
	width: 12px;
	height: 12px;
	border-radius: 2px;
}

.chart-container {
	position: relative;
	height: 400px;
	width: 100%;
}

/* Charts Grid */
.ffmw-charts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}

.chart-card-small {
	background: #fff;
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 0 4px 0 rgb(0 0 0 / .21);
}

.chart-card-small .chart-header h3 {
	margin: 0 0 15px 0;
	font-size: 16px;
	font-weight: 600;
	color: #333;
}

.chart-container-small {
	position: relative;
	height: 300px;
	width: 100%;
}

/* Table Section */
.ffmw-table-section {
	margin-bottom: 30px;
}

.table-card {
	background: #fff;
	border-radius: 8px;
	padding: 25px;
	box-shadow: 0 0 4px 0 rgb(0 0 0 / .21);
}

.table-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.table-header h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

.view-all-link {
	display: flex;
	align-items: center;
	gap: 5px;
	text-decoration: none;
	color: #5441ea;
	font-size: 14px;
	transition: color 0.2s;
}

.view-all-link:hover {
	color: #e55a2b;
}

.view-all-link img {
	width: 16px;
	height: 16px;
}

.table-container {
	overflow-x: auto;
	position: relative;
	min-height: 200px;
}

.ffmw-analytics-table {
	width: 100%;
	border-collapse: collapse;
}

.ffmw-analytics-table thead {
	background: #f8f9fa;
}

.ffmw-analytics-table th {
	padding: 12px 15px;
	text-align: left;
	font-size: 13px;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 2px solid #e0e0e0;
}

.ffmw-analytics-table td {
	padding: 15px;
	border-bottom: 1px solid #f0f0f0;
	font-size: 14px;
	color: #333;
}

.ffmw-analytics-table tbody tr:hover {
	background: #f8f9fa;
}

.fee-status {
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 500;
	display: inline-block;
}

.fee-status.status-active {
	background: #e8f5e9;
	color: #2e7d32;
}

.fee-status.status-inactive {
	background: #ffebee;
	color: #c62828;
}

/* Date Picker Modal */
.ffmw-date-picker-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.date-picker-content {
	background: #fff;
	border-radius: 8px;
	width: 90%;
	max-width: 600px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.date-picker-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 25px;
	border-bottom: 1px solid #e0e0e0;
}

.date-picker-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #333;
}

.date-picker-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 5px;
	color: #666;
	transition: color 0.2s;
}

.date-picker-close:hover {
	color: #333;
}

.date-picker-body {
	padding: 25px;
}

.preset-ranges {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-bottom: 25px;
}

.preset-btn {
	padding: 10px 15px;
	background: #f8f9fa;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	color: #333;
	transition: all 0.2s;
}

.preset-btn:hover {
	background: #5441ea;
	color: #fff;
	border-color: #5441ea;
}

.date-inputs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

.date-input-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.date-input-group label {
	font-size: 13px;
	font-weight: 500;
	color: #666;
}

.date-input {
	padding: 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
}

.date-input:focus {
	outline: none;
	border-color: #5441ea;
}

.date-picker-footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 20px 25px;
	border-top: 1px solid #e0e0e0;
}

/* Loading and Error States */
.loading-row,
.text-center {
	text-align: center;
	padding: 40px !important;
}

.spinner.is-active {
	float: none;
	margin: 0 auto;
}

.error-message {
	color: #f44336;
	font-size: 14px;
}

.no-data {
	text-align: center;
	color: #999;
	padding: 40px;
	font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
	.ffmw-metrics-grid {
		grid-template-columns: 1fr;
	}

	.ffmw-charts-grid {
		grid-template-columns: 1fr;
	}

	.dashboard-header-section {
		flex-direction: column;
		align-items: flex-start;
	}

	.preset-ranges {
		grid-template-columns: repeat(2, 1fr);
	}

	.date-inputs {
		grid-template-columns: 1fr;
	}
}

/* Premium Overlay Styles */
.ffmw-premium-overlay-wrapper {
	position: relative;
}

.ffmw-premium-overlay-wrapper .chart-container-small #ffmw-fee-breakdown-chart, .ffmw-premium-overlay-wrapper .chart-container-small #ffmw-orders-trend-chart {
	position: relative;
	filter: blur(2px);
	pointer-events: none;
	user-select: none;
	overflow: hidden;
	padding: 10px;
}

.ffmw-premium-overlay-wrapper .table-container {
	position: relative;
	pointer-events: none;
	user-select: none;
	overflow: visible;
	min-height: 300px;
}

.ffmw-premium-overlay-wrapper .table-container table {
	width: 100%;
}

/* Blur the table content - make it visible but blurred */
.ffmw-premium-overlay-wrapper .table-container table thead {
	filter: blur(3px);
	opacity: 0.75;
}

.ffmw-premium-overlay-wrapper .table-container table tbody {
	filter: blur(2px);
	opacity: 0.7;
}

/* Ensure chart headers are not blurred */
.chart-card-small.ffmw-premium-overlay-wrapper .chart-header,
.table-card.ffmw-premium-overlay-wrapper .table-header {
	filter: none !important;
	opacity: 1 !important;
	pointer-events: auto;
	position: relative;
	z-index: 12;
}

.ffmw-premium-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.75);
	z-index: 10;
	border-radius: 8px;
	backdrop-filter: blur(0);
	pointer-events: auto;
}

.ffmw-premium-overlay-content {
	text-align: center;
	padding: 40px 30px;
	max-width: 320px;
	position: relative;
	z-index: 11;
	background: rgba(255, 255, 255, 0.95);
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ffmw-premium-overlay-content p {
	margin: 0 0 24px;
	font-size: 15px;
	line-height: 1.7;
	color: #333;
	font-weight: 400;
	text-shadow: none;
}

.ffmw-go-pro-btn {
	display: inline-block;
	padding: 12px 28px;
	background: #5441ea;
	color: #fff;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 600;
	font-size: 15px;
	transition: all 0.3s ease;
	box-shadow: 0 2px 6px rgba(84, 65, 234, 0.25);
	border: none;
	cursor: pointer;
}

.ffmw-go-pro-btn:hover {
	background: #4330d9;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(84, 65, 234, 0.35);
	color: #fff;
	text-decoration: none;
}

.ffmw-go-pro-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(84, 65, 234, 0.25);
}

/* Table specific overlay positioning */
.table-container .ffmw-premium-overlay {
	border-radius: 0;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

/* Ensure table header is not blurred and stays visible */
.table-card.ffmw-premium-overlay-wrapper .table-header {
	filter: none !important;
	opacity: 1 !important;
	pointer-events: auto;
	position: relative;
	z-index: 12;
	background: transparent;
}

