/* BASE - reset and the three slots. Layout lives here, never in a plugin. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 14px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; overflow-x: hidden;
}

body { display: flex; flex-direction: column; }

/* ---------------- the three slots ---------------- */
.slot[data-slot="header"] {
  display: flex; align-items: center; gap: 14px;
  height: 44px; flex: none;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.slot[data-slot="main"] {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--gap); padding: var(--gap);
  overflow-y: auto; overflow-x: hidden;
}

.slot[data-slot="below"] {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

/* every plugin is wrapped in its own box, so styles cannot leak between plugins */
.plugin { display: contents; }
.plugin { min-width: 0; }
.plugin-clock, .plugin-stats { display: flex; align-items: center; gap: 12px; }
.plugin-chart { display: flex; flex-direction: column; align-items: center; width: 100%; }
.plugin-price { margin-left: auto; }

/* ---------------- phones and small windows: everything vertical ---------------- */
@media (max-width: 900px) {
  .slot[data-slot="header"] { padding: 8px 12px; }
  .slot[data-slot="main"] {
    padding: 8px; gap: 8px;
    justify-content: flex-start; align-items: stretch;
  }
  .slot[data-slot="main"] .plugin { display: block; width: 100%; max-width: 100%; min-width: 0; }
  .slot[data-slot="below"] { padding: 6px 10px; gap: 10px; }
  .plugin-price { display: none; }
}

/* ---------------- desktop grid: absorber on top, footprint + chart side by side ---------------- */
@media (min-width: 901px) {
  .slot[data-slot="main"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(240px, 52vh) minmax(200px, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 1360px;
    align-content: stretch;
    justify-items: stretch;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
  }
  .slot[data-slot="main"] .plugin { display: block; min-width: 0; max-width: 100%; }

  /* the candles take the wide top row; footprint and absorber share the row below */
  .plugin-chart { grid-column: 1 / -1 !important; grid-row: 1; width: 100% !important; max-width: none; }
  .plugin-footprint { grid-column: 1; grid-row: 2; }
  .plugin-absorber { grid-column: 2; grid-row: 2; }

  .plugin-footprint, .plugin-absorber, .plugin-chart { align-self: stretch; height: 100%; }
  .plugin-absorber .ab { height: 100%; display: flex; flex-direction: column; }
  .plugin-absorber .ab-canvas { flex: 1 1 0; height: 100%; min-height: 200px; }
  .plugin-footprint .fp { height: 100%; }
  .plugin-footprint .fp-body { flex: 1; }
  .plugin-chart .chart-canvas { width: 100% !important; height: 100%; min-height: 320px; }
}
