/* 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:          16px 20px 14px;
	background:       linear-gradient(135deg, #f9fff9 0%, #ffffff 100%);
	border-bottom:    1px solid #e8f5e9;
	position:         relative;
	border-radius:    20px 20px 0 0;
}

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

.cm-modal-pin-wrap {
	width:           42px;
	height:          42px;
	border-radius:   12px;
	background:      #fff;
	border:          1px solid #e8f5e9;
	display:         flex;
	align-items:     center;
	justify-content: center;
	flex-shrink:     0;
	box-shadow:      0 2px 8px rgba(46,125,50,.08);
}

/* ─── زر إغلاق المودال ─── */
.cm-modal-close-btn {
	position:        absolute;
	top:             50%;
	left:            3px;
	transform:       translateY(-50%);
	display:         flex;
	align-items:     center;
	justify-content: center;
	width:           30px;
	height:          30px;
	background:      #f5f5f5;
	border:          none;
	border-radius:   50%;
	cursor:          pointer;
	color:           #999;
	padding:         0;
	transition:      background .15s, color .15s;
	flex-shrink:     0;
}

.cm-modal-close-btn:hover {
	background: #fee2e2;
	color:      #c62828;
}

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

.cm-modal-subtitle {
	margin:      0 !important;
	font-size:   12px !important;
	font-weight: 400 !important;
	color:       #a5a5a5 !important;
	line-height: 1.4 !important;
	margin-top:  2px !important;
}

.cm-modal-title {
	font-size: 20px !important;
	font-weight: 700 !important;
	color: #111111 !important;
	margin: 0 0 2px !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;
	gap: 5px;
}

/* ─── أيقونة الموقع للمدن الغير مختارة ─── */
.cm-city-pin {
	flex-shrink: 0;
	color: #2e7d32;
}

/* ─── أيقونة الاختيار ✓ للمدينة المحددة ─── */
.cm-city-check {
	flex-shrink: 0;
	color: #2e7d32;
}

.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:    stretch;
	margin:         -18px -20px 16px;
	border-bottom:  1px solid #e0f0e0;
	overflow:       hidden;
	min-height:     42px;
}

.cm-back-btn {
	width:           30%;
	display:         flex;
	align-items:     center;
	justify-content: center;
	gap:             4px;
	background:      #e6f4e6;
	border:          none;
	border-left:     1px solid #c8e6c9;
	cursor:          pointer;
	color:           #2e7d32;
	font-size:       11px;
	font-weight:     700;
	font-family:     inherit;
	white-space:     nowrap;
	padding:         0 8px;
	transition:      background .15s;
	flex-shrink:     0;
}

.cm-back-btn:hover {
	background: #d4ecd4;
}

.cm-step-country {
	width:           70%;
	display:         flex;
	align-items:     center;
	justify-content: center;
	background:      #f5fbf5;
	font-size:       13px;
	font-weight:     700;
	color:           #1b5e20;
	white-space:     nowrap;
	overflow:        hidden;
	text-overflow:   ellipsis;
	padding:         0 10px;
}

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

/* ─── Modal Footer ─── */
.cm-modal-foot {
	border-top: 1px solid #f2f2f2;
	padding: 4px 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: transparent;
	color: #1a1a1a;
	border: 1px solid #ddd;
	border-radius: 25px;
	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: transparent;
	border-color: #81c784 !important;
	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;
}

/* ─── Product Unavailable Popup ─── */
.cm-unavail-box {
	background:    #fff;
	border-radius: 18px;
	padding:       32px 28px 28px;
	width:         min(90vw, 400px);
	text-align:    center;
	display:       flex;
	flex-direction: column;
	align-items:   center;
	gap:           12px;
	box-shadow:    0 20px 60px rgba(0,0,0,.18);
}

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

.cm-unavail-title {
	margin:      0;
	font-size:   20px;
	font-weight: 800;
	color:       #212121;
	line-height: 1.3;
}

.cm-unavail-product {
	margin:        0;
	font-size:     14px;
	font-weight:   600;
	color:         #2e7d32;
	background:    #f1f8f1;
	border-radius: 8px;
	padding:       8px 16px;
	width:         100%;
	box-sizing:    border-box;
}

.cm-unavail-sub {
	margin:      0;
	font-size:   14px;
	color:       #666;
	line-height: 1.6;
}

.cm-unavail-cities {
	display:               grid;
	grid-template-columns: 1fr 1fr;
	gap:                   6px;
	width:                 100%;
}

.cm-unavail-city-btn {
	display:         flex;
	align-items:     center;
	justify-content: center;
	gap:             5px;
	background:      #f4f4f4;
	color:           #333;
	border:          none;
	border-radius:   8px;
	padding:         9px 10px;
	font-size:       13px;
	font-weight:     600;
	cursor:          pointer;
	width:           100%;
	text-align:      center;
	transition:      background .18s, color .18s;
	white-space:     nowrap;
	overflow:        hidden;
	text-overflow:   ellipsis;
}

.cm-unavail-city-btn:hover {
	background: #e8f5e9;
	color:      #2e7d32;
}

.cm-unavail-city-btn:disabled {
	background: #f0f0f0;
	color:      #bbb;
	cursor:     not-allowed;
}

.cm-unavail-close {
	margin-top:    4px;
	background:    none;
	border:        1.5px solid #ddd;
	border-radius: 24px;
	padding:       10px 28px;
	font-size:     14px;
	font-weight:   600;
	color:         #888;
	cursor:        pointer;
	transition:    border-color .2s, color .2s;
	width:         100%;
}

.cm-unavail-close:hover {
	border-color: #bbb;
	color:        #555;
}
