/* City Market — Frontend Styles
   Fagr Digita · fagrdigita.com */

/* ─── Overlay ─── */
.cm-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

.cm-overlay--hidden {
	display: none !important;
}

/* ─── Modal Card ─── */
.cm-modal {
	background: #ffffff;
	border-radius: 22px;
	width: min(460px, 100%);
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
	animation: cm-pop .22s cubic-bezier(.34,1.56,.64,1);
	scrollbar-width: thin;
}

@keyframes cm-pop {
	from { opacity: 0; transform: scale(.93) translateY(16px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── Modal Head ─── */
.cm-modal-head {
	padding: 22px 24px 18px;
	border-bottom: 1px solid #f2f2f2;
	position: relative;
}

.cm-modal-title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	direction: rtl;
}

/* ─── زر إغلاق المودال (يظهر فقط عند وجود مدينة محددة) ─── */
.cm-modal-close-btn {
	position: absolute;
	top: 50%;
	left: 0px;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: #f4f4f4;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: #888;
	padding: 0;
	transition: background .15s, color .15s, transform .15s;
	flex-shrink: 0;
}

.cm-modal-close-btn:hover {
	background: #fee2e2;
	color: #c62828;
	transform: translateY(-50%) scale(1.08);
}

.cm-modal-pin {
	flex-shrink: 0;
	display: block;
}

.cm-modal-title {
	font-size: 20px !important;
	font-weight: 700 !important;
	color: #111111 !important;
	margin: 0 !important;
	line-height: 1.2 !important;
}

/* ─── Steps ─── */
.cm-step {
	padding: 18px 20px;
}

.cm-hidden {
	display: none !important;
}

/* ─── Options List — دول (عمود واحد) ─── */
.cm-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* ─── قائمة المدن — عمودان ─── */
#cm-cities-container.cm-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

/* ─── زر عام ─── */
.cm-list-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 14px 18px;
	background: #f8f8f8;
	border: 1.5px solid #ececec;
	border-radius: 12px;
	cursor: pointer;
	font-size: 15px;
	color: #111;
	text-align: right;
	direction: rtl;
	font-family: inherit;
	transition: all .15s ease;
	outline: none;
	position: relative;
	overflow: hidden;
}

.cm-list-btn:hover,
.cm-list-btn:focus-visible {
	border-color: #2e7d32;
	background: #f1f8e9;
	color: #2e7d32;
	transform: translateX(-3px);
}

.cm-list-btn:active {
	transform: translateX(-1px);
	background: #e8f5e9;
}

/* ─── أزرار المدن — توسيط النص ─── */
.cm-city-btn {
	justify-content: center;
	text-align: center;
	padding: 14px 10px;
	min-height: 52px;
}

.cm-city-btn:hover,
.cm-city-btn:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(46,125,50,.15);
}

.cm-city-btn:active {
	transform: translateY(0);
}

/* ─── المدينة المحددة مسبقاً — تمييز بلون أخضر ─── */
.cm-city-btn--selected {
	border-color: #2e7d32;
	background: #f1f8e9;
	color: #1b5e20;
	font-weight: 700;
	box-shadow: 0 0 0 2px rgba(46,125,50,.15);
}

.cm-city-btn--selected:hover,
.cm-city-btn--selected:focus-visible {
	background: #e8f5e9;
	border-color: #1b5e20;
	box-shadow: 0 4px 12px rgba(46,125,50,.2);
}

.cm-btn-label {
	font-weight: 500;
}

.cm-btn-arrow {
	font-size: 22px;
	color: #cccccc;
	line-height: 1;
	transition: color .15s;
}

.cm-list-btn:hover .cm-btn-arrow {
	color: #2e7d32;
}

/* ─── Spinner داخل زر المدينة ─── */
@keyframes cm-spin {
	to { transform: rotate(360deg); }
}

.cm-btn-loading {
	pointer-events: none;
	border-color: #2e7d32 !important;
	background: #f1f8e9 !important;
	gap: 6px;
}

.cm-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid #c8e6c9;
	border-top-color: #2e7d32;
	border-radius: 50%;
	animation: cm-spin 0.65s linear infinite;
	flex-shrink: 0;
}

/* ─── Step 2 Nav ─── */
.cm-step2-nav {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}

.cm-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	cursor: pointer;
	color: #2e7d32;
	font-size: 14px;
	font-family: inherit;
	padding: 6px 0;
	transition: opacity .15s;
}

.cm-back-btn:hover {
	opacity: .7;
}

.cm-step-country {
	font-size: 15px;
	font-weight: 600;
	color: #111;
}

/* ─── Loading ─── */
.cm-loading {
	text-align: center;
	color: #aaa;
	padding: 24px;
	font-size: 14px;
}

/* ─── Modal Footer ─── */
.cm-modal-foot {
	border-top: 1px solid #f2f2f2;
	padding: 12px 24px;
	text-align: center;
}

.cm-powered {
	font-size: 11px;
	color: #cccccc;
	text-decoration: none;
	transition: color .15s;
}

.cm-powered:hover {
	color: #2e7d32;
}

.cm-powered strong {
	font-weight: 600;
}

/* ─── Confirmation Dialog (تأكيد تغيير المدينة) ─── */
.cm-confirm-box {
	background: #ffffff;
	border-radius: 20px;
	width: min(380px, 100%);
	padding: 36px 28px 28px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
	animation: cm-pop .22s cubic-bezier(.34,1.56,.64,1);
	text-align: center;
	direction: rtl;
}

.cm-confirm-icon {
	font-size: 48px;
	line-height: 1;
	margin-bottom: 16px;
}

.cm-confirm-title {
	font-size: 20px !important;
	font-weight: 700 !important;
	color: #111 !important;
	margin: 0 0 12px !important;
	line-height: 1.2 !important;
}

.cm-confirm-msg {
	font-size: 14px !important;
	color: #555 !important;
	margin: 0 0 28px !important;
	line-height: 1.7 !important;
}

.cm-confirm-msg strong {
	color: #c62828;
	font-weight: 700;
}

.cm-confirm-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cm-confirm-btn {
	display: block;
	width: 100%;
	padding: 14px 20px;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	border: none;
	transition: background .15s, transform .1s;
	outline: none;
}

.cm-confirm-btn:active {
	transform: scale(.98);
}

.cm-confirm-yes {
	background: #c62828;
	color: #ffffff;
}

.cm-confirm-yes:hover {
	background: #b71c1c;
}

.cm-confirm-no {
	background: #f4f4f4;
	color: #444;
	border: 1.5px solid #e0e0e0 !important;
}

.cm-confirm-no:hover {
	background: #e8e8e8;
	color: #111;
}

/* ─── Shortcode: [cm_city_button] ─── */

.cm-shortcode {
	display: inline-block;
	direction: rtl;
}

.cm-sc-btn {
	display: inline-flex;
	align-items: center;
	gap: 0;
	background: #ffffff;
	color: #1a1a1a;
	border: 1.5px solid #ddd;
	border-radius: 50px;
	padding: 9px 18px;
	font-size: 14px;
	font-family: inherit;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
	white-space: nowrap;
	line-height: 1;
	direction: rtl;
}

.cm-sc-btn:hover {
	border-color: #2e7d32;
	box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}

.cm-sc-btn:focus-visible {
	outline: none;
	border-color: #2e7d32;
	box-shadow: 0 0 0 3px rgba(46,125,50,.18);
}

/* حالة مدينة مختارة */
.cm-sc-btn--selected {
	background: #f1f8e9;
	border-color: #81c784;
	color: #1b5e20;
}

.cm-sc-btn--selected:hover {
	background: #e8f5e9;
	border-color: #2e7d32;
}

.cm-sc-icon {
	display: inline-block;
	vertical-align: middle;
	margin-left: 6px;
	flex-shrink: 0;
}

.cm-sc-label {
	font-size: 13px;
	color: #111;
	font-weight: 500;
}

.cm-sc-btn--selected .cm-sc-label {
	color: #111;
}

.cm-sc-sep {
	font-size: 13px;
	color: #999;
	flex-shrink: 0;
}

.cm-sc-city-val {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 14px;
	font-weight: 700;
	color: #111;
	margin-right: 4px;
}

.cm-sc-city-icon {
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
}

.cm-sc-btn--selected .cm-sc-city-val {
	color: #1b5e20;
}

.cm-sc-arrow {
	font-size: 12px;
	color: #999;
	margin-right: 6px;
	transition: transform .2s;
	flex-shrink: 0;
}

.cm-sc-btn--selected .cm-sc-arrow {
	color: #2e7d32;
}

/* ─── Widget ─── */
.cm-widget-body {
	font-size: 14px;
}

.cm-widget-current {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.cm-widget-pin {
	font-size: 20px;
	flex-shrink: 0;
}

.cm-widget-meta {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.cm-widget-country {
	font-size: 11px;
	color: #999;
}

.cm-widget-city {
	font-size: 16px;
	font-weight: 700;
	color: #111;
}

.cm-widget-btn {
	display: block;
	width: 100%;
	padding: 10px 16px;
	border-radius: 10px;
	font-size: 13px;
	text-align: center;
	cursor: pointer;
	font-family: inherit;
	transition: all .15s;
	text-decoration: none;
	border: none;
}

.cm-widget-btn-outline {
	background: #f1f8e9;
	color: #2e7d32;
	border: 1.5px solid #c8e6c9;
}

.cm-widget-btn-outline:hover {
	background: #c8e6c9;
	color: #1b5e20;
}

.cm-widget-btn-solid {
	background: #2e7d32;
	color: #ffffff;
}

.cm-widget-btn-solid:hover {
	background: #1b5e20;
}

.cm-widget-hint {
	color: #999;
	font-size: 13px;
	margin-bottom: 10px;
	line-height: 1.4;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
	.cm-modal {
		border-radius: 16px;
	}

	.cm-modal-head {
		padding: 18px 16px 14px;
	}

	#cm-cities-container.cm-list {
		grid-template-columns: 1fr 1fr;
	}

	.cm-modal-title {
		font-size: 18px !important;
	}

	.cm-list-btn {
		padding: 12px 14px;
		font-size: 14px;
	}

	.cm-sc-btn {
		padding: 8px 14px;
		font-size: 13px;
	}

	.cm-sc-label {
		font-size: 12px;
	}

	.cm-confirm-box {
		padding: 28px 20px 22px;
	}

	.cm-confirm-title {
		font-size: 17px !important;
	}

	.cm-confirm-btn {
		padding: 12px 16px;
		font-size: 14px;
	}
}

/* ─── Single City Info Modal ─── */
.cm-single-city-box .cm-modal-close-btn {
	top:       12px;
	transform: none;
}

.cm-single-city-box .cm-modal-close-btn:hover {
	transform: scale(1.08);
}

.cm-single-city-box {
	position:        relative;
	background:      #ffffff;
	border-radius:   24px;
	width:           min(360px, 100%);
	padding:         40px 28px 32px;
	text-align:      center;
	box-shadow:      0 24px 64px rgba(0,0,0,.18);
	animation:       cm-pop .22s cubic-bezier(.34,1.56,.64,1);
	direction:       rtl;
}

.cm-sci-icon-wrap {
	display:          inline-flex;
	align-items:      center;
	justify-content:  center;
	width:            72px;
	height:           72px;
	border-radius:    50%;
	background:       #e8f5e9;
	margin-bottom:    16px;
}

.cm-sci-label {
	margin:       0 0 6px;
	font-size:    13px;
	font-weight:  600;
	color:        #888;
	letter-spacing: .5px;
}

.cm-sci-city {
	margin:       0 0 10px;
	font-size:    26px;
	font-weight:  800;
	color:        #1b5e20;
	line-height:  1.2;
}

.cm-sci-note {
	margin:       0;
	font-size:    14px;
	color:        #555;
	line-height:  1.6;
}
