/**
 * Aha Partners — Frontend stylesheet.
 *
 * Curated HSL colors, premium typography, card design and micro-animations.
 */

:root {
	--ap-primary: #2563eb;
	--ap-primary-hover: #1d4ed8;
	--ap-secondary: hsl(215, 20%, 98%);
	--ap-text-dark: hsl(220, 15%, 15%);
	--ap-text-muted: hsl(220, 10%, 45%);
	--ap-bg-card: hsl(0, 0%, 100%);
	--ap-border-color: hsl(220, 12%, 90%);
	--ap-success: #10b981;
	--ap-error: #ef4444;
	--ap-shadow: 0 10px 30px rgba(37, 99, 235, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
	--ap-radius: 16px;
}

.aha-partners-registration-container {
	background: var(--ap-bg-card);
	border: 1px solid var(--ap-border-color);
	border-radius: var(--ap-radius);
	box-shadow: var(--ap-shadow);
	padding: 2.5rem;
	max-width: 700px;
	margin: 2rem auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
	box-sizing: border-box;
}

.aha-partners-registration-container * {
	box-sizing: border-box;
}

/* Progress Bar */
.aha-partners-progress-bar {
	display: flex;
	justify-content: space-between;
	margin-bottom: 3rem;
	position: relative;
}

.aha-partners-progress-bar::before {
	content: '';
	position: absolute;
	top: 18px;
	left: 10%;
	right: 10%;
	height: 3px;
	background: var(--ap-border-color);
	z-index: 1;
}

.aha-partners-progress-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	z-index: 2;
	position: relative;
	flex: 1;
}

.aha-partners-progress-step .step-num {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: hsl(0, 0%, 95%);
	color: var(--ap-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 0.95rem;
	border: 2px solid var(--ap-border-color);
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.aha-partners-progress-step .step-label {
	font-size: 0.85rem;
	color: var(--ap-text-muted);
	margin-top: 0.5rem;
	font-weight: 500;
	transition: color 0.4s ease;
}

.aha-partners-progress-step.active .step-num {
	background: var(--ap-primary);
	color: #ffffff;
	border-color: var(--ap-primary);
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.aha-partners-progress-step.active .step-label {
	color: var(--ap-primary);
	font-weight: 600;
}

.aha-partners-progress-step.completed .step-num {
	background: var(--ap-success);
	color: #ffffff;
	border-color: var(--ap-success);
}

/* Form Steps */
.aha-partners-form-step {
	display: none;
	animation: apFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.aha-partners-form-step.active {
	display: block;
}

@keyframes apFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.aha-partners-form-step h3 {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--ap-text-dark);
	margin: 0 0 0.5rem 0;
}

.aha-partners-form-step .step-desc {
	font-size: 0.95rem;
	color: var(--ap-text-muted);
	margin-bottom: 2rem;
}

/* Form Groups */
.form-group {
	margin-bottom: 1.5rem;
	position: relative;
}

.form-group label {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--ap-text-dark);
	margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 2px solid var(--ap-border-color);
	border-radius: 10px;
	font-size: 0.95rem;
	color: var(--ap-text-dark);
	background: #ffffff;
	transition: all 0.3s ease;
	outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
	border-color: var(--ap-primary);
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
	resize: vertical;
	min-height: 120px;
}

/* Instagram Prefix Wrap */
.input-prefix-wrapper {
	display: flex;
	align-items: center;
	position: relative;
}

.input-prefix-wrapper .input-prefix {
	position: absolute;
	left: 12px;
	color: var(--ap-text-muted);
	font-weight: 600;
	font-size: 0.95rem;
	pointer-events: none;
}

.input-prefix-wrapper input {
	padding-left: 2rem !important;
}

/* Actions and Buttons */
.form-actions {
	display: flex;
	justify-content: flex-end;
	gap: 1rem;
	margin-top: 2.5rem;
	border-top: 1px solid var(--ap-border-color);
	padding-top: 1.5rem;
}

.btn {
	padding: 0.75rem 1.75rem;
	font-size: 0.95rem;
	font-weight: 600;
	border-radius: 10px;
	border: none;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	outline: none;
}

.btn-next,
.btn-submit {
	background: var(--ap-primary);
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-next:hover,
.btn-submit:hover {
	background: var(--ap-primary-hover);
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
}

.btn-prev,
.btn-secondary {
	background: hsl(0, 0%, 93%);
	color: var(--ap-text-muted);
}

.btn-prev:hover,
.btn-secondary:hover {
	background: hsl(0, 0%, 88%);
}

.btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none !important;
	box-shadow: none !important;
}

/* Feedback elements */
.validation-msg {
	display: block;
	font-size: 0.8rem;
	margin-top: 0.35rem;
	font-weight: 500;
}

.validation-msg.error {
	color: var(--ap-error);
}

.validation-msg.success {
	color: var(--ap-success);
}

.form-feedback {
	margin-top: 1.5rem;
	padding: 1rem;
	border-radius: 10px;
	font-size: 0.95rem;
	font-weight: 500;
	display: none;
	animation: apFadeIn 0.3s ease;
}

.form-feedback.success {
	display: block;
	background: rgba(16, 185, 129, 0.1);
	color: var(--ap-success);
	border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-feedback.error {
	display: block;
	background: rgba(239, 68, 68, 0.1);
	color: var(--ap-error);
	border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Loading spinner */
.btn-submit.loading {
	color: transparent !important;
	position: relative;
}

.btn-submit.loading::after {
	content: "";
	position: absolute;
	width: 20px;
	height: 20px;
	top: 50%;
	left: 50%;
	margin-top: -10px;
	margin-left: -10px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: apSpin 0.8s linear infinite;
}

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

.required {
	color: var(--ap-error);
	margin-left: 2px;
}

/* Dashboard Styling Integration */
.aha-partners-dashboard {
	margin-top: 2rem;
}

.aha-partners-dashboard h2 {
	font-size: 1.8rem;
	font-weight: 700;
	color: var(--ap-text-dark);
}

.dashboard-intro {
	color: var(--ap-text-muted);
	font-size: 0.95rem;
	margin-bottom: 2rem;
}

/* Details Card */
.ap-details-card {
	background: var(--ap-secondary);
	border: 1px solid var(--ap-border-color);
	border-radius: 12px;
	padding: 1.5rem;
	margin-bottom: 2rem;
}

.ap-details-row {
	display: flex;
	gap: 2rem;
	margin-bottom: 1.25rem;
}

.ap-detail-item {
	display: flex;
	flex-direction: column;
	flex: 1;
}

.ap-detail-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ap-text-muted);
	margin-bottom: 0.25rem;
}

.ap-detail-value {
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--ap-text-dark);
}

.ap-detail-value.highlight {
	color: var(--ap-primary);
}

.referral-link-section {
	border-top: 1px solid var(--ap-border-color);
	padding-top: 1.25rem;
}

.referral-link-copy {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.referral-link-copy input {
	flex-grow: 1;
	background: #ffffff;
	border: 1px solid var(--ap-border-color);
	padding: 0.5rem 0.75rem;
	border-radius: 8px;
	font-size: 0.9rem;
	color: var(--ap-text-dark);
	outline: none;
}

.referral-link-copy button {
	padding: 0.5rem 1.25rem;
	margin: 0;
	font-size: 0.9rem;
	border-radius: 8px;
}

/* Stats Grid */
.ap-stats-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.5rem;
	margin-bottom: 2.5rem;
}

.ap-stat-card {
	background: #ffffff;
	border: 1px solid var(--ap-border-color);
	border-radius: 12px;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ap-stat-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--ap-shadow);
}

.ap-stat-card.highlight {
	border-color: var(--ap-primary);
}

.ap-stat-icon {
	margin-bottom: 0.75rem;
	display: flex;
	justify-content: flex-start;
	align-items: center;
}

.ap-stat-number {
	font-size: 1.6rem;
	font-weight: 700;
	color: var(--ap-text-dark);
	line-height: 1.2;
}

.ap-stat-card.highlight .ap-stat-number {
	color: var(--ap-primary);
}

.ap-stat-title {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ap-text-muted);
	margin-top: 0.25rem;
}

/* History Section */
.ap-history-section h3 {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--ap-text-dark);
	margin-bottom: 1rem;
}

.no-history {
	color: var(--ap-text-muted);
	font-size: 0.95rem;
	font-style: italic;
}

.ap-table-wrapper {
	overflow-x: auto;
	border: 1px solid var(--ap-border-color);
	border-radius: 12px;
}

.ap-history-table {
	display: table !important;
	width: 100% !important;
	border-collapse: collapse;
	font-size: 0.9rem;
	text-align: left;
	margin: 0;
	background: #ffffff;
}

.ap-history-table th,
.ap-history-table td {
	padding: 1rem;
	border-bottom: 1px solid var(--ap-border-color);
}

.ap-history-table th {
	background: var(--ap-secondary);
	font-weight: 600;
	color: var(--ap-text-dark);
}

.ap-history-table tr:last-child td {
	border-bottom: none;
}

.ap-history-table td.commission-value {
	font-weight: 700;
	color: var(--ap-primary);
}

/* Badges */
.ap-badge {
	display: inline-block;
	padding: 0.25rem 0.6rem;
	border-radius: 20px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
}

.ap-badge.pending {
	background: rgba(245, 158, 11, 0.1);
	color: #d97706;
}

.ap-badge.paid {
	background: rgba(16, 185, 129, 0.1);
	color: var(--ap-success);
}

.ap-badge.cancelled {
	background: rgba(239, 68, 68, 0.1);
	color: var(--ap-error);
}

@media (max-width: 600px) {
	.ap-stats-grid {
		grid-template-columns: 1fr;
	}

	.ap-details-row {
		flex-direction: column;
		gap: 1rem;
	}
	
	.referral-link-copy {
		flex-direction: column;
	}
	
	.referral-link-copy button {
		width: 100%;
	}

	.ap-analytics-kpi-grid {
		grid-template-columns: 1fr;
	}

	.ap-comparison-grid {
		grid-template-columns: 1fr;
	}

	.ap-chart-amount {
		display: none;
	}
}

/* ═══════════════════════════════════════════════════════════════════════
   ANALYTICS TAB STYLES
═══════════════════════════════════════════════════════════════════════ */

/* ─ KPI Grid ─────────────────────────────────────────────────────────── */
.ap-analytics-kpi-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-bottom: 24px;
}

.ap-kpi-card {
	background: var(--ap-bg-card);
	border: 1px solid var(--ap-border-color);
	border-radius: 14px;
	padding: 1.25rem 1.25rem 1rem;
	border-top: 4px solid var(--kpi-accent, var(--ap-primary));
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-kpi-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(0,0,0,0.09);
}

.ap-kpi-icon {
	color: var(--kpi-accent, var(--ap-primary));
	margin-bottom: 10px;
	opacity: 0.85;
}

.ap-kpi-value {
	font-size: 1.7rem;
	font-weight: 800;
	color: var(--ap-text-dark);
	line-height: 1;
	margin-bottom: 6px;
}

.ap-kpi-value .woocommerce-Price-amount {
	font-size: 1.7rem;
	font-weight: 800;
}

.ap-kpi-label {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ap-text-dark);
	margin-bottom: 3px;
}

.ap-kpi-sublabel {
	font-size: 0.75rem;
	color: var(--ap-text-muted);
}

/* ─ Month Comparison Cards ───────────────────────────────────────────── */
.ap-comparison-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 24px;
}

.ap-comparison-card {
	background: var(--ap-bg-card);
	border: 1px solid var(--ap-border-color);
	border-radius: 14px;
	padding: 1.25rem 1.5rem;
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.ap-comparison-best {
	background: linear-gradient(135deg, hsl(43, 100%, 97%), hsl(43, 100%, 100%));
	border-color: hsl(43, 90%, 80%);
}

.ap-comparison-header {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--ap-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 10px;
}

.ap-comparison-best .ap-comparison-header {
	color: hsl(43, 80%, 40%);
}

.ap-comparison-value {
	font-size: 1.6rem;
	font-weight: 800;
	color: var(--ap-text-dark);
	margin-bottom: 8px;
	line-height: 1.1;
}

.ap-comparison-value .woocommerce-Price-amount {
	font-size: 1.6rem;
	font-weight: 800;
}

.ap-comparison-sub {
	font-size: 0.82rem;
	color: var(--ap-text-muted);
}

/* Trend badges */
.ap-trend-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.78rem;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 100px;
}

.ap-trend-up {
	background: hsl(142, 70%, 93%);
	color: hsl(142, 60%, 28%);
}

.ap-trend-down {
	background: hsl(0, 80%, 95%);
	color: hsl(0, 65%, 40%);
}

/* ─ Section Title ────────────────────────────────────────────────────── */
.ap-section-title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--ap-text-dark);
	margin: 0 0 16px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--ap-border-color);
}

/* ─ CSS Bar Chart ────────────────────────────────────────────────────── */
.ap-chart-wrap {
	background: var(--ap-bg-card);
	border: 1px solid var(--ap-border-color);
	border-radius: 14px;
	padding: 1.5rem;
	margin-bottom: 24px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.ap-chart-outer {
	overflow-x: auto;
}

.ap-chart-bars {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	height: 160px;
	min-width: 500px;
	padding-bottom: 0;
}

.ap-chart-bar-col {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	height: 100%;
	gap: 5px;
	cursor: default;
}

.ap-chart-bar-col:hover .ap-chart-bar {
	opacity: 0.75;
	transform: scaleY(1.02);
	transform-origin: bottom;
}

.ap-chart-bar {
	width: 100%;
	background: linear-gradient(180deg, hsl(217, 91%, 60%) 0%, hsl(217, 91%, 50%) 100%);
	border-radius: 4px 4px 0 0;
	transition: height 0.4s ease, opacity 0.2s ease, transform 0.2s ease;
	min-height: 2px;
}

.ap-chart-bar.ap-bar-current {
	background: linear-gradient(180deg, hsl(142, 72%, 55%) 0%, hsl(142, 72%, 42%) 100%);
}

.ap-chart-label {
	font-size: 0.68rem;
	color: var(--ap-text-muted);
	text-align: center;
	white-space: nowrap;
	flex-shrink: 0;
}

.ap-chart-amount {
	font-size: 0.6rem;
	color: var(--ap-text-muted);
	text-align: center;
	white-space: nowrap;
	line-height: 1.2;
	flex-shrink: 0;
}

.ap-chart-amount .woocommerce-Price-amount {
	font-size: 0.6rem;
}

/* ─ Top Products Table ───────────────────────────────────────────────── */
.ap-analytics-table-wrap {
	background: var(--ap-bg-card);
	border: 1px solid var(--ap-border-color);
	border-radius: 14px;
	padding: 1.5rem;
	margin-bottom: 24px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.ap-analytics-products-table th,
.ap-analytics-products-table td {
	display: table-cell;
}

.ap-rank-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--ap-primary);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	flex-shrink: 0;
}

/* ─ Referral Link Section ────────────────────────────────────────────── */
.ap-analytics-ref-wrap {
	background: var(--ap-bg-card);
	border: 1px solid var(--ap-border-color);
	border-radius: 14px;
	padding: 1.5rem;
	margin-bottom: 24px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}