/* ==========================================================================
   کانسالت‌بوک - استایل فرم رزرو، تقویم و پنل کاربری
   ========================================================================== */

:root {
	--cb-primary: #4f46e5;
	--cb-primary-dark: #3730a3;
	--cb-primary-light: #eef2ff;
	--cb-accent: #06b6d4;
	--cb-success: #16a34a;
	--cb-success-bg: #dcfce7;
	--cb-warning: #d97706;
	--cb-warning-bg: #fef3c7;
	--cb-danger: #dc2626;
	--cb-danger-bg: #fee2e2;
	--cb-text: #1e2233;
	--cb-text-muted: #6b7280;
	--cb-border: #e5e7eb;
	--cb-bg-soft: #f8fafc;
	--cb-radius: 14px;
	--cb-radius-sm: 9px;
	--cb-shadow: 0 4px 18px rgba(30, 34, 51, .06);
	--cb-shadow-lg: 0 14px 36px rgba(79, 70, 229, .16);
}

.cb-booking-widget, .cb-user-panel {
	direction: rtl;
	text-align: right;
	font-family: inherit;
	max-width: 820px;
	margin: 0 auto;
	color: var(--cb-text);
	box-sizing: border-box;
}
.cb-booking-widget *, .cb-user-panel * { box-sizing: border-box; }

/* ---------------- نوار مراحل ---------------- */
.cb-steps {
	display: flex;
	justify-content: space-between;
	margin-bottom: 28px;
	gap: 10px;
	position: relative;
}
.cb-steps::before {
	content: '';
	position: absolute;
	top: 18px;
	right: 6%;
	left: 6%;
	height: 2px;
	background: var(--cb-border);
	z-index: 0;
}
.cb-step {
	position: relative;
	z-index: 1;
	flex: 1;
	text-align: center;
	font-size: 12.5px;
	color: var(--cb-text-muted);
	font-weight: 600;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}
.cb-step::before {
	content: attr(data-step);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid var(--cb-border);
	color: var(--cb-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	transition: all .25s ease;
}
.cb-step.active { color: var(--cb-primary); }
.cb-step.active::before {
	background: var(--cb-primary);
	border-color: var(--cb-primary);
	color: #fff;
	box-shadow: 0 0 0 5px var(--cb-primary-light);
}
.cb-step.cb-step-skipped { opacity: .45; }
.cb-step.cb-step-skipped::before { background: var(--cb-bg-soft); }

/* ---------------- کارت اصلی ---------------- */
.cb-panel {
	background: #fff;
	border: 1px solid var(--cb-border);
	border-radius: var(--cb-radius);
	padding: 26px;
	box-shadow: var(--cb-shadow);
	animation: cbFadeIn .3s ease;
}
@keyframes cbFadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}
.cb-panel h3 {
	margin: 0 0 20px;
	font-size: 18px;
	font-weight: 700;
	color: var(--cb-text);
	padding-inline-start: 14px;
	border-inline-start: 4px solid var(--cb-primary);
}

/* ---------------- انتخاب خدمت / مشاور ---------------- */
.cb-service-list, .cb-employee-list {
	display: grid;
	gap: 14px;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.cb-service-item, .cb-employee-item { position: relative; cursor: pointer; display: block; }
.cb-service-item input, .cb-employee-item input {
	position: absolute !important; opacity: 0 !important; width: 100% !important; height: 100% !important;
	top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
	margin: 0 !important; padding: 0 !important; cursor: pointer !important; z-index: 2 !important;
	display: block !important; appearance: auto; -webkit-tap-highlight-color: transparent;
	pointer-events: auto !important;
}

.cb-service-item-body, .cb-employee-item-body {
	border: 2px solid var(--cb-border);
	border-radius: var(--cb-radius-sm);
	padding: 16px;
	transition: all .18s ease;
	background: #fff;
	height: 100%;
}
.cb-service-item-body:hover, .cb-employee-item-body:hover {
	border-color: #c7d2fe;
	transform: translateY(-2px);
	box-shadow: var(--cb-shadow);
}
.cb-service-item input:checked + .cb-service-item-body,
.cb-employee-item input:checked + .cb-employee-item-body {
	border-color: var(--cb-primary);
	background: var(--cb-primary-light);
	box-shadow: var(--cb-shadow-lg);
}
.cb-service-item-body strong, .cb-employee-item-body strong { font-size: 15px; }
.cb-service-item-body p, .cb-employee-item-body p {
	color: var(--cb-text-muted);
	font-size: 13px;
	margin: 6px 0 10px;
	line-height: 1.7;
}

.cb-employee-item-body { display: flex; gap: 12px; align-items: flex-start; }
.cb-employee-item-body img {
	width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
	border: 2px solid #fff; box-shadow: 0 0 0 2px var(--cb-border);
}
.cb-avatar-placeholder {
	width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
	background: linear-gradient(135deg, var(--cb-primary), var(--cb-accent));
	color: #fff; display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 18px;
}

.cb-badge {
	display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600;
	background: var(--cb-bg-soft); color: var(--cb-text-muted); border-radius: 20px;
	padding: 3px 11px; margin-top: 6px; margin-inline-end: 6px;
}
.cb-badge-price { background: var(--cb-success-bg); color: var(--cb-success); }
.cb-badge-instant { background: #ede9fe; color: #6d28d9; }
.cb-badge-scheduled { background: #dbeafe; color: #1d4ed8; }
.cb-badge-advance { background: #fef3c7; color: #b45309; }

/* ---------------- دکمه‌ها ---------------- */
.cb-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: flex-start; }
.cb-btn {
	background: var(--cb-bg-soft);
	border: 1px solid var(--cb-border);
	color: var(--cb-text);
	border-radius: var(--cb-radius-sm);
	padding: 11px 26px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all .18s ease;
}
.cb-btn:hover { background: #eef0f3; }
.cb-btn-primary {
	background: linear-gradient(135deg, var(--cb-primary), #6366f1);
	color: #fff;
	border: none;
	box-shadow: 0 6px 16px rgba(79, 70, 229, .28);
}
.cb-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, .34); }
.cb-btn-primary:disabled { background: #c7d2fe; box-shadow: none; cursor: not-allowed; }
.cb-btn-cancel { background: var(--cb-danger-bg); color: var(--cb-danger); border: none; margin-top: 12px; }
.cb-btn-cancel:hover { background: #fecaca; }

/* ---------------- تقویم و ساعت‌ها ---------------- */
.cb-date-time-wrap { display: flex; gap: 24px; flex-wrap: wrap; }
.cb-calendar { flex: 1.3; min-width: 300px; }
.cb-slots { flex: 1; min-width: 240px; border-inline-start: 1px dashed var(--cb-border); padding-inline-start: 22px; }
@media (max-width: 680px) { .cb-slots { border-inline-start: none; padding-inline-start: 0; border-top: 1px dashed var(--cb-border); padding-top: 18px; } }

.cb-cal-month h4 {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
	color: var(--cb-primary-dark);
	background: var(--cb-primary-light);
	display: inline-block;
	padding: 4px 14px;
	border-radius: 20px;
}
.cb-cal-days { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 20px; }
.cb-cal-day {
	border: 2px solid var(--cb-border);
	background: #fff;
	border-radius: var(--cb-radius-sm);
	padding: 9px 4px;
	cursor: pointer;
	text-align: center;
	min-width: 62px;
	transition: all .15s ease;
}
.cb-cal-day:hover { border-color: #c7d2fe; transform: translateY(-2px); }
.cb-cal-day.selected {
	border-color: var(--cb-primary);
	background: linear-gradient(135deg, var(--cb-primary), #6366f1);
	color: #fff;
	box-shadow: var(--cb-shadow-lg);
}
.cb-cal-day-num { display: block; font-weight: 800; font-size: 17px; }
.cb-cal-day-name { display: block; font-size: 11px; opacity: .85; margin-top: 2px; }

.cb-slot-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.cb-slot-btn {
	border: 2px solid var(--cb-border);
	background: #fff;
	border-radius: var(--cb-radius-sm);
	padding: 9px 16px;
	cursor: pointer;
	font-weight: 600;
	font-size: 13.5px;
	transition: all .15s ease;
}
.cb-slot-btn:hover { border-color: #c7d2fe; }
.cb-slot-btn.selected {
	border-color: var(--cb-primary);
	background: linear-gradient(135deg, var(--cb-primary), #6366f1);
	color: #fff;
	box-shadow: var(--cb-shadow-lg);
}

/* ---------------- خلاصه و فرم نهایی ---------------- */
.cb-summary {
	background: var(--cb-bg-soft);
	border: 1px solid var(--cb-border);
	border-radius: var(--cb-radius-sm);
	padding: 16px 18px;
	margin-bottom: 20px;
}
.cb-summary-row {
	display: flex;
	justify-content: space-between;
	padding: 8px 0;
	border-bottom: 1px dashed var(--cb-border);
	font-size: 14px;
}
.cb-summary-row:last-child { border-bottom: none; }
.cb-summary-row span { color: var(--cb-text-muted); }
.cb-summary-row strong { color: var(--cb-text); }

.cb-form-fields { display: flex; flex-direction: column; gap: 14px; max-width: 380px; }
.cb-form-fields label { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--cb-text-muted); }
.cb-form-fields input {
	padding: 12px 14px;
	border: 1.5px solid var(--cb-border);
	border-radius: var(--cb-radius-sm);
	font-size: 14px;
	transition: border-color .15s ease, box-shadow .15s ease;
	font-family: inherit;
}
.cb-form-fields input:focus {
	outline: none;
	border-color: var(--cb-primary);
	box-shadow: 0 0 0 3px var(--cb-primary-light);
}

.cb-error { color: var(--cb-danger); background: var(--cb-danger-bg); padding: 10px 14px; border-radius: var(--cb-radius-sm); margin-top: 14px; font-size: 13.5px; }
.cb-success { color: var(--cb-success); background: var(--cb-success-bg); padding: 10px 14px; border-radius: var(--cb-radius-sm); margin-top: 14px; font-size: 13.5px; }
.cb-loading, .cb-hint { color: var(--cb-text-muted); font-size: 13.5px; }
.cb-loading::before { content: '⏳ '; }
#cb-flow-message:not(:empty) { margin-bottom: 16px; }
#cb-flow-message .cb-error, #cb-flow-message .cb-loading { margin-top: 0; }

/* ---------------- پنل کاربری ---------------- */
.cb-panel-box {
	background: #fff; border: 1px solid var(--cb-border); border-radius: var(--cb-radius);
	padding: 22px; box-shadow: var(--cb-shadow);
}
.cb-lookup-form { display: flex; gap: 10px; margin: 14px 0; }
.cb-lookup-form input {
	flex: 1; padding: 12px 14px; border: 1.5px solid var(--cb-border); border-radius: var(--cb-radius-sm); font-size: 14px;
}
.cb-lookup-form input:focus { outline: none; border-color: var(--cb-primary); box-shadow: 0 0 0 3px var(--cb-primary-light); }

.cb-my-bookings { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 10px; }
.cb-booking-card {
	border: 1px solid var(--cb-border); border-radius: var(--cb-radius-sm); padding: 16px;
	background: #fff; box-shadow: var(--cb-shadow); transition: transform .15s ease;
}
.cb-booking-card:hover { transform: translateY(-2px); }
.cb-booking-card-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13.5px; color: var(--cb-text-muted); }
.cb-booking-card-row strong { color: var(--cb-text); font-size: 14.5px; }

/* ---------------- برچسب وضعیت ---------------- */
.cb-status {
	display: inline-flex; align-items: center; padding: 3px 12px; border-radius: 20px;
	font-size: 11.5px; font-weight: 700; background: var(--cb-bg-soft); color: var(--cb-text-muted);
}
.cb-status-confirmed { background: var(--cb-success-bg); color: var(--cb-success); }
.cb-status-pending { background: var(--cb-warning-bg); color: var(--cb-warning); }
.cb-status-canceled { background: var(--cb-danger-bg); color: var(--cb-danger); }
.cb-status-done { background: #dbeafe; color: #1d4ed8; }

/* ---------------- صفحه نتیجه پرداخت ---------------- */
.cb-payment-result {
	max-width: 480px; margin: 70px auto; text-align: center; direction: rtl;
	background: #fff; border: 1px solid var(--cb-border); border-radius: var(--cb-radius);
	padding: 40px 30px; box-shadow: var(--cb-shadow);
}
.cb-payment-result h2 { font-size: 22px; margin-bottom: 10px; }
.cb-payment-result.cb-success h2 { color: #16a34a; }
.cb-payment-result.cb-success::before { content: '✅'; font-size: 42px; display: block; margin-bottom: 14px; }
.cb-payment-result.cb-failed h2 { color: #dc2626; }
.cb-payment-result.cb-failed::before { content: '❌'; font-size: 42px; display: block; margin-bottom: 14px; }
.cb-payment-result p { color: var(--cb-text-muted); line-height: 1.8; margin-bottom: 20px; }
.cb-payment-result a {
	display: inline-block; background: linear-gradient(135deg, var(--cb-primary), #6366f1);
	color: #fff; padding: 10px 26px; border-radius: var(--cb-radius-sm); text-decoration: none; font-weight: 600;
}

/* ---------------- ریسپانسیو ---------------- */
@media (max-width: 640px) {
	.cb-steps { gap: 4px; }
	.cb-step { font-size: 10.5px; }
	.cb-step::before { width: 30px; height: 30px; font-size: 12px; }
	.cb-panel { padding: 18px; }
	.cb-service-list, .cb-employee-list { grid-template-columns: 1fr; }
	.cb-actions { flex-wrap: wrap; }
	.cb-btn { flex: 1; text-align: center; }
}

/* ---------------- پاپ‌آپ تایید رزرو (بعد از ثبت / پرداخت) ---------------- */
.cb-modal-overlay {
	position: fixed; inset: 0; background: rgba(15, 18, 33, .55);
	display: flex; align-items: center; justify-content: center;
	z-index: 99999; padding: 20px; direction: rtl; animation: cbFadeIn .2s ease;
	backdrop-filter: blur(2px);
}
.cb-modal-box {
	background: #fff; border-radius: 16px; max-width: 480px; width: 100%;
	max-height: 90vh; overflow-y: auto; padding: 28px 26px;
	box-shadow: 0 24px 60px rgba(0,0,0,.28); position: relative;
	text-align: center; direction: rtl;
}
.cb-modal-close {
	position: absolute; top: 14px; left: 14px; width: 32px; height: 32px;
	border-radius: 50%; border: none; background: #f1f2f6; color: #444;
	font-size: 20px; line-height: 1; cursor: pointer;
}
.cb-modal-close:hover { background: #e5e7eb; }

.cb-modal-box .cb-payment-result { border: none; box-shadow: none; padding: 0; margin: 0 0 14px; max-width: none; }
.cb-modal-box .cb-payment-result::before { font-size: 44px; margin-bottom: 8px; }

.cb-popup-print-area {
	text-align: right; background: var(--cb-bg-soft, #f8fafc); border: 1px solid var(--cb-border, #e5e7eb);
	border-radius: 10px; padding: 16px 18px; margin: 14px 0;
}
.cb-popup-print-area h3 { margin: 0 0 10px; font-size: 15px; }
.cb-popup-message {
	font-size: 13.5px; line-height: 2; color: var(--cb-text, #1e2233); margin-bottom: 14px;
	white-space: pre-line;
}
.cb-popup-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cb-popup-table th, .cb-popup-table td { text-align: right; padding: 7px 4px; border-bottom: 1px dashed var(--cb-border, #e5e7eb); }
.cb-popup-table th { color: var(--cb-text-muted, #6b7280); font-weight: 600; width: 40%; }

.cb-modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* ---------------- حالت چاپ (برای ذخیره PDF از طریق مرورگر) ---------------- */
@media print {
	body * { visibility: hidden; }
	.cb-modal-overlay, .cb-modal-overlay * { visibility: visible; }
	.cb-modal-overlay {
		position: absolute; inset: auto; top: 0; left: 0; width: 100%; background: #fff;
		backdrop-filter: none; padding: 0;
	}
	.cb-modal-box { box-shadow: none; max-height: none; max-width: 100%; width: 100%; border-radius: 0; }
	.cb-modal-close, .cb-modal-actions { display: none !important; }
}
