/**
 * dashboard.css
 * Specific styles for the main dashboard page
 */

/* ----- CHART & GRAPH COMPONENTS ----- */
.chart-container-relative {
  position: relative;
}

#graphContainer {
  background-color: var(--bg-color);
  padding: 0.5rem;
  margin-bottom: 1rem;
  height: 230px;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.2);
  position: relative;
}

#graphContainer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1;
}

/* Chart controls styling */
.chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px 15px 0;
  font-family: var(--terminal-font);
  gap: 8px;
  margin-top: 5px;
  position: relative;
}

.chart-controls-label {
  font-size: 1rem;
  color: var(--primary-color);
  text-transform: uppercase;
  font-weight: bold;
}

.chart-points-toggle {
  display: flex;
  background-color: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 5px rgba(var(--primary-color-rgb), 0.3);
  position: relative;
}

.chart-points-toggle::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1;
}

.toggle-btn {
  background: none;
  color: var(--primary-color);
  border: none;
  padding: 5px 12px;
  font-size: 1rem;
  font-family: var(--terminal-font);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 48px;
  min-height: 48px;
  position: relative;
  z-index: 2;
}

.toggle-btn:not(:last-child) {
  border-right: 1px solid var(--primary-color);
}

.toggle-btn:hover:not(.active) {
  background-color: rgba(var(--primary-color-rgb), 0.15);
}

.toggle-btn.active {
  background-color: var(--primary-color);
  font-weight: bold;
  animation: subtle-pulse 3s infinite;
  position: relative;
}

/* Theme-specific button text color */
html.bitcoin-theme .toggle-btn.active {
  color: #000 !important;
}

html.deepsea-theme .toggle-btn.active {
  color: #ffffff !important;
}

/* Button effects */
.toggle-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 3;
}

.toggle-btn.active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: 0 0 6px var(--primary-color);
  opacity: 0.7;
  pointer-events: none;
  animation: subtle-glow 3s infinite;
}

/* ----- LAYOUT & STRUCTURE ----- */
.row.equal-height {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.row.equal-height > [class*="col-"] {
  display: flex;
  margin-bottom: 0.5rem;
}

.row.equal-height > [class*="col-"] .card {
  width: 100%;
}

#payoutMiscCard {
  margin-bottom: 0.5rem;
}

/* ----- INDICATORS & STATUS ELEMENTS ----- */
.arrow {
  display: inline-block;
  font-weight: bold;
  margin-left: 0.25rem;
}

.chevron {
  font-size: 0.8rem;
  position: relative;
}

.bounce-up {
  animation: bounceUp 1s infinite;
}

.bounce-down {
  animation: bounceDown 1s infinite;
}

/* ----- SPECIAL INDICATORS ----- */
/* Pool luck indicators */
.very-lucky {
  color: #32cd32 !important;
  font-weight: bold !important;
}

.lucky {
  color: #90ee90 !important;
}

.normal-luck {
  color: #ffd700 !important;
}

.unlucky {
  color: #ff5555 !important;
}

/* ----- REFRESH & UPTIME ELEMENTS ----- */
#refreshUptime {
  text-align: center;
  margin-top: 0.5rem;
}

#refreshContainer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#uptimeTimer {
  margin-top: 0;
}

#uptimeTimer strong {
  font-weight: bold;
}

/* ----- METRIC COLOR STYLING ----- */
.metric-value {
  color: var(--text-color);
  font-weight: bold;
}

/* Yellow color family */
#btc_price,
#daily_mined_sats,
#monthly_mined_sats,
#estimated_earnings_per_day_sats,
#estimated_earnings_next_block_sats,
#estimated_rewards_in_window_sats,
#est_time_to_payout {
  color: #ffd700;
}

/* Green color family */
#unpaid_earnings,
#daily_revenue,
#daily_profit_usd,
#monthly_profit_usd {
  color: #32cd32;
}

/* Red color family */
#daily_power_cost,
#pool_fees_sats {
  color: #ff5555 !important;
}

/* White metrics */
.metric-value.white,
#block_number,
#network_hashrate,
#difficulty,
#workers_hashing,
#last_share,
#blocks_found,
#last_block_height,
#pool_fees_percentage {
  color: #ffffff;
}

/* Blue metrics */
#last_block_time {
  color: #00dfff;
}

/* ----- CARD CONTENT STYLING ----- */
.card-body strong {
  color: var(--primary-color);
  margin-right: 0.25rem;
}

.card-body p {
  margin: 0.25rem 0;
  line-height: 1.2;
}

/* ----- ANIMATIONS ----- */
@keyframes bounceUp {
  0%,
  50%,
  100% {
    transform: translateY(0);
  }

  25%,
  75% {
    transform: translateY(-2px);
  }
}

@keyframes bounceDown {
  0%,
  50%,
  100% {
    transform: translateY(0);
  }

  25%,
  75% {
    transform: translateY(2px);
  }
}

@keyframes pulse-block-marker {
  0% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
    opacity: 1;
  }

  50% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.3);
    opacity: 0.8;
  }

  100% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
    opacity: 1;
  }
}

@keyframes glitch-anim {
  0%,
  10%,
  27%,
  35%,
  52%,
  50%,
  72%,
  80%,
  100% {
    transform: none;
    opacity: 1;
  }

  7% {
    transform: skew(-0.5deg, -0.9deg);
    opacity: 0.75;
  }

  30% {
    transform: skew(0.8deg, -0.1deg);
    opacity: 0.75;
  }

  55% {
    transform: skew(-1deg, 0.2deg);
    opacity: 0.75;
  }

  75% {
    transform: skew(0.4deg, 1deg);
    opacity: 0.75;
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.3);
  }
}

@keyframes glitch-frames {
  0% {
    clip: rect(19px, 450px, 23px, 0);
  }

  5% {
    clip: rect(36px, 450px, 16px, 0);
  }

  10% {
    clip: rect(11px, 450px, 41px, 0);
  }

  15% {
    clip: rect(22px, 450px, 33px, 0);
  }

  20% {
    clip: rect(9px, 450px, 47px, 0);
  }

  25% {
    clip: rect(31px, 450px, 21px, 0);
  }

  30% {
    clip: rect(44px, 450px, 9px, 0);
  }

  35% {
    clip: rect(17px, 450px, 38px, 0);
  }

  40% {
    clip: rect(26px, 450px, 25px, 0);
  }

  45% {
    clip: rect(12px, 450px, 43px, 0);
  }

  50% {
    clip: rect(35px, 450px, 18px, 0);
  }

  55% {
    clip: rect(8px, 450px, 49px, 0);
  }

  60% {
    clip: rect(29px, 450px, 23px, 0);
  }

  65% {
    clip: rect(42px, 450px, 11px, 0);
  }

  70% {
    clip: rect(15px, 450px, 40px, 0);
  }

  75% {
    clip: rect(24px, 450px, 27px, 0);
  }

  80% {
    clip: rect(10px, 450px, 45px, 0);
  }

  85% {
    clip: rect(33px, 450px, 20px, 0);
  }

  90% {
    clip: rect(46px, 450px, 7px, 0);
  }

  95% {
    clip: rect(13px, 450px, 42px, 0);
  }

  100% {
    clip: rect(28px, 450px, 26px, 0);
  }
}

/* ----- RESPONSIVE STYLES ----- */
@media (max-width: 768px) {
  .chart-controls {
    justify-content: space-between;
    padding: 0 10px 10px 10px;
  }

  .toggle-btn {
    padding: 4px 10px;
    min-width: 35px;
    font-size: 0.85rem;
  }
}

@media (max-width: 576px) {
  .chart-controls {
    justify-content: space-between;
    padding: 0 10px 10px 10px;
    flex-wrap: nowrap;
  }

  .chart-controls-label {
    font-size: 0.8rem;
    width: auto;
    margin-bottom: 0;
    text-align: left;
    white-space: nowrap;
  }

  .toggle-btn {
    padding: 4px 8px;
    min-width: 30px;
    font-size: 0.8rem;
  }

  .fee-star {
    font-size: 1em;
  }

  .datum-label {
    font-size: 0.85em;
    letter-spacing: 1px;
  }
}

/* Landscape orientation adjustments for short screens */
@media (orientation: landscape) and (max-height: 500px) {
  #graphContainer {
    height: 200px;
  }
  .chart-controls {
    flex-wrap: wrap;
  }
  .row.equal-height > [class*="col-"] .card-body {
    padding: 0.5rem;
  }
  .row.equal-height > [class*="col-"] .card-body p {
    font-size: 0.85rem;
  }
  .row.equal-height > [class*="col-"] .card-header {
    font-size: 1rem;
  }
}

/* ----- RETRO LED ----- */
.retro-led {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #00ff00;
  border-radius: 2px;
  margin-left: 6px;
  box-shadow:
    0 0 4px #00ff00,
    0 0 2px #00ff00;
  position: relative;
  top: -1.5px;
}

/* ----- RETRO LED (OFFLINE) ----- */
.retro-led-offline {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #ff5555;
  border-radius: 2px;
  margin-left: 6px;
  box-shadow:
    0 0 4px #ff5555,
    0 0 2px #ff5555;
  position: relative;
  top: -1.5px;
  opacity: 0.7;
}

/* ----- SATELLITE DISH INDICATOR ----- */
.satellite-dish {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
  position: relative;
  top: -1px;
}

/* Connected state - uses theme-aware colors */
.satellite-dish-connected {
  color: #00ff00; /* Default green */
  text-shadow:
    0 0 5px #00ff00,
    0 0 3px #00ff00;
  animation: pulse-satellite 2s infinite;
}

/* Offline state */
.satellite-dish-offline {
  color: #ff5555;
  text-shadow: 0 0 3px #ff5555;
  opacity: 0.7;
}

/* ----- DATUM PLUG ICON ----- */
.datum-plug {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
  position: relative;
  top: -1px;
}

.datum-plug-offline {
  color: #ff5555;
  text-shadow: 0 0 3px #ff5555;
  opacity: 0.7;
}

/* Theme-specific colors for the satellite dish */
html.deepsea-theme .satellite-dish-connected {
  color: #32cd32; /* Use same green for consistency */
  text-shadow:
    0 0 5px #32cd32,
    0 0 3px #32cd32;
}

@keyframes pulse-satellite {
  0%,
  100% {
    opacity: 0.9;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ----- FLOATING WINDOW (Theme Compatible & Clickable) ----- */
.floating-tab-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer; /* Makes overlay look clickable */
  transition: background 0.2s;
}

.floating-tab-overlay:hover {
  background: rgba(0, 0, 0, 0.55);
}

.floating-tab {
  background: var(--bg-color, #181c24);
  border: 2px solid var(--primary-color, #ffd700);
  box-shadow:
    0 8px 32px rgba(var(--primary-color-rgb, 255, 215, 0), 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.12);
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  position: relative;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--terminal-font, "VT323", monospace);
  cursor: default; /* Prevents pointer on content itself */
  transition:
    box-shadow 0.2s,
    transform 0.2s;
  width: 80%;
}

.floating-tab:hover {
  box-shadow:
    0 12px 40px 4px rgba(var(--primary-color-rgb, 255, 215, 0), 0.28),
    0 0 0 2px var(--primary-color, #ffd700);
  transform: scale(1.015);
}

.floating-tab iframe {
  border: none;
  width: 100%;
  height: 600px;
  max-width: 80vw;
  max-height: 60vh;
  background: #000;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(var(--primary-color-rgb, 255, 215, 0), 0.1);
}

.floating-tab-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: var(--primary-color, #ffd700);
  color: #181c24;
  border: none;
  font-size: 2rem;
  font-weight: bold;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  z-index: 10;
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s,
    opacity 0.2s;
  box-shadow: 0 2px 8px rgba(var(--primary-color-rgb, 255, 215, 0), 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.95;
}

.floating-tab-close:hover,
.floating-tab-close:focus {
  background: #222;
  color: var(--primary-color, #ffd700);
  box-shadow:
    0 0 0 3px var(--primary-color, #ffd700),
    0 2px 8px rgba(var(--primary-color-rgb, 255, 215, 0), 0.25);
  opacity: 1;
  outline: none;
}

.floating-tab-close:active {
  opacity: 0.8;
  background: var(--primary-color, #ffd700);
  color: #181c24;
}

/* Theme overrides for deepsea/bitcoin */
html.deepsea-theme .floating-tab {
  background: var(--bg-color, #181c24);
  border-color: var(--primary-color, #00dfff);
  box-shadow:
    0 8px 32px rgba(var(--primary-color-rgb, 0, 223, 255), 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.12);
}

html.deepsea-theme .floating-tab-close {
  background: var(--primary-color, #00dfff);
  color: #181c24;
}

html.deepsea-theme .floating-tab-close:hover,
html.deepsea-theme .floating-tab-close:focus {
  background: #222;
  color: var(--primary-color, #00dfff);
  box-shadow:
    0 0 0 3px var(--primary-color, #00dfff),
    0 2px 8px rgba(var(--primary-color-rgb, 0, 223, 255), 0.25);
}

html.bitcoin-theme .floating-tab {
  background: var(--bg-color, #fffbe6);
  border-color: var(--primary-color, #ffd700);
  box-shadow:
    0 8px 32px rgba(var(--primary-color-rgb, 255, 215, 0), 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.12);
}

html.bitcoin-theme .floating-tab-close {
  background: var(--primary-color, #ffd700);
  color: #181c24;
}

html.bitcoin-theme .floating-tab-close:hover,
html.bitcoin-theme .floating-tab-close:focus {
  background: #222;
  color: var(--primary-color, #ffd700);
  box-shadow:
    0 0 0 3px var(--primary-color, #ffd700),
    0 2px 8px rgba(var(--primary-color-rgb, 255, 215, 0), 0.25);
}

/* BTC Price Hover Effect - Theme Specific */
#btc_price {
  cursor: pointer !important;
  transition: color 0.2s !important;
  /* text-shadow and text-decoration transitions are not widely supported, but included for completeness */
  transition:
    color 0.2s,
    text-shadow 0.2s,
    text-decoration 0.2s !important;
}

#btc_price:hover {
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
  text-shadow:
    0 0 8px #ffd700,
    0 0 2px #fff !important;
  color: #fff700 !important;
}

/* DeepSea Theme */
html.deepsea-theme #btc_price:hover {
  color: #00dfff !important;
  text-shadow:
    0 0 10px #00dfff,
    0 0 2px #fff !important;
  text-decoration: underline wavy #00dfff !important;
}

/* Bitcoin Theme */
html.bitcoin-theme #btc_price:hover {
  color: #ffd700 !important;
  text-shadow:
    0 0 10px #ffd700,
    0 0 2px #fff !important;
  text-decoration: underline wavy #ffd700 !important;
}

/* Sparkline charts */
.sparkline {
    width: 60px;
    height: 16px;
    margin-left: 4px;
}

@media (max-width: 576px) {
  .sparkline {
    width: 40px !important;
  }
}

.hashrate-actions {
  margin-top: 0.5rem;
  text-align: right;
}

.download-btn {
  display: inline-block;
  padding: 4px 8px;
  font-family: var(--terminal-font);
  font-size: 0.9rem;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background-color: var(--primary-color);
  color: var(--bg-color);
}
