/* ═══════════════════════════════════════════════
   Trading Dashboard Demo — style.css
   WordPress / Elementor compatible
   All layout values use CSS variables for easy editing.
═══════════════════════════════════════════════ */

/* ── CSS VARIABLES (edit here to restyle everything) ── */
:root {
  --bg-dark:           #0B0E11;
  --bg-panel:          #131722;
  --bg-surface:        #1C2030;
  --bg-input:          #252A3A;
  --bg-hover:          #1E2535;

  --primary-green:     #0ECB81;
  --primary-red:       #F6465D;
  --primary-yellow:    #FCD535;

  --bull-bg:           rgba(14,203,129,0.08);
  --bear-bg:           rgba(246,70,93,0.08);

  --text-primary:      #EAECEF;
  --text-secondary:    #848E9C;
  --text-dim:          #5E6673;
  --border:            #252A3A;

  --font-mono:         'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-body:         'DM Sans', 'Segoe UI', system-ui, sans-serif;

  --radius-sm:         4px;
  --radius-md:         8px;
  --radius-lg:         12px;

  --transition:        0.18s ease;

  /* Chart height — change this if needed */
  --chart-h:           420px;
}

/* ── GOOGLE FONTS IMPORT ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── RESET / BASE ── */
.tdd-root *,
.tdd-root *::before,
.tdd-root *::after { box-sizing: border-box; margin: 0; padding: 0; }

.tdd-root {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  width: 100%;
}

/* ── UTILITY ── */
.tdd-bull  { color: var(--primary-green) !important; }
.tdd-bear  { color: var(--primary-red)   !important; }
.tdd-yellow{ color: var(--primary-yellow)!important; }

/* ════════════════════════════════════
   HEADER
════════════════════════════════════ */
.tdd-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  flex-wrap: wrap;
}

.tdd-pair-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.tdd-pair-selector:hover { background: var(--bg-hover); }

.tdd-pair-icon {
  font-size: 18px;
  color: var(--primary-yellow);
  font-weight: 700;
}
.tdd-pair-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .3px;
}
.tdd-pair-caret { color: var(--text-secondary); }

.tdd-price-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.tdd-live-price {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--primary-green);
  letter-spacing: .5px;
  transition: color .25s;
}
.tdd-live-change {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.tdd-price-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.tdd-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tdd-meta-label {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.tdd-meta-item span:not(.tdd-meta-label) {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}
.tdd-funding { gap: 3px; }
.tdd-funding #tdd-countdown { color: var(--text-secondary); }

.tdd-live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary-green);
  background: rgba(14,203,129,.12);
  border: 1px solid rgba(14,203,129,.25);
  border-radius: 20px;
  padding: 3px 10px;
  margin-left: auto;
}
.tdd-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-green);
  animation: tdd-pulse 1.4s infinite;
}
@keyframes tdd-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.7); }
}

/* ════════════════════════════════════
   MAIN LAYOUT
════════════════════════════════════ */
.tdd-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: calc(var(--chart-h) + 80px);
}

/* ════════════════════════════════════
   CHART SECTION
════════════════════════════════════ */
.tdd-chart-section {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.tdd-timeframes {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tdd-tf-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.tdd-tf-btn:hover      { background: var(--bg-hover); color: var(--text-primary); }
.tdd-tf-active         { background: var(--bg-surface) !important; color: var(--primary-yellow) !important; font-weight: 600; }

.tdd-chart-wrapper {
  position: relative;
  flex: 1;
  min-height: var(--chart-h);
}
#tdd-chart { width: 100%; height: 100%; }

.tdd-chart-overlay {
  position: absolute;
  top: 8px; left: 12px;
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
}
.tdd-chart-overlay span::before {
  color: var(--text-dim);
  margin-right: 3px;
}
#tdd-ch-o::before { content: 'O'; }
#tdd-ch-h::before { content: 'H'; }
#tdd-ch-l::before { content: 'L'; }
#tdd-ch-c::before { content: 'C'; }

/* ════════════════════════════════════
   SIDEBAR
════════════════════════════════════ */
.tdd-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  overflow-y: auto;
}

/* ── Order Book ── */
.tdd-orderbook {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.tdd-ob-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.tdd-ob-asks, .tdd-ob-bids {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tdd-ob-asks { flex-direction: column-reverse; }

.tdd-ob-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  border-radius: 2px;
  position: relative;
  font-family: var(--font-mono);
  font-size: 11.5px;
  transition: background var(--transition);
  cursor: default;
}
.tdd-ob-row:hover { filter: brightness(1.3); }
.tdd-ob-row__bar {
  position: absolute; inset: 0;
  right: auto;
  border-radius: 2px;
  pointer-events: none;
  transition: width .3s ease;
}
.tdd-ob-ask .tdd-ob-row__bar { background: var(--bear-bg); }
.tdd-ob-bid .tdd-ob-row__bar { background: var(--bull-bg); }
.tdd-ob-ask { color: var(--primary-red); }
.tdd-ob-bid { color: var(--primary-green); }
.tdd-ob-vol { color: var(--text-secondary); font-size: 11px; }

.tdd-ob-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 4px;
  font-family: var(--font-mono);
}
#tdd-ob-price { font-size: 16px; font-weight: 700; }
#tdd-ob-index { font-size: 11px; color: var(--text-secondary); }

.tdd-ob-bar {
  display: flex;
  height: 4px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
  font-size: 10px;
}
.tdd-ob-bar__bull {
  background: var(--primary-green);
  display: flex; align-items: center;
  justify-content: flex-start;
  padding-left: 4px;
  color: #000;
  font-weight: 700;
  transition: width .4s;
}
.tdd-ob-bar__bear {
  background: var(--primary-red);
  display: flex; align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  color: #fff;
  font-weight: 700;
  transition: width .4s;
}
.tdd-ob-bar__bull span, .tdd-ob-bar__bear span { font-size: 9px; white-space: nowrap; }

/* ── Trade Panel ── */
.tdd-trade-panel {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tdd-trade-meta {
  display: flex;
  gap: 6px;
}
.tdd-meta-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.tdd-meta-btn:hover { border-color: var(--primary-yellow); color: var(--primary-yellow); }

/* Buy/Sell toggle */
.tdd-bs-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.tdd-bs-btn {
  padding: 9px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition);
  letter-spacing: .3px;
}
.tdd-bs-buy.tdd-bs-active  { background: var(--primary-green); color: #000; }
.tdd-bs-sell.tdd-bs-active { background: var(--primary-red);   color: #fff; }
.tdd-bs-btn:not(.tdd-bs-active):hover { background: var(--bg-hover); color: var(--text-primary); }

/* Select */
.tdd-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23848E9C' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.tdd-select:focus { border-color: var(--primary-yellow); }

/* Input groups */
.tdd-input-group { display: flex; flex-direction: column; gap: 4px; }
.tdd-input-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.tdd-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}
.tdd-input-wrap:focus-within { border-color: var(--primary-yellow); }
.tdd-input-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  width: 28px;
  height: 32px;
  cursor: pointer;
  transition: color var(--transition);
}
.tdd-input-btn:hover { color: var(--text-primary); }
.tdd-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  outline: none;
  min-width: 0;
}
.tdd-input-tag {
  font-size: 10px;
  color: var(--primary-yellow);
  font-weight: 700;
  padding: 0 8px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

/* Slider */
.tdd-slider-wrap { display: flex; flex-direction: column; gap: 4px; }
.tdd-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, var(--primary-yellow) 0%, var(--bg-surface) 0%);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background var(--transition);
}
.tdd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary-yellow);
  box-shadow: 0 0 0 3px rgba(252,213,53,.2);
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.tdd-slider::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px rgba(252,213,53,.3); }
.tdd-slider-labels { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 10px; }

/* Options row */
.tdd-options-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tdd-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  user-select: none;
}
.tdd-checkbox-label input[type="checkbox"] {
  width: 13px; height: 13px;
  accent-color: var(--primary-yellow);
  cursor: pointer;
}
.tdd-gtc-tag {
  margin-left: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* TP/SL panel */
.tdd-tpsl-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  animation: tdd-slide-in .2s ease;
}
.tdd-tpsl-panel.tdd-visible { display: flex; }
@keyframes tdd-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* Cost row */
.tdd-cost-row {
  display: flex;
  justify-content: space-between;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  gap: 6px;
}
.tdd-cost-label { display: block; font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.tdd-cost-val   { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); }

/* CTA button */
.tdd-cta-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.tdd-cta-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background .15s;
}
.tdd-cta-btn:hover::after  { background: rgba(255,255,255,.1); }
.tdd-cta-btn:active::after { background: rgba(0,0,0,.1); }
.tdd-cta-buy  { background: var(--primary-green); color: #000; }
.tdd-cta-sell { background: var(--primary-red);   color: #fff; }

/* Toast */
.tdd-toast {
  display: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  animation: tdd-fade-in .2s ease;
}
.tdd-toast.tdd-toast-buy  { display: block; background: var(--bull-bg); border: 1px solid var(--primary-green); color: var(--primary-green); }
.tdd-toast.tdd-toast-sell { display: block; background: var(--bear-bg); border: 1px solid var(--primary-red);   color: var(--primary-red);   }
@keyframes tdd-fade-in { from { opacity:0; } to { opacity:1; } }

/* ════════════════════════════════════
   POSITIONS PANEL
════════════════════════════════════ */
.tdd-positions {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  overflow-x: auto;
}

.tdd-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.tdd-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.tdd-tab:hover       { color: var(--text-primary); }
.tdd-tab-active      { color: var(--text-primary); border-bottom-color: var(--primary-yellow); }

.tdd-pos-table { min-width: 700px; }
.tdd-pos-head, .tdd-pos-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1.2fr 1.2fr 1.2fr 1.3fr 1.2fr;
  padding: 10px 16px;
  align-items: center;
  gap: 8px;
}
.tdd-pos-head {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.tdd-pos-row {
  font-family: var(--font-mono);
  font-size: 12px;
  border-bottom: 1px solid rgba(37,42,58,.5);
  transition: background var(--transition);
}
.tdd-pos-row:hover { background: var(--bg-hover); }

.tdd-pos-symbol {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
}
.tdd-pos-symbol small { color: var(--text-secondary); font-size: 10px; font-weight: 400; font-family: var(--font-body); }
.tdd-pos-badge {
  display: inline-block;
  background: var(--primary-green);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 4px;
}

.tdd-pos-pnl { display: flex; flex-direction: column; gap: 2px; }
.tdd-pos-roi { font-size: 11px; }

.tdd-pos-actions { display: flex; gap: 6px; }
.tdd-action-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.tdd-action-btn:hover       { color: var(--text-primary); border-color: var(--text-secondary); }
.tdd-action-close:hover     { color: var(--primary-red); border-color: var(--primary-red); background: var(--bear-bg); }

/* ════════════════════════════════════
   RESPONSIVE
════════════════════════════════════ */
@media (max-width: 900px) {
  .tdd-layout {
    grid-template-columns: 1fr;
  }
  .tdd-chart-section { border-right: none; border-bottom: 1px solid var(--border); }
  .tdd-sidebar { max-height: none; }
}

@media (max-width: 600px) {
  .tdd-header { padding: 8px 10px; gap: 8px; }
  .tdd-price-meta { gap: 10px; }
  .tdd-meta-item:nth-child(n+3) { display: none; }
  .tdd-live-price { font-size: 18px; }
  .tdd-pos-table { min-width: 600px; }
}

/* ════════════════════════════════════
   PRICE FLASH ANIMATIONS
════════════════════════════════════ */
@keyframes tdd-flash-green {
  0%   { background: rgba(14,203,129,.3); }
  100% { background: transparent; }
}
@keyframes tdd-flash-red {
  0%   { background: rgba(246,70,93,.3); }
  100% { background: transparent; }
}
.tdd-flash-up   { animation: tdd-flash-green .4s ease; }
.tdd-flash-down { animation: tdd-flash-red   .4s ease; }

/* ════════════════════════════════════
   LEVERAGE MODAL
════════════════════════════════════ */
.tdd-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.tdd-modal-overlay.tdd-visible { display: flex; }
.tdd-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 300px;
  animation: tdd-slide-in .2s ease;
}
.tdd-modal h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.tdd-lev-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--primary-yellow);
  border-radius: 2px;
  margin-bottom: 8px;
}
.tdd-lev-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--primary-yellow);
  cursor: pointer;
}
.tdd-lev-val {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-yellow);
  text-align: center;
  margin-bottom: 16px;
}
.tdd-modal-btns { display: flex; gap: 8px; }
.tdd-modal-btns button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tdd-modal-cancel { background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border) !important; }
.tdd-modal-confirm { background: var(--primary-yellow); color: #000; }
