/**
 * Frontend Styling - Affiliate System & WhatsApp Order Tracker
 * Premium modern design, responsive grids, and high-converting CTA buttons
 */

:root {
	--aff-primary: #10b981;
	--aff-primary-hover: #059669;
	--aff-secondary: #3b82f6;
	--aff-dark: #1e293b;
	--aff-light: #f8fafc;
	--aff-border: #e2e8f0;
	--aff-text: #334155;
	--aff-text-muted: #64748b;
	--aff-wa-green: #25d366;
	--aff-wa-green-hover: #20ba5a;
	--aff-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
	--aff-card-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
	--aff-radius: 12px;
}

.aff-dashboard-wrapper,
.aff-catalog-container,
.aff-product-single-container,
.aff-register-card {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: var(--aff-text);
	box-sizing: border-box;
}

.aff-dashboard-wrapper *,
.aff-catalog-container *,
.aff-product-single-container *,
.aff-register-card * {
	box-sizing: border-box;
}

/* ==========================================================================
   Dashboard Header & Balance Card
   ========================================================================== */
.aff-dashboard-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #ffffff;
	padding: 24px;
	border-radius: var(--aff-radius);
	box-shadow: var(--aff-card-shadow);
	margin-bottom: 24px;
	border: 1px solid var(--aff-border);
	flex-wrap: wrap;
	gap: 16px;
}

.aff-user-meta {
	display: flex;
	align-items: center;
	gap: 16px;
}

.aff-user-avatar img {
	border-radius: 50%;
	border: 3px solid #e2e8f0;
}

.aff-user-name {
	margin: 0 0 6px 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--aff-dark);
}

.aff-user-id-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #f1f5f9;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 13px;
	color: #475569;
}

.aff-user-id-badge strong {
	color: #0f172a;
}

.aff-balance-hero {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	padding: 16px 20px;
	border-radius: var(--aff-radius);
}

.aff-balance-label {
	font-size: 13px;
	color: #166534;
	font-weight: 600;
}

.aff-balance-amount {
	font-size: 28px;
	font-weight: 800;
	color: #15803d;
	margin: 4px 0 10px 0;
}

/* ==========================================================================
   Tabs Navigation
   ========================================================================== */
.aff-tabs-nav {
	display: flex;
	gap: 8px;
	border-bottom: 2px solid #e2e8f0;
	margin-bottom: 24px;
	overflow-x: auto;
	padding-bottom: 4px;
	scrollbar-width: thin;
}

.aff-tab-btn {
	background: transparent;
	border: none;
	padding: 12px 18px;
	font-size: 15px;
	font-weight: 600;
	color: var(--aff-text-muted);
	cursor: pointer;
	border-bottom: 3px solid transparent;
	transition: all 0.2s ease;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.aff-tab-btn:hover {
	color: var(--aff-dark);
}

.aff-tab-btn.active {
	color: var(--aff-primary-hover);
	border-bottom-color: var(--aff-primary);
}

.aff-tab-pane {
	display: none;
}

.aff-tab-pane.active {
	display: block;
	animation: affFadeIn 0.3s ease;
}

@keyframes affFadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Dashboard Metric Cards Grid
   ========================================================================== */
.aff-grid-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.aff-card {
	background: #ffffff;
	padding: 20px;
	border-radius: var(--aff-radius);
	border: 1px solid var(--aff-border);
	box-shadow: var(--aff-card-shadow);
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.aff-card-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--aff-text-muted);
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.aff-card-num {
	font-size: 26px;
	font-weight: 800;
	color: var(--aff-dark);
	line-height: 1.2;
}

.aff-card-desc {
	font-size: 12px;
	color: #94a3b8;
	margin-top: 6px;
}

.aff-card-highlight {
	border-left: 4px solid var(--aff-wa-green);
	background: #f0fdf4;
}

.aff-card-success {
	border-left: 4px solid #10b981;
}

.aff-card-wallet {
	border-left: 4px solid #3b82f6;
	background: #eff6ff;
}

/* ==========================================================================
   Catalog & Product Grid
   ========================================================================== */
.aff-catalog-toolbar {
	margin-bottom: 20px;
}

.aff-catalog-filter-form .aff-toolbar-left {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.aff-input-search,
.aff-select-filter {
	padding: 10px 14px;
	border: 1px solid var(--aff-border);
	border-radius: 8px;
	font-size: 14px;
	background: #fff;
}

.aff-input-search {
	flex: 1;
	min-width: 200px;
}

.aff-product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

.aff-product-card {
	background: #ffffff;
	border-radius: var(--aff-radius);
	border: 1px solid var(--aff-border);
	overflow: hidden;
	box-shadow: var(--aff-card-shadow);
	display: flex;
	flex-direction: column;
	transition: all 0.25s ease;
}

.aff-product-card:hover {
	box-shadow: var(--aff-card-hover);
	transform: translateY(-4px);
}

.aff-product-thumb {
	position: relative;
	width: 100%;
	height: 220px;
	background: #f1f5f9;
	overflow: hidden;
}

.aff-product-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.aff-product-card:hover .aff-product-thumb img {
	transform: scale(1.04);
}

.aff-img-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #94a3b8;
	font-size: 14px;
	background: #f8fafc;
}

.aff-badge-promo {
	position: absolute;
	top: 10px;
	left: 10px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	padding: 4px 8px;
	border-radius: 6px;
	text-transform: uppercase;
}

.aff-badge-category {
	position: absolute;
	bottom: 10px;
	left: 10px;
	background: rgba(15, 23, 42, 0.75);
	backdrop-filter: blur(4px);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 4px;
}

.aff-product-body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.aff-product-sku {
	font-size: 11px;
	color: var(--aff-text-muted);
	font-family: monospace;
	text-transform: uppercase;
}

.aff-product-title {
	margin: 6px 0 10px 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
}

.aff-product-title a {
	color: var(--aff-dark);
	text-decoration: none;
}

.aff-product-title a:hover {
	color: var(--aff-primary);
}

.aff-product-price-box {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 10px;
}

.aff-price-current {
	font-size: 18px;
	font-weight: 800;
	color: #0f172a;
}

.aff-price-old {
	font-size: 13px;
	color: #94a3b8;
	text-decoration: line-through;
}

.aff-commission-badge {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 8px;
	padding: 8px 10px;
	margin-bottom: 12px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 12px;
}

.aff-comm-label {
	color: #166534;
}

.aff-comm-value {
	color: #15803d;
	font-size: 13px;
	font-weight: 700;
}

.aff-product-short-desc {
	font-size: 13px;
	color: var(--aff-text-muted);
	margin: 0 0 16px 0;
	line-height: 1.5;
}

.aff-product-actions {
	margin-top: auto;
	display: flex;
	gap: 8px;
}

/* ==========================================================================
   Buttons & Status Badges
   ========================================================================== */
.aff-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	border: none;
	text-decoration: none;
	transition: all 0.2s ease;
}

.aff-btn-primary {
	background: var(--aff-primary);
	color: #ffffff;
}

.aff-btn-primary:hover {
	background: var(--aff-primary-hover);
	color: #ffffff;
}

.aff-btn-secondary {
	background: #f1f5f9;
	color: #334155;
}

.aff-btn-secondary:hover {
	background: #e2e8f0;
}

.aff-btn-success {
	background: #10b981;
	color: #ffffff;
}

.aff-btn-success:hover {
	background: #059669;
}

.aff-btn-sm {
	padding: 6px 12px;
	font-size: 12px;
}

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

.aff-status-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	text-transform: capitalize;
}

.aff-status-new,
.aff-status-pending {
	background: #fef3c7;
	color: #92400e;
}

.aff-status-completed,
.aff-status-approved,
.aff-status-paid,
.aff-status-order_confirmed,
.aff-status-active {
	background: #dcfce7;
	color: #166534;
}

.aff-status-processing,
.aff-status-contacted {
	background: #e0f2fe;
	color: #0369a1;
}

.aff-status-cancelled,
.aff-status-rejected,
.aff-status-suspended {
	background: #fee2e2;
	color: #991b1b;
}

/* ==========================================================================
   Product Detail Single Landing Page
   ========================================================================== */
.aff-product-single-container {
	max-width: 1100px;
	margin: 30px auto;
	padding: 0 16px;
}

.aff-breadcrumbs {
	margin-bottom: 20px;
	font-size: 14px;
	color: var(--aff-text-muted);
}

.aff-breadcrumbs a {
	color: var(--aff-primary);
	text-decoration: none;
}

.aff-single-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	background: #ffffff;
	padding: 32px;
	border-radius: var(--aff-radius);
	box-shadow: var(--aff-card-shadow);
	border: 1px solid var(--aff-border);
}

.aff-main-image-wrap {
	position: relative;
	width: 100%;
	height: 440px;
	background: #f8fafc;
	border-radius: var(--aff-radius);
	overflow: hidden;
	border: 1px solid var(--aff-border);
}

.aff-main-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.aff-gallery-thumbs {
	display: flex;
	gap: 10px;
	margin-top: 12px;
	overflow-x: auto;
}

.aff-gallery-thumbs .aff-thumb {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 8px;
	cursor: pointer;
	border: 2px solid transparent;
	transition: all 0.2s;
}

.aff-gallery-thumbs .aff-thumb:hover,
.aff-gallery-thumbs .aff-thumb.active {
	border-color: var(--aff-primary);
}

.aff-category-tag {
	display: inline-block;
	background: #f1f5f9;
	color: #475569;
	font-size: 12px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 6px;
	margin-bottom: 10px;
}

.aff-single-title {
	font-size: 30px;
	font-weight: 800;
	margin: 0 0 8px 0;
	color: var(--aff-dark);
}

.aff-single-sku {
	font-size: 13px;
	color: var(--aff-text-muted);
	margin-bottom: 18px;
}

.aff-single-price-box {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.aff-price-hero {
	font-size: 32px;
	font-weight: 800;
	color: #0f172a;
}

.aff-price-struck {
	font-size: 18px;
	color: #94a3b8;
	text-decoration: line-through;
}

.aff-discount-tag {
	background: #fef2f2;
	color: #dc2626;
	font-size: 13px;
	font-weight: 700;
	padding: 4px 8px;
	border-radius: 6px;
	border: 1px solid #fecaca;
}

.aff-stock-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 20px;
}

.aff-stock-badge .aff-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #10b981;
}

.aff-stock-out_of_stock .aff-dot {
	background: #ef4444;
}

.aff-single-short-desc {
	font-size: 15px;
	line-height: 1.6;
	color: #475569;
	margin-bottom: 24px;
}

/* ==========================================================================
   WhatsApp Order CTA Button (High-Converting & Pulsing)
   ========================================================================== */
.aff-order-box {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: var(--aff-radius);
	padding: 24px;
	margin-bottom: 24px;
	text-align: center;
}

.aff-btn-wa-order {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: var(--aff-wa-green);
	color: #ffffff;
	text-decoration: none;
	padding: 16px 28px;
	border-radius: 12px;
	font-size: 18px;
	font-weight: 700;
	box-shadow: 0 10px 25px -5px rgba(37, 211, 102, 0.45);
	transition: all 0.25s ease;
	position: relative;
	overflow: hidden;
}

.aff-btn-wa-order:hover {
	background: var(--aff-wa-green-hover);
	color: #ffffff;
	transform: translateY(-2px);
	box-shadow: 0 15px 30px -5px rgba(37, 211, 102, 0.6);
}

.aff-btn-pulse {
	animation: affPulse 2s infinite;
}

@keyframes affPulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
	}
	70% {
		box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

.aff-wa-text {
	display: flex;
	flex-direction: column;
	text-align: left;
}

.aff-wa-text strong {
	font-size: 18px;
	letter-spacing: 0.5px;
}

.aff-wa-text small {
	font-size: 12px;
	font-weight: 400;
	opacity: 0.9;
}

.aff-secure-badge {
	margin-top: 12px;
	font-size: 12px;
	color: #166534;
}

.aff-guarantees {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--aff-border);
}

.aff-guarantee-item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
	color: #475569;
}

.aff-single-description-box {
	background: #ffffff;
	padding: 32px;
	border-radius: var(--aff-radius);
	box-shadow: var(--aff-card-shadow);
	border: 1px solid var(--aff-border);
	margin-top: 30px;
}

.aff-single-description-box h2 {
	margin-top: 0;
	margin-bottom: 20px;
	font-size: 22px;
	color: var(--aff-dark);
}

/* ==========================================================================
   Table & Form Elements
   ========================================================================== */
.aff-table-responsive {
	overflow-x: auto;
	margin-top: 16px;
}

.aff-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	background: #fff;
	border-radius: var(--aff-radius);
	overflow: hidden;
	box-shadow: var(--aff-card-shadow);
}

.aff-table th,
.aff-table td {
	padding: 14px 16px;
	text-align: left;
	border-bottom: 1px solid var(--aff-border);
}

.aff-table th {
	background: #f8fafc;
	font-weight: 700;
	color: #475569;
}

.aff-form-group {
	margin-bottom: 16px;
}

.aff-form-group label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
	color: var(--aff-dark);
}

.aff-form-group input,
.aff-form-group select,
.aff-form-group textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--aff-border);
	border-radius: 8px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
}

.aff-form-group input:focus,
.aff-form-group select:focus,
.aff-form-group textarea:focus {
	border-color: var(--aff-primary);
}

.aff-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.aff-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.aff-modal-backdrop {
	position: absolute;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(4px);
}

.aff-modal-content {
	position: relative;
	background: #ffffff;
	border-radius: var(--aff-radius);
	max-width: 520px;
	width: 90%;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
	overflow: hidden;
	z-index: 1;
	animation: affModalZoom 0.2s ease;
}

@keyframes affModalZoom {
	from { transform: scale(0.95); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

.aff-modal-header {
	padding: 18px 24px;
	border-bottom: 1px solid var(--aff-border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.aff-modal-header h3 {
	margin: 0;
	font-size: 18px;
	color: var(--aff-dark);
}

.aff-modal-close {
	background: transparent;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #94a3b8;
}

.aff-modal-body {
	padding: 24px;
}

.aff-copy-box {
	display: flex;
	gap: 8px;
	margin: 16px 0;
}

.aff-copy-box input {
	flex: 1;
	padding: 10px;
	font-size: 13px;
	border: 1px solid var(--aff-border);
	border-radius: 8px;
	background: #f8fafc;
}

.aff-social-buttons {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 12px;
}

.aff-btn-social {
	padding: 8px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	text-decoration: none;
	border: none;
	cursor: pointer;
}

.aff-btn-wa { background: #25d366; }
.aff-btn-fb { background: #1877f2; }
.aff-btn-tg { background: #229ed9; }
.aff-btn-tw { background: #000000; }
.aff-btn-native-share { background: #6366f1; }

/* Responsive layout adjustments */
@media (max-width: 768px) {
	.aff-single-layout {
		grid-template-columns: 1fr;
	}
	.aff-form-row {
		grid-template-columns: 1fr;
	}
	.aff-dashboard-header {
		flex-direction: column;
		align-items: flex-start;
	}
	.aff-balance-hero {
		width: 100%;
		align-items: flex-start;
	}
}
