/* ══════════════════════════════════════════════
   Ghasemi Silver Price — Chart Widget Styles
   Theme: Dark / Blue Brand Accent
   ══════════════════════════════════════════════ */

.gsp-widget {
  --accent: #386af6;
  --accent-light: #afc4ad;
  --accent-dim: rgba(56, 106, 246, 0.15);
  --accent-glow: rgba(56, 106, 246, 0.25);
  --bg: #0d0f14;
  --bg2: #131520;
  --bg3: #1a1e2e;
  --border: rgba(56, 106, 246, 0.22);
  --text: #e8e8e8;
  --text-dim: #9ca3af;
  --green: #2ecc8f;
  --red: #e84545;
  --chart-h: var(--chart-height, 280px);

  font-family: "YekanBakh", sans-serif;
  direction: rtl;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 106, 246, 0.08);
  position: relative;
}

/* ── subtle noise texture overlay ── */
.gsp-widget::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

/* ─────────── HEADER ─────────── */
.gsp-header {
  position: relative;
  z-index: 1;
  padding: 24px 28px 20px;
  background: linear-gradient(135deg, #0d0f14 0%, #111828 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gsp-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gsp-live-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gsp-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(46, 204, 143, 0.6);
  animation: gsp-pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes gsp-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 204, 143, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(46, 204, 143, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 204, 143, 0);
  }
}

.gsp-label-live {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.gsp-prices {
  display: flex;
  gap: 24px;
}

.gsp-price-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.gsp-price-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.gsp-pt {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: 4px;
}

.gsp-pv {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color 0.4s;
  min-width: 75px;
  word-break: keep-all;
}
.gsp-pv:not([class*="up"]):not([class*="down"]):not(:empty) {
  font-size: clamp(12px, 2vw, 18px);
}
.gsp-pv.up {
  color: var(--green);
}
.gsp-pv.down {
  color: var(--red);
}
.gsp-pv.gsp-pv-status {
  font-size: 11px !important;
  font-weight: 500;
  color: #ffffff;
  min-width: auto;
  letter-spacing: 0;
}

.gsp-pu {
  font-size: 10px;
  color: var(--text-dim);
}

.gsp-updated {
  font-size: 11px;
  color: var(--text-dim);
  margin-right: auto;
  padding-right: 16px;
}
.gsp-updated span {
  color: var(--accent-light);
  font-weight: 500;
}

/* ─────────── TABS ─────────── */
.gsp-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 28px 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.gsp-tab {
  font-family: "YekanBakh", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 11px 11px;
  border-radius: 6px 6px 0 0;
  transition: color 0.2s, background 0.2s;
  position: relative;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.gsp-tab:hover {
  color: var(--text);
  background: rgba(56, 106, 246, 0.05);
}
.gsp-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(56, 106, 246, 0.08);
}

.gsp-switch {
  margin-right: auto;
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 8px;
}
.gsp-sw {
  font-family: "YekanBakh", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 14px;
  border-radius: 5px;
  transition: all 0.2s;
}
.gsp-sw.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(56, 106, 246, 0.4);
}

/* ─────────── CHART AREA ─────────── */
.gsp-chart-wrap {
  position: relative;
  z-index: 1;
  height: var(--chart-h);
  background: var(--bg2);
  padding: 20px 28px 24px;
}

#gsp-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ─────────── LOADER ─────────── */
.gsp-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 15, 20, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
  transition: opacity 0.3s;
}
.gsp-loader.hidden {
  opacity: 0;
  pointer-events: none;
}
.gsp-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gsp-spin 0.8s linear infinite;
}
@keyframes gsp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─────────── STATUS MESSAGE ─────────── */
.gsp-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-dim);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.gsp-status.visible {
  opacity: 1;
}

/* ─────────── TOOLTIP (chart.js) ─────────── */
.gsp-tooltip {
  background: var(--bg3) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 10px 16px !important;
  font-family: "YekanBakh", sans-serif !important;
  font-size: 13px !important;
  color: var(--text) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
  direction: rtl;
}

/* ─────────── RESPONSIVE ─────────── */
@media (max-width: 600px) {
  .gsp-prices {
    flex-direction: column;
    gap: 12px;
  }
  .gsp-pv {
    font-size: 20px;
  }
  .gsp-header {
    padding: 18px 16px 14px;
  }
  .gsp-tabs {
    padding: 12px 16px 0;
    gap: 2px;
  }
  .gsp-tab {
    padding: 8px 10px 12px;
    font-size: 12px;
  }
  .gsp-chart-wrap {
    padding: 16px 12px 16px;
  }
}
