/* ===========================================================
   ویجت هواشناسی مردمی - استایل سمت کاربر
   پالت رنگی: آسمان (#1B6FA8 -> #4FA5D8)، خورشید (#FFC857)، خنثی (#0F172A/#F7FAFC)
=========================================================== */

#ww-widget-root {
	--ww-blue-dark: #114B78;
	--ww-blue: #1B6FA8;
	--ww-blue-light: #4FA5D8;
	--ww-amber: #FFC857;
	--ww-ink: #0F172A;
	--ww-ink-soft: #475569;
	--ww-bg: #F7FAFC;
	--ww-line: #E2E8F0;
	--ww-danger: #DC4C4C;
	--ww-radius: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Vazirmatn", "IRANSans", sans-serif;
	direction: rtl;
	position: fixed;
	z-index: 2147483645;
	isolation: isolate;
	bottom: var(--ww-bottom, 24px);
}

#ww-widget-root[data-side="right"] { right: var(--ww-right, 24px); }
#ww-widget-root[data-side="left"]  { left: var(--ww-left, 24px); }

/* دکمه شناور */
#ww-widget-button {
	display: flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, var(--ww-blue) 0%, var(--ww-blue-light) 100%);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 12px 18px;
	box-shadow: 0 8px 24px rgba(17, 75, 120, 0.35);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#ww-widget-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(17, 75, 120, 0.45);
}
#ww-widget-button:active { transform: translateY(0); }
#ww-widget-button .ww-widget-icon {
	display: inline-flex;
	background: rgba(255,255,255,0.15);
	border-radius: 50%;
	padding: 4px;
}

/* پس‌زمینه تیره پشت پاپ‌آپ */
.ww-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	z-index: 2147483646;
	backdrop-filter: blur(2px);
	animation: ww-fade-in 0.15s ease;
}

/* جعبه پاپ‌آپ */
.ww-modal {
	position: fixed;
	z-index: 2147483647;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(92vw, 480px);
	max-height: 88vh;
	background: var(--ww-bg);
	border-radius: var(--ww-radius);
	box-shadow: 0 24px 60px rgba(0,0,0,0.35);
	overflow: hidden;
	animation: ww-pop-in 0.2s ease;
}
.ww-modal-inner {
	display: flex;
	flex-direction: column;
	max-height: 88vh;
}
.ww-modal-content {
	padding: 24px 22px 20px;
	overflow-y: auto;
	color: var(--ww-ink);
}
.ww-modal-close {
	position: absolute;
	top: 10px;
	left: 10px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: rgba(15,23,42,0.06);
	color: var(--ww-ink);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}
.ww-modal-close:hover { background: rgba(15,23,42,0.12); }

.ww-title {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 6px;
	color: var(--ww-blue-dark);
}
.ww-desc {
	font-size: 13.5px;
	color: var(--ww-ink-soft);
	margin: 0 0 18px;
	line-height: 1.8;
}

/* دکمه‌های انتخاب اصلی داخل پاپ‌آپ */
.ww-choice-list { display: flex; flex-direction: column; gap: 12px; }
.ww-choice-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 14px 16px;
	border-radius: 12px;
	border: 1.5px solid var(--ww-line);
	background: #fff;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--ww-blue-dark);
	cursor: pointer;
	text-align: right;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.ww-choice-btn:hover { border-color: var(--ww-blue-light); background: #F0F8FE; }
.ww-choice-btn .ww-choice-emoji { font-size: 20px; }

/* دکمه اصلی و ثانویه عمومی */
.ww-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 18px;
	border-radius: 10px;
	border: none;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	width: 100%;
}
.ww-btn-primary { background: linear-gradient(135deg, var(--ww-blue) 0%, var(--ww-blue-light) 100%); color: #fff; }
.ww-btn-primary:hover { filter: brightness(1.05); }
.ww-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.ww-btn-secondary { background: #fff; color: var(--ww-blue-dark); border: 1.5px solid var(--ww-line); margin-top: 10px; }
.ww-btn-secondary:hover { background: #F0F8FE; }

.ww-row { display: flex; gap: 10px; }
.ww-row .ww-btn { width: auto; flex: 1; }

/* نقشه */
.ww-map-wrap {
	width: 100%;
	height: 280px;
	border-radius: 12px;
	overflow: hidden;
	border: 1.5px solid var(--ww-line);
	margin-bottom: 14px;
	touch-action: none; /* اجازه به Leaflet برای مدیریت کامل ژست‌های لمسی از جمله پینچ زوم */
}
.ww-map-wrap.ww-map-country { height: 380px; }
.ww-map-wrap .leaflet-container { width: 100%; height: 100%; font-family: inherit; }

/* نشانگر سفارشی نقشه: به‌جای پین آبی پیش‌فرض، عناصر جوی گزارش‌شده کنار هم نمایش داده می‌شوند */
.ww-map-marker { background: transparent; border: none; }
.ww-map-marker-inner {
	position: absolute;
	transform: translate(-50%, calc(-100% - 8px));
	display: flex;
	align-items: center;
	gap: 3px;
	background: #fff;
	border: 2px solid var(--ww-blue);
	border-radius: 999px;
	padding: 4px 7px;
	box-shadow: 0 3px 10px rgba(15, 23, 42, 0.28);
	white-space: nowrap;
	line-height: 1;
}
.ww-marker-emoji { font-size: 16px; }
.ww-map-marker-arrow {
	position: absolute;
	transform: translate(-50%, -8px);
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 8px solid var(--ww-blue);
}

/* گرید عناصر جوی */
.ww-elements-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-bottom: 16px;
}
.ww-element-item { position: relative; }
.ww-element-item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ww-element-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 12px 6px;
	border-radius: 12px;
	border: 1.5px solid var(--ww-line);
	background: #fff;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ww-ink-soft);
	transition: all 0.15s ease;
}
.ww-element-item input:checked + .ww-element-label {
	border-color: var(--ww-blue);
	background: #EAF5FD;
	color: var(--ww-blue-dark);
}
.ww-element-item input:focus-visible + .ww-element-label {
	outline: 2px solid var(--ww-blue);
	outline-offset: 2px;
}
.ww-element-emoji { font-size: 22px; }

/* پیام وضعیت (خطا/موفقیت/بارگذاری) */
.ww-status-box {
	padding: 12px 14px;
	border-radius: 10px;
	font-size: 13px;
	margin-bottom: 14px;
	line-height: 1.7;
}
.ww-status-box.ww-info    { background: #EAF5FD; color: var(--ww-blue-dark); }
.ww-status-box.ww-error   { background: #FDECEC; color: var(--ww-danger); }
.ww-status-box.ww-success { background: #EAF9EF; color: #1E7A3D; }

.ww-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2.5px solid rgba(27,111,168,0.25);
	border-top-color: var(--ww-blue);
	border-radius: 50%;
	animation: ww-spin 0.8s linear infinite;
	vertical-align: middle;
	margin-left: 6px;
}

.ww-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}
.ww-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11.5px;
	color: var(--ww-ink-soft);
	background: #fff;
	border: 1px solid var(--ww-line);
	border-radius: 999px;
	padding: 4px 10px;
}

/* فیلتر پدیده روی نقشه کشوری */
.ww-filter-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
	font-size: 13px;
	color: var(--ww-ink-soft);
}
.ww-filter-row select {
	flex: 1;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1.5px solid var(--ww-line);
	background: #fff;
	font-size: 13px;
	color: var(--ww-ink);
}
.ww-fade-note {
	font-size: 11.5px;
	color: var(--ww-ink-soft);
	margin: -4px 0 10px;
}

/* دکمه لینک‌مانند (مثلاً اطلاع‌رسانی منطقه) */
.ww-btn-link {
	width: 100%;
	background: none;
	border: none;
	color: var(--ww-blue);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	padding: 6px;
}
.ww-btn-link:hover { text-decoration: underline; }

/* فرم اشتراک اعلان */
.ww-field-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
	font-size: 13px;
	color: var(--ww-ink);
	flex-wrap: wrap;
}
.ww-field-row label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ww-field-row input[type="number"],
.ww-field-row input[type="email"] {
	padding: 8px 10px;
	border-radius: 8px;
	border: 1.5px solid var(--ww-line);
	font-size: 13px;
	flex: 1;
	min-width: 120px;
}
.ww-field-row input:disabled { background: #F1F5F9; color: #94A3B8; }

/* نشانگر گزارش مشکوک روی نقشه */
.ww-marker-flag {
	position: absolute;
	transform: translate(6px, calc(-100% - 2px));
	font-size: 13px;
}

@keyframes ww-spin { to { transform: rotate(360deg); } }
@keyframes ww-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ww-pop-in {
	from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 480px) {
	#ww-widget-button .ww-widget-text { display: none; }
	#ww-widget-button { padding: 12px; }
	.ww-elements-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
	.ww-overlay, .ww-modal, #ww-widget-button { animation: none !important; transition: none !important; }
}
