/* === Global Styles === */
body {
  font-family: system-ui, sans-serif;
  background: #f6f8fa;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: start;
  padding: 20px;
}

.container {
  max-width: 900px;
  width: 100%;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* === Title === */
h1 {
  margin-top: 0;
  text-align: center;
}

/* === Controls (buy/sell buttons) === */
#controls {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

select, input[type="number"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
}

button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #1d4ed8;
}

/* === Tabs === */
.tabs {
  margin-top: 1.5rem;
  display: flex;
  border-bottom: 2px solid #e2e8f0;
}

.tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: bold;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  background: #f1f5f9;
  margin-right: 2px;
  user-select: none;
  transition: background 0.2s;
}

.tab.active {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-bottom: none;
}

/* === Tab Panels === */
.tab-panel {
  display: none;
  margin-top: 0;
}

.tab-panel.active {
  display: block;
  margin-top: 1rem;
}

/* === Chart Styling === */
#chart {
  width: 100%;
  height: 500px;
  max-height: 500px;
  min-height: 500px;
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: block;
  padding: 10px;
}

/* === Log Box === */
pre#log {
  background: #f1f5f9;
  padding: 10px;
  border-radius: 6px;
  height: 150px;
  overflow-y: auto;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* === Portfolio & Market Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

th, td {
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: #f1f5f9;
}

/* === Portfolio Section === */
.portfolio, #market {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #e2e8f0;
}

/* === Responsive === */
@media (max-width: 600px) {
  #chart {
    height: 200px;
    max-height: 200px;
    min-height: 200px;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab {
    flex: 1 1 auto;
    text-align: center;
  }

  #controls {
    flex-direction: column;
    align-items: stretch;
  }
}
