/* ==============================================================
 * FM Smart Trader Pro — Clean CSS (Overlay Blue v2.2)
 * Author: ForexMarketPlace / Ahmed Aboulfotouh
 * Description:
 *  - تصميم فاخر بخط Cairo وألوان ForexMarketPlace
 *  - تحسين وضوح الزر والتحذير والـ Overlay الزجاجي
 * ============================================================= */

/* خط Cairo */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

/* متغيّرات عامة */
#fm-stp-root {
  --brand: #51B5E5;
  --brand-soft: rgba(81,181,229,.2);
  --text: #0b1220;
  --muted: #64748b;
  --border: #e5e7eb;
  --card: #f9f9f9;
  --shadow: 0 20px 40px rgba(0,0,0,.05);
  --radius-lg: 18px;
  --radius-md: 12px;
  --gap: 14px;
  --field-h: 52px;
  --field-fs: 14px;
}

/* فرض Cairo */
#fm-stp-root.fm-stp-ui,
#fm-stp-root.fm-stp-ui * {
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
}

/* الحاوية */
#fm-stp-root.fm-stp-ui {
  direction: ltr;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  margin: 30px auto;
  max-width: 1200px;

  /* ثبات البلجن وعزل التأثير الزجاجي داخل الصندوق */
  position: relative !important;
  isolation: isolate !important;
  overflow: hidden !important; /* يضمن إن الـ blur ما يخرجش برا حدود الصندوق */
  z-index: 1; /* يجعل الصندوق نفسه فوق خلفية الصفحة */
}
#fm-stp-root[dir="rtl"] { direction: rtl; }

/* الشبكة */
.fm-stp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--gap);
  margin-bottom: 20px;
}

/* الحقول */
.fm-stp-item label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
}
.fm-stp-item select,
.fm-stp-item input[type="number"],
.fm-stp-item input[type="text"] {
  width: 100%;
  height: var(--field-h);
  line-height: var(--field-h);
  padding: 0 14px;
  font-size: var(--field-fs);
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
  appearance: none;
}
.fm-stp-item select:focus,
.fm-stp-item input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ======= الأزرار ======= */
.fm-stp-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 14px;
  justify-content: flex-start;
}

/* إخفاء الزرين القدامى نهائيًا */
#fm-run,
#fm-ai {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* زر "تحليل احترافي" */
#fm-pro {
  display: inline-block;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid rgba(81,181,229,0.55);
  background: rgba(81,181,229,0.18);
  backdrop-filter: blur(6px);
  color: #0b192c;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(81,181,229,0.25);
  transition: all 0.25s ease;
  position: relative;
  z-index: 9999 !important; /* لضمان الظهور فوق التحذير أو الـ overlay */
}
#fm-pro:hover {
  box-shadow: 0 8px 28px rgba(81,181,229,0.45);
  transform: translateY(-1px);
}
#fm-pro:active {
  transform: translateY(1px);
}
#fm-pro:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* النتائج */
.fm-stp-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.fm-stp-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 0 10px #0001;
}
.fm-stp-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.fm-stp-muted { font-size: 13px; color: var(--muted); }

/* شارات */
.fm-stp-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 6px;
  border: 1px solid transparent;
}
.fm-ok   { background:#ecfdf5; color:#065f46; border-color:#a7f3d0; }
.fm-warn { background:#fff7ed; color:#9a3412; border-color:#fed7aa; }
.fm-err  { background:#fef2f2; color:#991b1b; border-color:#fecaca; }

/* الملاحظة أسفل */
.fm-stp-note {
  font-size: 12px;
  color: #7c8aa0;
  margin-top: 24px;
  text-align: center;
  line-height: 1.6;
  border-top: 1px dashed #ccc;
  padding-top: 14px;
}

/* RTL */
#fm-stp-root[dir="rtl"] .fm-stp-item label { text-align: right; }

/* Responsive */
@media (max-width: 768px) {
  #fm-stp-root { --field-h: 48px; }
}
@media (max-width: 480px) {
  #fm-stp-root { padding: 16px; border-radius: 14px; }
  .fm-stp-grid { gap: 10px; }
  .fm-stp-results { gap: 14px; }
}

/* تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  #fm-pro { transition: none; }
}

/* ==========================================================
   🔹 تحسين عرض "انتظر سعر الشراء / البيع"
   ========================================================== */
#fm-entry-hint {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(81,181,229,0.08);
  border: 1px solid rgba(81,181,229,0.3);
  font-weight: 600;
  color: #0b192c;
  text-align: center;
  animation: fadeIn 0.6s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   🔹 تصميم Overlay أزرق فاخر (Glassmorphic)
   ========================================================== */

.fm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(81,181,229,0.1);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  border-radius: 18px;
  animation: fadeInBg 0.5s ease forwards;
}

@keyframes popUp {
  to { transform: perspective(800px) rotateX(0); opacity: 1; }
}

.fm-overlay-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  background: radial-gradient(circle at center, #51B5E5 0%, #1E90FF 70%);
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(81,181,229,0.8), inset 0 0 15px rgba(255,255,255,0.4);
  position: relative;
  animation: pulse 1.8s ease-in-out infinite alternate;
}
.fm-overlay-icon::before {
  content: "⚠️";
  font-size: 44px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.15); box-shadow: 0 0 60px rgba(81,181,229,0.8); }
}

.fm-overlay-text b {
  color: #006fbf;
  font-weight: 800;
}
.fm-overlay-close {
  margin-top: 26px;
  background: #51B5E5;
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(81,181,229,0.3);
  transition: background .25s ease;
}
.fm-overlay-close:hover {
  background: #3daee3;
}
