/**
 * استایل‌های فرانت‌اند سیستم رفرال هماهنگ با قالب باکالا و مدل ورود میلی‌گلد
 */

/* =========================================================
   1. باکس کد دعوت در فرم ورود و ثبت‌نام (مدل میلی گلد)
   ========================================================= */
.bakala-milli-invite-box {
	margin: 14px 0 10px;
	width: 100%;
	text-align: right;
	font-family: inherit;
}

.bakala-milli-invite-toggle {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 6px;
	cursor: pointer;
	user-select: none;
	padding: 4px 0;
	color: #4b5563;
	font-size: 13px;
	font-weight: 600;
	transition: color 0.2s;
}

.bakala-milli-invite-toggle:hover {
	color: #1f2937;
}

.bakala-milli-invite-toggle .milli-toggle-chevron {
	font-size: 14px;
	width: 14px;
	height: 14px;
	transition: transform 0.25s ease;
	color: #6b7280;
}

.bakala-milli-invite-toggle.open .milli-toggle-chevron {
	transform: rotate(180deg);
}

.bakala-milli-invite-content {
	margin-top: 8px;
	transition: all 0.3s ease;
}

.bakala-milli-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
	border: 1.5px solid #d1d5db;
	border-radius: 12px;
	background: #fff;
	transition: all 0.25s ease;
	padding: 2px;
}

.bakala-milli-input-wrapper.is-valid {
	border-color: #22c55e !important;
	background: #f0fdf4;
}

.bakala-milli-input-wrapper.is-invalid {
	border-color: #ef4444 !important;
	background: #fef2f2;
}

.bakala-milli-input-wrapper input {
	width: 100%;
	border: none !important;
	background: transparent !important;
	padding: 10px 14px !important;
	font-size: 14px !important;
	outline: none !important;
	box-shadow: none !important;
	color: #111827;
	text-align: right;
	direction: ltr;
}

.bakala-milli-input-wrapper.is-valid input {
	color: #15803d;
	font-weight: 600;
}

.bakala-milli-feedback {
	margin: 6px 4px 0;
	font-size: 12px;
	display: none;
	font-weight: 500;
}

.bakala-milli-feedback.success {
	color: #16a34a;
	display: block;
}

.bakala-milli-feedback.error {
	color: #dc2626;
	display: block;
}

/* =========================================================
   2. باکس کد معرف در صفحه تسویه حساب و سبد خرید
   ========================================================= */
.bakala-referral-checkout-box {
	background: #fff;
	border: 1px dashed #d1d5db;
	border-radius: 8px;
	padding: 14px 18px;
	margin-bottom: 24px;
	transition: all 0.25s ease;
}

.bakala-referral-checkout-box:hover {
	border-color: #3b82f6;
}

.bakala-ref-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
}

.bakala-ref-toggle .dashicons {
	color: #3b82f6;
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.bakala-ref-toggle .text {
	font-weight: 600;
	color: #1f2937;
}

.bakala-ref-toggle-btn {
	color: #2563eb;
	text-decoration: underline;
	cursor: pointer;
	font-weight: 500;
	margin-right: auto;
}

.bakala-ref-form-wrapper {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid #f3f4f6;
}

.bakala-ref-input-group {
	display: flex;
	gap: 8px;
	max-width: 420px;
}

.bakala-ref-input-group input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 14px;
	letter-spacing: 1px;
}

.bakala-ref-input-group input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

.bakala-ref-input-group button {
	padding: 8px 18px;
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.2s;
}

.bakala-ref-input-group button:hover {
	background: #1d4ed8;
}

.bakala-ref-applied-notice {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	padding: 10px 14px;
	border-radius: 6px;
	color: #065f46;
	font-size: 13px;
}

.bakala-ref-applied-notice .success-icon {
	background: #10b981;
	color: #fff;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: bold;
}

.bakala-ref-remove-btn {
	margin-right: auto;
	background: #fee2e2;
	color: #b91c1c;
	border: 1px solid #fca5a5;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	cursor: pointer;
	font-weight: 600;
}

.bakala-ref-message {
	margin-top: 8px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 13px;
}

.bakala-ref-message.success {
	background: #ecfdf5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.bakala-ref-message.error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

/* =========================================================
   3. داشبورد حساب کاربری (My Account)
   ========================================================= */
.bakala-referral-account-wrapper {
	font-family: inherit;
}

.bakala-ref-header {
	margin-bottom: 24px;
}

.bakala-ref-header h2 {
	margin: 0 0 6px;
	font-size: 20px;
	font-weight: 700;
	color: #111827;
}

.bakala-ref-subtitle {
	color: #6b7280;
	font-size: 14px;
	margin: 0;
}

/* کارت‌های آماری */
.bakala-ref-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.bakala-ref-stat-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	gap: 14px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
	position: relative;
}

.bakala-ref-stat-card.highlight {
	background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
	border-color: #bfdbfe;
}

.bakala-ref-stat-card .stat-icon {
	font-size: 28px;
}

.bakala-ref-stat-card .stat-title {
	display: block;
	font-size: 12px;
	color: #6b7280;
	margin-bottom: 2px;
}

.bakala-ref-stat-card .stat-value {
	font-size: 18px;
	font-weight: 700;
	color: #111827;
}

.bakala-ref-stat-card .stat-value small {
	font-size: 12px;
	color: #9ca3af;
	font-weight: normal;
}

.bakala-ref-stat-card .stat-link {
	position: absolute;
	left: 14px;
	bottom: 12px;
	font-size: 12px;
	color: #2563eb;
	font-weight: 600;
	text-decoration: none;
}

/* کارت اصلی کد معرف */
.bakala-ref-card-main {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 24px;
	margin-bottom: 28px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.ref-code-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 20px;
	padding-bottom: 14px;
	border-bottom: 1px solid #f3f4f6;
}

.ref-badge-status {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 700;
}

.ref-badge-status.active { background: #dcfce7; color: #15803d; }
.ref-badge-status.expired { background: #fee2e2; color: #b91c1c; }
.ref-badge-status.disabled { background: #f3f4f6; color: #4b5563; }

.ref-expiry-hint {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #4b5563;
}

.ref-expiry-hint .dashicons {
	color: #f59e0b;
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.ref-code-box, .ref-link-box {
	margin-bottom: 18px;
}

.ref-code-label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	color: #374151;
	margin-bottom: 6px;
}

.ref-code-display, .ref-link-display {
	display: flex;
	gap: 8px;
}

.ref-code-display input, .ref-link-display input {
	flex: 1;
	padding: 10px 14px;
	background: #f9fafb;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 15px;
	color: #111827;
	font-weight: 600;
}

.ref-code-display input {
	letter-spacing: 1px;
	color: #2563eb;
}

.bakala-copy-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	background: #111827;
	color: #fff;
	border: none;
	border-radius: 8px;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.2s;
	white-space: nowrap;
}

.bakala-copy-btn:hover {
	background: #374151;
}

/* دکمه‌های شبکه‌های اجتماعی */
.ref-share-socials {
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px dashed #e5e7eb;
}

.ref-share-socials .share-title {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #4b5563;
	margin-bottom: 12px;
}

.social-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.social-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	border-radius: 6px;
	color: #fff !important;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none !important;
	transition: opacity 0.2s;
}

.social-btn:hover { opacity: 0.88; }
.social-btn.whatsapp { background: #25d366; }
.social-btn.telegram { background: #0088cc; }
.social-btn.eitaa { background: #e06d15; }
.social-btn.bale { background: #13876d; }
.social-btn.sms { background: #64748b; }

/* جدول سوابق */
.bakala-ref-history-section h3 {
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 14px;
	color: #111827;
}

.bakala-ref-table th {
	background: #f9fafb;
	color: #374151;
	font-weight: 600;
	font-size: 13px;
}

.bakala-ref-table td {
	font-size: 13px;
	vertical-align: middle;
}

.bakala-ref-table .commission-col {
	color: #059669;
}

.badge {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-secondary { background: #f3f4f6; color: #4b5563; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.no-logs-msg {
	background: #f9fafb;
	border: 1px dashed #d1d5db;
	padding: 20px;
	border-radius: 8px;
	color: #6b7280;
	text-align: center;
	font-size: 14px;
}

/* =========================================================
   4. بنر صفحه محصول تکی
   ========================================================= */
.bakala-product-referral-badge {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	padding: 10px 14px;
	border-radius: 8px;
	margin: 14px 0;
	color: #166534;
	font-size: 13px;
}

.bakala-product-referral-badge .ref-badge-icon {
	font-size: 20px;
}

.bakala-product-referral-badge .ref-badge-amount {
	color: #15803d;
	font-weight: 700;
}
