/*
   CSS styling examples for the Vaadin app.

   Visit https://vaadin.com/docs/styling/application-theme/ for more information.
*/

/* Example: CSS class name to center align the content . */
.centered-content {
  margin: 0 auto;
  max-width: 250px;
}

body {
  box-sizing: border-box;
  padding-bottom: 10pt;
}

.brand-title {
  gap: 2px;
}

.brand-heading {
  align-items: center;
  gap: 12px;
}

.brand-heading h2 {
  margin: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.dashboard-header {
  min-width: 0;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.instrument-tabs-header {
  min-width: 0;
}

.instrument-tabs-header vaadin-tabs {
  min-width: 0;
  overflow-x: auto;
}

.instrument-tabs-header vaadin-button {
  flex: 0 0 auto;
}

.dialog-selector-row,
.dialog-field-row,
.dialog-execution-row,
.dialog-strategy-field-row,
.admin-selector-row,
.admin-execution-row,
.admin-strategy-field-row,
.responsive-dialog-content,
.status-row {
  min-width: 0;
}


.trading-chart {
  flex: 0 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.market-workspace {
  align-items: stretch;
}

.market-workspace .trading-chart {
  flex: 1 1 0;
  min-width: 0;
}

.account-panel {
  flex: 0 0 220px;
  min-height: 480px;
  box-sizing: border-box;
  padding: 16px;
  border-radius: var(--lumo-border-radius-m);
  background: var(--lumo-contrast-5pct);
}

.account-panel-title {
  margin: 0 0 8px;
}

.account-panel-status,
.account-section-title {
  display: block;
  color: var(--lumo-secondary-text-color);
  font-size: var(--lumo-font-size-s);
}

.account-section-title {
  margin-top: 24px;
  margin-bottom: 8px;
  font-weight: 600;
}

.account-balances {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.account-wallet {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-wallet-title {
  color: var(--lumo-secondary-text-color);
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
}

.account-balance-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--lumo-contrast-10pct);
}

.account-balance-asset {
  font-weight: 600;
}

.account-balance-amounts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--lumo-secondary-text-color);
  font-size: var(--lumo-font-size-xs);
  text-align: right;
}

@media (max-width: 800px) {
  .market-workspace {
    flex-direction: column;
  }

  .account-panel {
    flex-basis: auto;
    width: 100% !important;
    min-height: auto;
  }
}

.chart-with-timeframe {
  position: relative;
  flex: 1 1 auto;
  min-height: 480px;
  height: auto;
  padding-bottom: 60px;
  box-sizing: border-box;
  background: var(--lumo-contrast-5pct);
  display: flex;
  flex-direction: column;
}

.chart-canvas {
  flex: 1 1 auto;
  height: auto;
  min-height: 420px;
}

.chart-timeframe-selector {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
}

.chart-live-toggle {
  position: absolute;
  left: 205px;
  bottom: 12px;
  z-index: 2;
  padding: 8px 12px;
  border-radius: var(--lumo-border-radius-m);
  background: var(--lumo-contrast-10pct);
}

.chart-close-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
}

.live-sizing-line,
.live-sizing-validation {
  display: block;
  padding: 3px 0;
}

.live-sizing-validation {
  color: var(--lumo-success-text-color);
  font-weight: 600;
}

.live-sizing-invalid {
  color: var(--lumo-error-text-color);
}

.candle-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.top-instruments-section {
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--lumo-contrast-10pct);
  border-bottom: 1px solid var(--lumo-contrast-10pct);
  white-space: nowrap;
}

.top-instruments-marquee-content {
  display: inline-block;
  min-width: 100%;
  padding-left: 100%;
  color: var(--lumo-secondary-text-color);
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
  animation: top-instruments-scroll 45s linear infinite;
}

@keyframes top-instruments-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

.dashboard-footer {
  box-sizing: border-box;
  min-height: 76px;
  margin-top: 8px;
  padding: 20px 16px 48px;
  border-top: 1px solid var(--lumo-contrast-10pct);
  color: var(--lumo-secondary-text-color);
  font-size: var(--lumo-font-size-s);
}

.thinking-feed-title {
  display: block;
  margin-bottom: 8px;
  color: var(--lumo-body-text-color);
  font-weight: 600;
}

.thinking-feed-viewport {
  height: 6.25rem;
  overflow: hidden;
  white-space: pre-line;
}

.thinking-feed-lines {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  line-height: 1.25rem;
}

.thinking-feed-line {
  flex: 0 0 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-page {
  overflow-y: auto;
}

@media (max-width: 600px) {
  .dashboard-page,
  .admin-page {
    box-sizing: border-box;
    padding: var(--lumo-space-s) !important;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: var(--lumo-space-s);
  }

  .brand-heading {
    gap: 8px;
  }

  .brand-heading h2 {
    font-size: var(--lumo-font-size-xl);
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: var(--lumo-space-xs);
  }

  .header-actions vaadin-button {
    min-width: 0;
    width: 100%;
  }

  .instrument-tabs-header {
    gap: var(--lumo-space-xs);
  }

  .instrument-tabs-header vaadin-tabs {
    flex: 1 1 auto;
  }

  .market-workspace {
    flex: 0 0 auto !important;
    gap: var(--lumo-space-s);
  }

  .market-workspace .trading-chart {
    flex: 0 0 360px;
    height: 360px;
    min-height: 360px;
  }

  .account-panel {
    padding: 12px;
  }

  .account-balances {
    max-height: 260px;
  }

  .chart-with-timeframe {
    flex: 0 0 360px;
    height: 360px;
    min-height: 0;
    padding-bottom: 104px;
  }

  .chart-canvas {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
  }

  .chart-timeframe-selector {
    left: 8px;
    bottom: 52px;
    width: calc(100% - 16px) !important;
  }

  .chart-live-toggle {
    left: 8px;
    bottom: 8px;
  }

  .chart-close-button {
    right: 8px;
    bottom: 8px;
  }

  .status-row {
    flex-wrap: wrap;
    gap: var(--lumo-space-xs);
  }

  .top-instruments-section {
    min-height: 40px;
  }

  .dashboard-footer {
    padding: 16px 8px 32px;
  }

  .responsive-dialog {
    max-width: calc(100vw - 16px);
  }

  .responsive-dialog-content,
  .dialog-selector-row,
  .dialog-field-row,
  .dialog-execution-row,
  .dialog-strategy-field-row,
  .admin-selector-row,
  .admin-execution-row,
  .admin-strategy-field-row {
    width: 100%;
  }

  .dialog-selector-row,
  .dialog-field-row,
  .dialog-execution-row,
  .dialog-strategy-field-row,
  .admin-selector-row,
  .admin-execution-row,
  .admin-strategy-field-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--lumo-space-s);
  }

  .dialog-selector-row > *,
  .dialog-field-row > *,
  .dialog-execution-row > *,
  .dialog-strategy-field-row > *,
  .admin-selector-row > *,
  .admin-execution-row > *,
  .admin-strategy-field-row > * {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0;
  }

  .admin-page > vaadin-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-instruments-marquee-content {
    padding-left: 0;
    animation: none;
  }
}
