/* RatePath (ريت باث) — Institutional Zero-CLS Bilingual Stylesheet */

:root {
  color-scheme: dark;
  --rp-bg: #070b14;
  --rp-panel: #0f172a;
  --rp-gold: #d4af37;
  --rp-emerald: #10b981;
  --rp-rose: #f43f5e;
  --rp-vw: 100vw;
  --rp-vh: 1vh;
  --rp-header-h: 112px;
  --rp-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  background-color: var(--rp-bg);
  color: #f8fafc;
  font-family: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  max-width: 100%;
}

body {
  overflow-x: clip;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

html[dir="rtl"] {
  font-family: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, sans-serif;
}

/* Smooth anchor clearance beneath sticky header on all screen sizes */
#converter-panel,
#rates-panel,
#personal-bot-hub,
#quant-radar-panel,
#funding-panel,
#news-panel {
  scroll-margin-top: calc(var(--rp-header-h, 112px) + 0.75rem);
}

/* Prevent Cumulative Layout Shift (CLS) during instant EN <-> AR switching */
header.rp-header {
  min-height: 56px;
}

@media (min-width: 640px) {
  header.rp-header {
    min-height: 64px;
  }
}

.rp-ticker-strip {
  min-height: 42px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.rp-ticker-strip::-webkit-scrollbar {
  display: none;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Custom sleek terminal scrollbars on desktop */
@media (min-width: 1024px) {
  ::-webkit-scrollbar {
    width: 7px;
    height: 7px;
  }
  ::-webkit-scrollbar-track {
    background: #070b14;
  }
  ::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 9999px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #334155;
  }
}

/* Safe-area padding for mobile (< 768px) fixed bottom navigation bar */
.pb-safe-bottom {
  padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

.rp-mobile-nav {
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
}

.mobile-nav-btn {
  min-height: 44px;
  touch-action: manipulation;
}

@media (min-width: 768px) {
  .pb-safe-bottom {
    padding-bottom: 2rem;
  }
}

/* Adaptive Modal Sheets: bottom-sheet on Mobile (< 640px), centered dialog on Tablet & Desktop */
.rp-modal-sheet {
  max-height: calc(var(--rp-vh, 1vh) * 92);
  max-height: 92dvh;
}

@media (max-width: 639px) {
  .rp-modal-sheet {
    padding-bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 640px) {
  .rp-modal-sheet {
    max-height: 88vh;
    max-height: 88dvh;
  }
}

/* Touch device ergonomics: prevent iOS Safari zoom on input focus & double-tap zoom */
@media (pointer: coarse) {
  button,
  a,
  select {
    touch-action: manipulation;
  }
}

@media (max-width: 767px) and (pointer: coarse) {
  input[type="text"],
  input[type="email"],
  input[type="search"],
  select {
    font-size: 16px;
  }
}

/* Auto-detected device profile fine-tuning */
html[data-device="mobile"] .rp-ticker-strip {
  min-height: 40px;
}

html[data-device="wide"] main,
html[data-device="wide"] header > div,
html[data-device="wide"] footer {
  max-width: 1600px;
}

/* Customizable Personal Workspace Drag-and-Drop & Edit Mode States */
.rp-edit-card {
  border-style: dashed !important;
  border-color: rgba(251, 191, 36, 0.45) !important;
}

.rp-drag-handle {
  touch-action: none;
  cursor: grab;
}

.rp-drag-handle:active {
  cursor: grabbing;
}

.rp-dragging {
  opacity: 0.45;
  transform: scale(0.97);
}

.rp-drag-over {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45);
  background-color: rgba(251, 191, 36, 0.1) !important;
}

.rp-coin-logo {
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  object-fit: cover;
  background-color: rgba(15, 23, 42, 0.9);
}

.rp-news-highlight {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45);
  background-color: rgba(251, 191, 36, 0.08) !important;
}
