/* =====================================================================
   Index Prices Widget – FCS API Pro
   style.css  v9.0  |  Dark Navy Premium
   ===================================================================== */

/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
  --bg:            #070e1c;
  --bg2:           #0c1527;
  --card:          #0f1e35;
  --card2:         #132240;
  --border:        rgba(255,255,255,.07);
  --border2:       rgba(255,255,255,.13);

  --white:         #ffffff;
  --text:          #d4dff0;
  --muted:         #6b7f9e;
  --faint:         #3d5070;

  --green:         #00d084;
  --red:           #ff4560;
  --amber:         #ffb800;
  --blue:          #4d9fff;
  --cyan:          #00c8e0;

  --green-bg:      rgba(0,208,132,.12);
  --red-bg:        rgba(255,69,96,.12);
  --amber-bg:      rgba(255,184,0,.12);
  --blue-bg:       rgba(77,159,255,.12);

  --shadow:        0 8px 32px rgba(0,0,0,.5);
  --r:             16px;
  --r-sm:          10px;
  --p:             22px;
}

/* ─── Base Card ──────────────────────────────────────────────────── */
.alm-idx-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--p);
  color: var(--text);
  line-height: 1.5;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.alm-idx-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.alm-idx-card * { box-sizing: border-box; }
.alm-idx-card a { color: inherit; text-decoration: none; }

/* ─── Grid ───────────────────────────────────────────────────────── */
.alm-idx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  gap: 16px;
}

/* ─── Empty state ────────────────────────────────────────────────── */
.alm-idx-empty {
  display: flex; align-items: center; gap: 12px;
  min-height: 90px; color: var(--muted); font-size: 14px;
}
.alm-idx-empty-icon { font-size: 20px; }

/* ─── Glow bg ────────────────────────────────────────────────────── */
.alm-idx-glow {
  position: absolute; inset: auto -60px -60px auto;
  width: 200px; height: 200px; pointer-events: none;
  background: radial-gradient(circle, rgba(77,159,255,.07) 0%, transparent 70%);
  filter: blur(20px);
}
.alm-idx-live { isolation: isolate; }

/* ─── Layout rows ────────────────────────────────────────────────── */
.alm-idx-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
}
.alm-idx-head-row { margin-bottom: 16px; }
.alm-idx-title-row { margin-bottom: 4px; flex-direction: column; align-items: flex-start; gap: 0; }

/* ─── Badge (flag + country + exchange) ─────────────────────────── */
.alm-idx-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.alm-idx-flag { font-size: 14px; }
.alm-idx-sep { opacity: .5; }

/* ─── Symbol chip ────────────────────────────────────────────────── */
.alm-idx-symbol-chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 24px; padding: 0 9px; border-radius: 999px;
  background: rgba(77,159,255,.12);
  border: 1px solid rgba(77,159,255,.25);
  color: #7ec4ff;
  font-size: 10px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════════
   ★  H2 TITLE — الكل مدمج داخل H2 واحد
      البنية الجديدة:
      <h2 class="alm-idx-title">
        <span class="alm-idx-title-label">السعر المباشر لـ:</span>
        NASDAQ 100
      </h2>
   ════════════════════════════════════════════════════════════════════ */

h2.alm-idx-title,
h2.alm-idx-chart-title,
h2.alm-idx-stats-name,
h2.alm-idx-perf-name,
h2.alm-idx-search-title,
h2.alm-idx-tile-name {
  /* Hard reset */
  all: unset;
  display: block;

  /* Font */
  font-family: inherit;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--white);
  font-size: 22px;
  margin: 0;

  /* Accent underline */
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--blue) 0%, var(--cyan) 100%) 1;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

/* The small label INSIDE h2 */
.alm-idx-title-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 4px;
  opacity: .9;
}

/* Tile smaller variant */
h2.alm-idx-tile-name {
  font-size: 16px;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 8px;
}

/* WordPress / Elementor override */
.entry-content h2.alm-idx-title,
.entry-content h2.alm-idx-chart-title,
.entry-content h2.alm-idx-stats-name,
.entry-content h2.alm-idx-perf-name,
.entry-content h2.alm-idx-search-title,
.elementor-widget-container h2.alm-idx-title,
.elementor-widget-container h2.alm-idx-chart-title,
.elementor-widget-container h2.alm-idx-stats-name,
.elementor-widget-container h2.alm-idx-perf-name,
.elementor-widget-container h2.alm-idx-search-title {
  all: unset !important;
  display: block !important;
  font-family: inherit !important;
  font-weight: 800 !important;
  font-size: 22px !important;
  line-height: 1.2 !important;
  letter-spacing: -.02em !important;
  color: var(--white) !important;
  border-bottom: 2px solid !important;
  border-image: linear-gradient(90deg,#4d9fff,#00c8e0) 1 !important;
  padding-bottom: 8px !important;
  margin: 0 0 4px !important;
}

/* ─── Live Pulse ─────────────────────────────────────────────────── */
.alm-idx-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}


/* ─── Price Block ────────────────────────────────────────────────── */
.alm-idx-price-block {
  display: flex; align-items: baseline; gap: 8px;
  margin: 14px 0 10px; flex-wrap: wrap;
}
.alm-idx-price,
.alm-idx-chart-price {
  font-size: 36px;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
  letter-spacing: -.03em;
}
.alm-idx-currency,
.alm-idx-tile-currency {
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}

/* ─── Change Pill ────────────────────────────────────────────────── */
.alm-idx-change {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1;
  border: 1px solid transparent;
}
.alm-idx-change-sm { font-size: 12px; padding: 4px 10px; }
.alm-idx-arrow { font-size: 10px; }

/* Semantic colors — pills */
.alm-idx-change.is-up   { color: var(--green); background: var(--green-bg); border-color: rgba(0,208,132,.25); }
.alm-idx-change.is-down { color: var(--red);   background: var(--red-bg);   border-color: rgba(255,69,96,.25); }
.alm-idx-change.is-flat { color: var(--amber); background: var(--amber-bg); border-color: rgba(255,184,0,.25); }

/* Standalone color classes */
.is-up   { color: var(--green) !important; }
.is-down { color: var(--red)   !important; }
.is-flat { color: var(--amber) !important; }

/* Perf cells */
.alm-idx-perf-cell.is-up   .alm-idx-perf-pct { color: var(--green); }
.alm-idx-perf-cell.is-down .alm-idx-perf-pct { color: var(--red);   }
.alm-idx-perf-cell.is-flat .alm-idx-perf-pct { color: var(--amber); }
.alm-idx-stat-cell.is-up   strong             { color: var(--green) !important; }
.alm-idx-stat-cell.is-down strong             { color: var(--red)   !important; }

/* ─── Card border tints ──────────────────────────────────────────── */
.alm-idx-live.is-up,   .alm-idx-tile.is-up   { border-color: rgba(0,208,132,.22); }
.alm-idx-live.is-down, .alm-idx-tile.is-down { border-color: rgba(255,69,96,.22); }
.alm-idx-live.is-flat, .alm-idx-tile.is-flat { border-color: rgba(255,184,0,.22); }

/* ─── Mini Stats Grid ────────────────────────────────────────────── */
.alm-idx-mini-grid {
  display: grid; grid-template-columns: repeat(2,1fr);
  gap: 8px; margin-top: 14px;
}
.alm-idx-mini-cell,
.alm-idx-stat-cell,
.alm-idx-perf-cell {
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  transition: background .15s;
}
.alm-idx-mini-cell:hover,
.alm-idx-stat-cell:hover,
.alm-idx-perf-cell:hover {
  background: rgba(255,255,255,.06);
}
.alm-idx-mini-label,
.alm-idx-stat-label,
.alm-idx-perf-period {
  display: block;
  color: var(--muted);
  font-size: 10px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  margin-bottom: 5px;
}
.alm-idx-mini-cell strong,
.alm-idx-stat-cell strong {
  display: block;
  color: var(--white);
  font-size: 14px; font-weight: 700;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.alm-idx-foot,
.alm-idx-chart-footer {
  display: flex; flex-wrap: wrap;
  justify-content: space-between; gap: 6px 14px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: var(--muted); font-size: 11px;
}
.alm-idx-foot strong,
.alm-idx-chart-footer strong { color: var(--text); font-weight: 700; }

/* ─── Overline ───────────────────────────────────────────────────── */
.alm-idx-overline {
  display: block;
  color: var(--blue); font-size: 10px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 6px; opacity: .85;
}

/* ─── Chart Card ─────────────────────────────────────────────────── */
.alm-idx-chart-card { padding: var(--p); }
.alm-idx-chart-header {
  align-items: flex-start; margin-bottom: 14px; gap: 14px;
}
.alm-idx-chart-price-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.alm-idx-chart-wrap {
  position: relative; height: 300px; width: 100%;
  border-radius: 12px; overflow: hidden;
  background: rgba(255,255,255,.015);
  border: 1px solid rgba(255,255,255,.06);
  padding: 10px 8px 8px;
}
.alm-idx-chart-wrap canvas { display: block; width: 100% !important; height: 100% !important; }

/* ─── Range Buttons ──────────────────────────────────────────────── */
.alm-idx-range-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.alm-idx-range-btns button {
  appearance: none;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: var(--muted); border-radius: 999px;
  min-height: 30px; padding: 0 14px;
  font-size: 11px; font-weight: 800;
  letter-spacing: .05em; cursor: pointer;
  transition: all .17s;
}
.alm-idx-range-btns button:hover {
  background: rgba(77,159,255,.14);
  border-color: rgba(77,159,255,.35);
  color: #a8d4ff;
}
.alm-idx-range-btns button.active {
  background: var(--blue); color: #fff;
  border-color: var(--blue);
}

/* ─── Stats Grid ─────────────────────────────────────────────────── */
.alm-idx-stats-header,
.alm-idx-perf-header { margin-bottom: 4px; }
.alm-idx-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 10px; margin-top: 14px;
}
.alm-idx-perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 10px; margin-top: 14px;
}
.alm-idx-perf-pct {
  display: block; font-size: 18px; font-weight: 800;
  line-height: 1.3; letter-spacing: -.02em;
}
.alm-idx-perf-range {
  display: block; margin-top: 4px;
  color: var(--muted); font-size: 10px;
}

/* ─── Tile Card ──────────────────────────────────────────────────── */
.alm-idx-tile { padding: 16px 18px; }
.alm-idx-tile-header { margin-bottom: 8px; }
.alm-idx-tile-price {
  display: flex; align-items: baseline; gap: 6px;
  color: var(--white); font-size: 24px; font-weight: 800;
  letter-spacing: -.025em; margin-bottom: 10px;
}

/* ─── Searchable ─────────────────────────────────────────────────── */
.alm-idx-search-bar {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.alm-idx-search-info { min-width: 200px; }
.alm-idx-search-input-wrap {
  position: relative;
  min-width: min(100%,300px); width: 300px; max-width: 100%;
}
.alm-idx-search-icon {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none; opacity: .5; font-size: 13px;
}
.alm-idx-search-input {
  width: 100%; min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text); padding: 0 14px 0 36px;
  outline: none; font-size: 14px;
  transition: border-color .17s, background .17s;
}
.alm-idx-search-input::placeholder { color: var(--faint); }
.alm-idx-search-input:focus {
  border-color: rgba(77,159,255,.4);
  background: rgba(77,159,255,.05);
}
.alm-idx-search-count {
  margin: 0 0 12px; color: var(--muted);
  font-size: 12px; font-weight: 700;
}
.alm-idx-count-num { color: var(--white); }
.alm-idx-no-results {
  margin-top: 12px; padding: 16px; text-align: center;
  border-radius: 10px; border: 1px dashed rgba(255,255,255,.08);
  color: var(--muted); background: rgba(255,255,255,.015);
}

/* ─── Text block ─────────────────────────────────────────────────── */
.alm-idx-body { margin-top: 12px; }
.alm-idx-desc { font-size: 14px; line-height: 1.8; }
.alm-idx-desc p { margin: 0 0 10px; }
.alm-idx-desc p:last-child { margin-bottom: 0; }

/* ─── CTA Card ───────────────────────────────────────────────────── */
.alm-idx-cta-card {
  display: flex; justify-content: space-between;
  align-items: center; gap: 20px;
  background: linear-gradient(135deg, rgba(77,159,255,.09) 0%, rgba(0,200,224,.06) 100%);
  border-color: rgba(77,159,255,.22) !important;
  padding: var(--p); border-radius: var(--r);
}
.alm-idx-cta-card:hover { border-color: rgba(77,159,255,.38) !important; }
.alm-idx-cta-content { max-width: 66%; }
.alm-idx-cta-action { flex-shrink: 0; }
.alm-idx-cta-btn {
  display: inline-flex; align-items: center;
  padding: 11px 22px; border-radius: 8px;
  font-weight: 800; font-size: 13px; letter-spacing: .03em;
  color: #fff;
  background: linear-gradient(135deg, #4d9fff 0%, #00c8e0 100%);
  border: none; text-decoration: none; cursor: pointer;
  transition: all .2s;
}
.alm-idx-cta-btn:hover {
  transform: translateY(-2px);
}

/* ─── Section title ──────────────────────────────────────────────── */
.alm-idx-section-title {
  margin: 0 0 14px; color: var(--text);
  font-size: 16px; font-weight: 700;
}

/* ─── WP content fix ─────────────────────────────────────────────── */
.entry-content .alm-idx-card,
.elementor-widget-container .alm-idx-card { max-width: 100%; }

/* ─── RTL support ────────────────────────────────────────────────── */
[dir="rtl"] .alm-idx-search-input { padding: 0 36px 0 14px; }
[dir="rtl"] .alm-idx-badge { flex-direction: row-reverse; }
[dir="rtl"] .alm-idx-head-row { flex-direction: row-reverse; }

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  :root { --p: 16px; --r: 14px; }

  h2.alm-idx-title,
  h2.alm-idx-chart-title,
  h2.alm-idx-stats-name,
  h2.alm-idx-perf-name { font-size: 18px !important; }

  .alm-idx-price, .alm-idx-chart-price { font-size: 28px; }
  .alm-idx-chart-wrap { height: 240px; }
  .alm-idx-cta-card { flex-direction: column; align-items: flex-start; }
  .alm-idx-cta-content { max-width: 100%; }
  .alm-idx-search-bar { align-items: stretch; }
  .alm-idx-search-input-wrap { width: 100%; min-width: 100%; }
}

@media (max-width: 480px) {
  .alm-idx-grid { grid-template-columns: 1fr; }
  .alm-idx-mini-grid,
  .alm-idx-stats-grid,
  .alm-idx-perf-grid { grid-template-columns: 1fr 1fr; }
  .alm-idx-price, .alm-idx-chart-price { font-size: 26px; }
  .alm-idx-range-btns button { flex: 1 1 calc(50% - 6px); }
}

@media (max-width: 360px) {
  .alm-idx-mini-grid,
  .alm-idx-stats-grid,
  .alm-idx-perf-grid { grid-template-columns: 1fr; }
  h2.alm-idx-title,
  h2.alm-idx-chart-title { font-size: 16px !important; }
}

/* ============================================
   CTA WIDGET - SPECIAL STYLING
   ============================================ */

/* CTA Card Container */
.alm-idx-cta-card {
    position: relative;
    background: linear-gradient(135deg, #0a162e 0%, #0d1f3c 100%);
    border: 1px solid #1a3a5c;
    border-radius: 12px;
    overflow: hidden;
    padding: 24px;
    box-shadow: 
        0 4px 20px rgba(0, 200, 224, 0.15),
        0 0 40px rgba(77, 159, 255, 0.1);
}

/* CTA Card - Glowing accent on left */
.alm-idx-cta-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
        180deg,
        #00c8e0 0%,
        #4d9fff 50%,
        #00c8e0 100%
    );
}

/* CTA Content Wrapper */
.alm-idx-cta-content {
    position: relative;
    z-index: 1;
}

/* CTA Title - H3 Special Style */
.alm-idx-cta-card .alm-idx-title {
    all: unset;
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

/* CTA Description Text */
.alm-idx-cta-card .alm-idx-desc {
    font-size: 14px;
    line-height: 1.7;
    color: #a0b4d0;
    margin-bottom: 20px;
}

/* CTA Description Paragraphs */
.alm-idx-cta-card .alm-idx-desc p {
    margin: 0;
    color: #a0b4d0;
}

/* CTA Action Area */
.alm-idx-cta-action {
    position: relative;
    z-index: 1;
}

/* CTA Button - Gradient & Animated */
.alm-idx-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    background: linear-gradient(135deg, #4d9fff 0%, #00c8e0 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(77, 159, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alm-idx-cta-btn:hover {
    background: linear-gradient(135deg, #00c8e0 0%, #4d9fff 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 200, 224, 0.5);
}

.alm-idx-cta-btn:active {
    transform: translateY(0);
}

/* RTL Support for Glow */
[dir="rtl"] .alm-idx-cta-card::before {
    left: auto;
    right: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .alm-idx-cta-card {
        padding: 20px;
    }

    .alm-idx-cta-card .alm-idx-title {
        font-size: 18px;
    }

    .alm-idx-cta-card .alm-idx-desc {
        font-size: 13px;
    }

    .alm-idx-cta-btn {
        width: 100%;
        padding: 14px;
    }
}
