/* ==========================================================================
   Trade Terminal - Modern Dark Theme with Light-Pink Buttons & Light-Blue Clock
   ========================================================================== */

:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-surface: #121212;
  --bg-surface-hover: #1e1e1e;
  --border-color: rgba(255, 255, 255, 0.15);
  --border-light: rgba(255, 255, 255, 0.3);
  --text-main: #ffffff;
  --text-muted: #a3a3a3;
  --header-height: 70px;

  /* Time Color: Light-Blue */
  --time-blue: #38bdf8;
  --time-blue-glow: rgba(56, 189, 248, 0.4);

  /* Button Color: Image 2 Light-Pink to Cyan Gradient */
  --btn-pink-gradient: linear-gradient(180deg, #f43f8e 0%, #ec4899 30%, #9333ea 68%, #06b6d4 100%);
  --btn-pink-gradient-hover: linear-gradient(180deg, #ff529f 0%, #f472b6 32%, #a855f7 68%, #22d3ee 100%);
  --btn-pink-gradient-subtle: linear-gradient(180deg, rgba(244, 63, 142, 0.25) 0%, rgba(147, 51, 234, 0.2) 50%, rgba(6, 182, 212, 0.2) 100%);
  --btn-pink-shadow: 0 4px 18px rgba(236, 72, 153, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  --btn-pink-shadow-hover: 0 6px 24px rgba(236, 72, 153, 0.6), 0 0 14px rgba(6, 182, 212, 0.4), inset 0 1px 2px #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
header.trading-nav {
  height: var(--header-height);
  background: rgba(8, 8, 8, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.9);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  transform: translateY(0);
}

/* Hidden Header state (When user scrolls up or toggles) */
header.trading-nav.nav-hidden,
body.header-is-hidden header.trading-nav {
  transform: translateY(-100%);
  pointer-events: none;
  opacity: 0;
}

/* Expand terminals to full screen when header is hidden */
body.header-is-hidden .terminal-pane,
body.header-is-hidden .split-mode {
  height: 100vh;
  margin-top: calc(-1 * var(--header-height));
}

.terminal-pane, .split-mode {
  transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1), margin-top 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Floating Reveal Pill when bar is hidden */
.nav-reveal-pill {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  z-index: 200;
  background: var(--btn-pink-gradient);
  border: 1.5px solid #ffffff;
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.6);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 16px 6px;
  border-radius: 0 0 9999px 9999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

body.header-is-hidden .nav-reveal-pill {
  transform: translateX(-50%) translateY(0);
  opacity: 0.95;
  pointer-events: auto;
}

body.header-is-hidden .nav-reveal-pill:hover {
  opacity: 1;
  transform: translateX(-50%) translateY(3px);
  box-shadow: 0 6px 25px rgba(236, 72, 153, 0.85);
}

/* Top Hover Sensor (move mouse to top 14px to reveal bar) */
.top-nav-sensor {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  z-index: 150;
  pointer-events: none;
}

body.header-is-hidden .top-nav-sensor {
  pointer-events: auto;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Brand Logo (Image 4 Build With 0 Trader) */
.brand-logo-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 12px rgba(0, 230, 118, 0.35), 0 0 8px rgba(255, 255, 255, 0.2);
  transition: transform 0.25s ease;
}

.brand-logo-img:hover {
  transform: scale(1.08) rotate(3deg);
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #ffffff 0%, #f472b6 60%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: 0.05em;
  width: fit-content;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #38bdf8;
  border-radius: 50%;
  animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
  0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* ==========================================================================
   Navigation Tabs & Buttons (Image 2 Light-Pink Pill Style)
   ========================================================================== */
.terminal-tabs {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 4px;
  gap: 6px;
}

/* Pill Buttons */
.tab-btn, .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--btn-pink-gradient-subtle);
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), 0 3px 10px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  padding: 0.5rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 9999px; /* Pill Shape */
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
}

.tab-btn:hover, .nav-link:hover {
  background: var(--btn-pink-gradient-hover);
  border-color: #ffffff;
  box-shadow: var(--btn-pink-shadow-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Active Tab (Image 2 Full Radiant Light-Pink to Cyan Gradient) */
.tab-btn.active, .nav-link.active {
  background: var(--btn-pink-gradient);
  border: 2px solid #ffffff;
  box-shadow: var(--btn-pink-shadow);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transform: translateY(0);
}

.tab-btn.active .badge-tag, .nav-link.active .badge-tag {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.badge-tag {
  font-size: 0.62rem;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Header Utilities, Customizable Time & Nation Selector
   ========================================================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Nation Customizer Dropdown */
.nation-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nation-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 30px 6px 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.nation-select:hover, .nation-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  background: rgba(25, 25, 25, 0.95);
}

.nation-select-arrow {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: #38bdf8;
  font-size: 0.7rem;
}

/* Country Selector Pill Button */
.country-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--btn-pink-gradient-subtle);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.5), 0 3px 12px rgba(236, 72, 153, 0.3);
  color: #ffffff;
  padding: 0.45rem 1.05rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 9999px; /* Pill Shape */
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.country-btn:hover {
  background: var(--btn-pink-gradient);
  border-color: #ffffff;
  box-shadow: var(--btn-pink-shadow-hover);
  transform: translateY(-1px);
}

.country-arrow {
  font-size: 0.65rem;
  color: #38bdf8;
  transition: transform 0.2s;
}

.country-btn:hover .country-arrow {
  color: #ffffff;
  transform: translateY(1px);
}

/* Clock Display (Light-Blue Color - Clickable) */
.clock-display {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  background: rgba(10, 16, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 6px 14px;
  border-radius: 9999px; /* Pill Shape */
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 14px rgba(56, 189, 248, 0.2), inset 0 1px 1.5px rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s;
}

.clock-display:hover {
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* Native Option Styling */
.nation-select option {
  background-color: #121212;
  color: #ffffff;
  padding: 8px 12px;
}

/* ==========================================================================
   Interactive Country Time Picker Modal
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

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

.country-modal {
  background: #0d121d;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(236, 72, 153, 0.25);
  border-radius: 24px;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: rotate(90deg);
}

.modal-search-box {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.country-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 0.7rem 1.25rem;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.country-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.35);
  background: rgba(255, 255, 255, 0.1);
}

.country-search-input::placeholder {
  color: #64748b;
}

.country-list {
  padding: 0.75rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

.country-item:hover {
  background: var(--btn-pink-gradient-subtle);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(4px);
}

.country-item.selected {
  background: var(--btn-pink-gradient);
  border: 2px solid #ffffff;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
}

.country-item.selected .country-item-name,
.country-item.selected .country-item-tz,
.country-item.selected .country-item-time {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.country-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.country-flag {
  font-size: 1.5rem;
  line-height: 1;
}

.country-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.country-item-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.country-item-tz {
  font-size: 0.75rem;
  color: #94a3b8;
}

.country-item-time {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--time-blue);
  text-shadow: 0 0 8px var(--time-blue-glow);
}

.time-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.time-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #93c5fd;
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 6px;
  border-radius: 9999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Light-Blue Time Value */
.time-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--time-blue);
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px var(--time-blue-glow);
}

.time-divider {
  width: 1px;
  height: 14px;
  background-color: rgba(56, 189, 248, 0.3);
}

/* Circular Pink/Cyan Button (Image 2 Style) */
.icon-btn {
  background: var(--btn-pink-gradient-subtle);
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.5), 0 3px 10px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%; /* Pure Circle */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn:hover {
  background: var(--btn-pink-gradient);
  border-color: #ffffff;
  box-shadow: var(--btn-pink-shadow-hover);
  transform: scale(1.08);
  color: #ffffff;
}

.icon-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   Main Terminal Container
   ========================================================================== */
main.terminal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #000000;
  min-height: calc(100vh - var(--header-height));
}

.terminal-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: calc(100vh - var(--header-height));
  min-height: 800px;
}

.terminal-pane.active {
  display: flex;
}

/* Sub-header inside pane */
.pane-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: rgba(10, 10, 10, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

.pane-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Light-Pink Pill Action Buttons */
.action-btn {
  background: var(--btn-pink-gradient-subtle);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 2px 8px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 9999px; /* Pill Shape */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-btn:hover {
  background: var(--btn-pink-gradient);
  border-color: #ffffff;
  box-shadow: var(--btn-pink-shadow);
  transform: translateY(-1px);
  color: #ffffff;
}

.action-btn:active {
  transform: translateY(0);
}

/* Iframe Wrapper */
.iframe-wrapper {
  flex: 1;
  width: 100%;
  position: relative;
  background: #000000;
}

.trading-iframe {
  width: 100%;
  height: 100%;
  border: none;
  min-height: 800px;
  display: block;
  background-color: #000000;
}

/* ==========================================================================
   Dual Split View Mode
   ========================================================================== */
.split-mode {
  display: none;
  flex-direction: row;
  flex: 1;
  width: 100%;
  height: calc(100vh - var(--header-height));
  min-height: 800px;
}

.split-mode.active {
  display: flex;
}

.split-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.split-pane:last-child {
  border-right: none;
}

/* ==========================================================================
   Fullscreen Mode
   ========================================================================== */
:fullscreen .trading-nav {
  display: none;
}
:fullscreen .terminal-pane {
  height: 100vh;
}
:fullscreen .split-mode {
  height: 100vh;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 950px) {
  header.trading-nav {
    flex-direction: column;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
  .split-mode {
    flex-direction: column;
  }
  .split-pane {
    border-right: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  }
  .terminal-pane, .split-mode {
    height: auto;
    min-height: 800px;
  }
}
