/* File: src/bookforge_gui/app/static/css/app.css */
/* Purpose: Global styling for BookForge GUI (grid, cards, actions, logs). */

:root {
  --bg: #0b0d18;
  --panel: rgba(255, 255, 255, 0.03);
  --card: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --warn: rgba(242, 201, 76, 0.95);
  --err: rgba(255, 90, 90, 0.95);
  --ok: rgba(170, 255, 170, 0.95);
  --bar-bg: #0e1020;
  --bar-parsed: rgba(242, 201, 76, 0.62);
  --bar-audio: rgba(92, 124, 250, 0.68);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(92, 124, 250, 0.12), transparent 55%),
    radial-gradient(1000px 600px at 80% 20%, rgba(242, 201, 76, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
  background: rgba(11, 13, 24, 0.72);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.subtitle {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 14px;
  margin: 16px 0;
}

.panel-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.banner {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.banner-warn {
  border-color: rgba(242, 201, 76, 0.35);
  color: rgba(242, 201, 76, 0.95);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 200px 110px 110px 130px;
  gap: 10px;
  align-items: center;
}

.input,
.select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.20);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 10px;
  outline: none;
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.20);
}

.btn-small {
  padding: 7px 9px;
  font-size: 12px;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  overflow: hidden;
}

.card[data-status="succeeded"] {
  border-color: rgba(170, 255, 170, 0.55);
  box-shadow: 0 0 0 1px rgba(170, 255, 170, 0.12);
}

.card[data-status="running"],
.card[data-status="queued"],
.card[data-status="started"] {
  border-color: rgba(242, 201, 76, 0.55);
  box-shadow: 0 0 0 1px rgba(242, 201, 76, 0.10);
}

.card[data-status="failed"],
.card[data-status="errored"],
.card[data-status="error"] {
  border-color: rgba(255, 90, 90, 0.60);
  box-shadow: 0 0 0 1px rgba(255, 90, 90, 0.10);
}

.card-hidden {
  opacity: 0.62;
  border-style: dashed;
}

.card-cover img,
.card-left .cover img,
.card-left img {
  width: 90px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.card-left {
  width: 90px;
}

.card-left .cover {
  width: 90px;
}

.cover-placeholder {
  width: 90px;
  height: 120px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bar-bg);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.card-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.card-title {
  font-weight: 700;
}

.card-status {
  color: var(--muted);
  font-size: 12px;
}

.card-header {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.card-header .title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-link {
  display: inline-block;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.title-link:hover {
  color: var(--warn);
}

.card-header .author {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.meta-item {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.20);
  color: var(--muted);
}

.status-succeeded {
  color: rgba(170, 255, 170, 0.95);
  border-color: rgba(170, 255, 170, 0.30);
}

.status-running {
  color: rgba(242, 201, 76, 0.95);
  border-color: rgba(242, 201, 76, 0.30);
}

.status-failed {
  color: rgba(255, 90, 90, 0.95);
  border-color: rgba(255, 90, 90, 0.30);
}

.status-unknown {
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 6px 10px;
  font-size: 13px;
}

.k {
  color: var(--muted);
}

.v {
  word-break: break-word;
}

.progress {
  display: grid;
  gap: 8px;
}

.progress-row {
  display: grid;
  grid-template-columns: 60px 1fr 90px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.progress-row-compact {
  grid-template-columns: 60px 1fr;
}

.plabel {
  color: var(--muted);
}

.card-stats {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.stat {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 48px;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}

.stat-text {
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bar-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
}

.fill,
.bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--bar-parsed);
}

.fill-audio,
.bar-fill[data-audio-fill="1"] {
  background: var(--bar-audio);
}

.bar-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.2px;
  pointer-events: none;
}

.val {
  text-align: right;
}

.error,
.card-error {
  color: var(--err);
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  word-break: break-word;
}

.card-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 2px;
}

.start-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 500;
  max-width: 112px;
}

.start-option input {
  width: 11px;
  height: 11px;
  margin: 0;
  flex: 0 0 auto;
}

.card-activity {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  margin-top: 2px;
  padding: 3px 2px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  overflow: hidden;
}

.card-activity-time {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  line-height: 1.15;
}

.card-activity-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.15;
}

.card-activity[data-activity-level="success"] {
  color: #89e29a;
}

.card-activity[data-activity-level="warning"] {
  color: #ffd37a;
}

.card-activity[data-activity-level="error"] {
  color: var(--err);
}

.logs-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--bar-bg);
  min-height: 140px;
}

.events {
  display: grid;
  gap: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.event-ts {
  color: var(--muted);
  font-size: 12px;
}

.event-line {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.event-msg {
  margin-top: 4px;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.60);
  z-index: 50;
  padding: 24px;
}

.modal.open {
  display: grid;
  place-items: center;
}

.modal-panel {
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #111421;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-weight: 700;
}

.modal-body {
  padding: 14px;
  overflow: auto;
  max-height: calc(90vh - 60px);
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    grid-template-columns: 1fr 180px 100px 100px 120px;
  }
}

@media (max-width: 780px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .stat {
    grid-template-columns: 50px minmax(0, 1fr) 46px;
  }

  .event-row {
    grid-template-columns: 1fr;
  }
}

/* end src/bookforge_gui/app/static/css/app.css# */