/*
 * This is a manifest file that'll be compiled into application.css.
 */

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #18212f;
  --muted: #5f6f86;
  --border: #dfe6f2;
  --primary: #2f5cff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f7f9fe 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.app-shell,
.files-page {
  max-width: 1100px;
  margin: 1.75rem auto;
  padding: 0 1rem 2rem;
}

.hero-card,
.panel,
.finder-columns,
.files-actions-grid > div,
.stat-card,
.app-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 30, 60, 0.06);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: center;
  padding: 1.25rem;
}

h1 { margin: 0.2rem 0 0.35rem; font-size: 1.9rem; }
h2 { margin: 0; font-size: 1.1rem; }
.eyebrow { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.muted { color: var(--muted); margin: .2rem 0 0; }

.hero-actions {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.hero-actions form {
  margin: 0;
  flex: 0 0 auto;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid transparent;
  padding: .55rem .9rem;
  font-weight: 600;
  font-size: .9rem;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.icon-button {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.app-card {
  display: block;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.app-card:hover {
  transform: translateY(-2px);
  border-color: #c9d7f5;
  box-shadow: 0 12px 28px rgba(15, 30, 60, 0.10);
}
.app-card h2 {
  margin-top: .35rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  margin-top: .9rem;
}
.stat-card { padding: .9rem 1rem; }
.stat-card .label { margin: 0; color: var(--muted); font-size: .82rem; }
.stat-card .value { margin: .2rem 0 0; font-size: 1.5rem; font-weight: 700; }
.completion-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 12px;
  min-height: 12px;
  margin: .45rem 0 .55rem;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe5f1;
  border: 1px solid #c9d7e8;
}
.completion-bar-fill {
  display: block;
  height: 100%;
  min-height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.panel { margin-top: .9rem; padding: 1rem; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; }
.text-link { color: var(--primary); text-decoration: none; font-weight: 600; }

.recent-list { margin: 0; padding: 0; list-style: none; }
.recent-list li {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #edf1f7;
  padding: .6rem 0;
}
.recent-list li:first-child { border-top: 0; }
.recent-list small { color: var(--muted); }

.flash { padding: 0.5rem 0.75rem; border-radius: 8px; }
.flash-notice { background: #eefbf1; color: #0a7a2f; }
.flash-alert { background: #fff1f1; color: #b00020; }

.finder-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  min-height: 360px;
}

.finder-column { border-right: 1px solid #eee; position: relative; }
.finder-column:last-child { border-right: 0; }
.finder-column-title {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  background: #fafafa;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
}
.drop-hint { color: var(--muted); font-weight: 500; font-size: .72rem; }
.finder-column.drop-active {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: #f8fbff;
}
.finder-column.drop-uploading::after {
  content: "Uploading...";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  color: var(--primary);
}
.finder-column ul { list-style: none; margin: 0; padding: 0; }
.finder-column li { border-bottom: 1px solid #f3f3f3; }
.finder-column li a,
.finder-column li span {
  display: block;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: #222;
}
.finder-column li.active a { background: #e8f1ff; }
.finder-column li a:hover { background: #f6f8ff; }
.finder-column li.js-entry-draggable { cursor: grab; }
.finder-column li.js-entry-draggable.is-dragging { opacity: 0.45; }
.finder-column li.js-directory-drop-target.drop-active-target {
  background: #edf4ff;
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}

.files-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.files-actions-grid > div { padding: .85rem; }

.aim-window {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.aim-sidebar,
.aim-chat { padding: 1rem; }
.buddy-list,
.conversation-list { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.buddy-link,
.conversation-list a {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: var(--text);
  padding: .45rem .5rem;
  border-radius: 8px;
}
.conversation-list a.active,
.buddy-link:hover,
.conversation-list a:hover { background: #eef3ff; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.status-dot.online { background: #16a34a; }

.chat-header { margin-bottom: .6rem; }
.chat-log {
  min-height: 380px;
  max-height: 56vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem;
  background: #fafcff;
}
.chat-bubble {
  max-width: 78%;
  margin-bottom: .55rem;
  padding: .55rem .65rem;
  border-radius: 10px;
  border: 1px solid #d9e1f0;
  background: #fff;
}
.chat-bubble.me { margin-left: auto; background: #e9f0ff; border-color: #cbd9ff; }
.chat-bubble p { margin: 0 0 .2rem; white-space: pre-wrap; }
.chat-bubble small { color: var(--muted); }

.chat-compose { margin-top: .75rem; display: grid; gap: .5rem; }
.chat-compose textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .7rem;
  font: inherit;
}

.endurance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.endurance-table th,
.endurance-table td {
  border-top: 1px solid #edf1f7;
  text-align: left;
  padding: .55rem .5rem;
}

.endurance-table thead th {
  border-top: 0;
  color: var(--muted);
  font-weight: 600;
}

.zone-chart-list {
  display: grid;
  gap: .9rem;
}
.zone-chart-row {
  display: grid;
  gap: .45rem;
}
.zone-chart-meta {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
}
.zone-chart-meta small {
  color: var(--muted);
}
.zone-chart-track {
  width: 100%;
  background: #edf1f7;
  border-radius: 999px;
  overflow: hidden;
}
.zone-chart-bar {
  display: flex;
  overflow: hidden;
  min-height: 16px;
  border-radius: 999px;
  background: transparent;
}
.zone-bar-fill {
  display: block;
  height: 16px;
}
.zone-z1 { background: #94a3b8; }
.zone-z2 { background: #22c55e; }
.zone-z3 { background: #facc15; }
.zone-z4 { background: #fb923c; }
.zone-z5 { background: #ef4444; }
.zone-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
}
.zone-bar-label {
  color: var(--muted);
  font-size: .82rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: .9rem;
}
.chart-card {
  background: linear-gradient(180deg, #162033 0%, #0f1726 100%);
  color: #f8fbff;
  border: 1px solid #24324a;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 36px rgba(8, 15, 29, 0.28);
}
.chart-card-header {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: .85rem;
}
.chart-card h2 {
  color: #f8fbff;
}
.chart-kicker {
  margin: 0 0 .2rem;
  color: #8ea3c7;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.chart-summary-pill {
  padding: .3rem .55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #d6e2ff;
  font-size: .78rem;
  white-space: nowrap;
}
.chart-shell {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: .55rem;
  align-items: start;
}
.chart-y-axis-gutter {
  height: 240px;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  color: #9db0d1;
  font-size: .76rem;
}
.chart-y-axis-gutter span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  line-height: 1;
  white-space: nowrap;
}
.chart-plot-column {
  display: grid;
  gap: .45rem;
  min-width: 0;
}
.chart-interactive {
  position: relative;
}
.workout-chart {
  width: 100%;
  height: 240px;
  display: block;
  background: linear-gradient(180deg, #101a2b 0%, #0b1422 100%);
  border: 1px solid #24324a;
  border-radius: 14px;
}
.chart-gridline {
  stroke: rgba(173, 190, 216, 0.22);
  stroke-width: 1;
}
.chart-hover-line {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.8;
}
.chart-hover-dot {
  fill: #ffffff;
  stroke: #0f1726;
  stroke-width: 0.8;
}
.chart-tooltip {
  position: absolute;
  top: .5rem;
  right: .5rem;
  display: grid;
  gap: .15rem;
  padding: .4rem .55rem;
  border-radius: 10px;
  background: rgba(8, 15, 29, 0.88);
  border: 1px solid rgba(173, 190, 216, 0.2);
  color: #f8fbff;
  font-size: .78rem;
  pointer-events: none;
}
.chart-tooltip strong {
  font-size: .86rem;
}
.chart-x-axis {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  color: #9db0d1;
  font-size: .76rem;
}
.chart-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-top: .85rem;
  padding-top: .8rem;
  border-top: 1px solid rgba(173, 190, 216, 0.14);
}
.chart-stat-label {
  display: block;
  color: #8ea3c7;
  font-size: .74rem;
  margin-bottom: .15rem;
}
.chart-stat-row strong {
  color: #f8fbff;
  font-size: .98rem;
}

.inline-help {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 800px) {
  .hero-card { flex-direction: column; align-items: flex-start; }
  .hero-actions {
    width: 100%;
    align-items: stretch;
  }
  .hero-actions form,
  .hero-actions a {
    max-width: 100%;
  }
  .stats-grid,
  .files-actions-grid,
  .aim-window,
  .chart-grid { grid-template-columns: 1fr; }

  .endurance-table {
    font-size: .82rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
