/* ==========================================================================
   Bybit Derivatives Platform — Proactive Futures Lab (RTL & Dark Theme)
   ========================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(148, 163, 184, 0.12);
  --border-glow: rgba(168, 85, 247, 0.35);
  --accent-purple: #a855f7;
  --accent-purple-glow: rgba(168, 85, 247, 0.25);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(168, 85, 247, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* Header */
.der-header {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
}

.der-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.der-logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulse-der {
  width: 12px;
  height: 12px;
  background: var(--accent-purple);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent-purple);
  animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(168, 85, 247, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

.der-title {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.der-tag {
  font-size: 0.72rem;
  background: var(--accent-purple-glow);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

/* Platform Switcher */
.platform-switcher {
  display: flex;
  gap: 8px;
  background: rgba(30, 41, 59, 0.5);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.switch-btn {
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.switch-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.switch-btn.active {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.35);
}

.der-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.6);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 1px solid var(--border-color);
}

/* Main Container */
.der-container {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 20px;
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.bento-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.bento-card-shield {
  grid-column: span 5;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.bento-card-pulse {
  grid-column: span 4;
}

.bento-card-volume {
  grid-column: span 3;
}

.bento-card-council {
  grid-column: span 12;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.bento-title {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bento-number {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.shield-progress-wrap {
  margin: 14px 0 8px;
}

.shield-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.shield-bar-fill {
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, #a855f7, #c084fc);
  border-radius: 4px;
  box-shadow: 0 0 10px #a855f7;
}

.shield-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Advisor Bar */
.advisor-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.advisor-pill {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.advisor-name {
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Section Header & Filters */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover, .filter-pill.active {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.5);
}

/* Opportunities Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 18px;
}

.opp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.opp-card:hover {
  transform: translateY(-2px);
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

.opp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.opp-symbol-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.opp-symbol {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.opp-contract {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.opp-score-badge {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(124, 58, 237, 0.1));
  border: 1px solid #a855f7;
  color: #e9d5ff;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.anomaly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.opp-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.opp-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
}

.opp-changes {
  display: flex;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.change-pos { color: var(--accent-emerald); }
.change-neg { color: var(--accent-rose); }

/* Derivatives Metrics Box */
.metrics-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(30, 41, 59, 0.4);
  padding: 10px;
  border-radius: 10px;
  text-align: center;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.metric-val {
  font-size: 0.85rem;
  font-weight: 800;
  color: #e2e8f0;
}

.metric-val.funding-neg {
  color: #f43f5e;
  font-weight: 900;
}

/* 15% Shield Box */
.shield-box {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(30, 41, 59, 0.5));
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shield-box-title {
  font-size: 0.76rem;
  font-weight: 800;
  color: #c084fc;
  display: flex;
  justify-content: space-between;
}

.shield-amounts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Target & Stop Levels */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  font-size: 0.72rem;
  text-align: center;
}

.level-col {
  background: rgba(15, 23, 42, 0.5);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-tp { color: #34d399; font-weight: 800; }
.level-sl { color: #fb7185; font-weight: 800; }
.level-liq { color: #f59e0b; font-weight: 800; }

/* Advisor Text in Card */
.opp-advisor-summary {
  font-size: 0.74rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
  padding: 8px 12px;
  border-radius: 8px;
  border-right: 3px solid var(--accent-purple);
  line-height: 1.4;
}

/* Card Actions */
.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: auto;
}

.btn-der-execute {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border: none;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
}

.btn-der-execute:hover {
  background: linear-gradient(135deg, #9333ea, #6d28d9);
  transform: translateY(-1px);
}

.btn-der-telegram {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: #38bdf8;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-der-telegram:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  padding: 26px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  direction: rtl;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
  .bento-card-shield { grid-column: span 12; }
  .bento-card-pulse { grid-column: span 6; }
  .bento-card-volume { grid-column: span 6; }
  .advisor-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .bento-card-pulse, .bento-card-volume { grid-column: span 12; }
  .cards-grid { grid-template-columns: 1fr; }
}
.btn-tier-btn {
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-tier-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}
.btn-tier-btn:active {
  transform: translateY(0);
}
