/* ZS Interview Toolkit — shared modern UI (unified with the Knowledge Library visual language) */

:root {
  --primary: rgb(236, 114, 0);
  --primary-hover: rgb(200, 95, 0);
  --primary-soft: rgba(236, 114, 0, 0.12);
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08);
  --font: Arial, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 0%, rgba(236, 114, 0, 0.08), transparent 28%),
    linear-gradient(180deg, #fbfcfd 0%, #f3f6fa 42%, #eef2f6 100%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
}

.app-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.app-mark a { color: inherit; text-decoration: none; }
.app-mark a:hover { color: var(--primary); }
.app-mark::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-soft);
}

.app-topbar .brand-link {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.app-topbar .brand-link:hover { color: var(--primary); text-decoration: none; }

.lang-select {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.lang-select select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(236, 114, 0, 0.25);
}
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 14px -2px rgba(236, 114, 0, 0.45);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.full { width: 100%; }

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.home-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; box-shadow: 0 2px 8px -3px rgba(236,114,0,.4); }

/* Home */
.page-home {
  max-width: 1320px;
  margin: 0 auto;
  padding: 48px 40px 64px;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}
.page-header h1 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-header .logo { height: 38px; }
.page-header .sub {
  color: var(--text-muted);
  font-size: 15px;
  margin: 12px 0 0;
  max-width: 680px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 255px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 4px;
  background: var(--primary);
}
.card-kicker {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-hover);
}
.card-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  flex: 1;
}
.card .btn { margin-top: 8px; width: 100%; text-decoration: none; }
.card-featured {
  background: #fff;
  border-color: rgba(236, 114, 0, 0.25);
}
.card-featured::before { height: 5px; }

/* Tool pages (translation / transcription) */
.page-tool {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 40px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.page-tool .main-col { flex: 1; min-width: 0; }
.page-tool .side-col {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
}

.panel h2, .panel h3 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 600;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
}
label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:hover, input[type="password"]:hover, textarea:hover, select:hover { border-color: var(--text-soft); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-soft); }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}
/* file inputs — style the browser's picker button into a proper pill */
input[type="file"] { padding: 8px 12px; cursor: pointer; }
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  margin-right: 12px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  cursor: pointer;
  transition: background 0.15s;
}
input[type="file"]::file-selector-button:hover { background: rgba(236,114,0,0.2); }

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.progress-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13px;
}

.footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}
.account-line { margin-top: 10px; }
.account-line a { color: var(--text-muted); margin: 0 8px; }
.account-line a:hover { color: var(--primary); }

/* Insights workspace */
.insights-setup {
  max-width: 640px;
  margin: 32px auto;
  padding: 0 24px;
}
.insights-setup .panel { padding: 32px; }
.insights-setup h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.insights-workspace {
  display: none;
  height: calc(100vh - 57px);
}
.insights-workspace.active { display: flex; }

.insights-sidebar {
  width: 320px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.insights-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.insights-tree-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.tree-module { margin-bottom: 4px; }
.tree-module-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.tree-module-head:hover { background: var(--surface-2); }
.tree-module-head .chev {
  width: 16px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.tree-module.collapsed .chev { transform: rotate(-90deg); }
.tree-module.collapsed .tree-module-body { display: none; }
.tree-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px 4px 28px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tree-q {
  font-size: 12px;
  padding: 8px 12px 8px 28px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1.4;
  color: var(--text);
  border-left: 3px solid transparent;
}
.tree-q:hover { background: var(--surface-2); }
.tree-q.active {
  background: var(--primary-soft);
  border-left-color: var(--primary);
  font-weight: 500;
}

.insights-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.insights-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.insights-content .panel { margin-bottom: 16px; }

.q-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
}
.q-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0 16px;
}
.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--border);
  color: var(--text);
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  line-height: 1.35;
}
.tag.accent { background: var(--primary-soft); color: var(--primary-hover); }

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.data-table th {
  background: var(--surface-2);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.ref-file { font-weight: 600; font-size: 12px; margin-bottom: 6px; }
.ref-quote { color: var(--text-muted); font-size: 12px; white-space: pre-wrap; }

.insights-chat {
  height: 240px;
  min-height: 190px;
  max-height: 70vh;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
#chatLog {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 13px;
  margin-bottom: 12px;
}
.chat-row { margin-bottom: 10px; }
.chat-user { font-weight: 500; }
.chat-ai {
  background: var(--surface-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.status-bar {
  padding: 10px 24px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 13px;
  color: #92400e;
  display: none;
}
.status-bar.show { display: block; }

.bg-snippet {
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  line-height: 1.45;
}

.page-tool {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.page-tool .left-panel { flex: 1; min-width: 0; }
.page-tool .right-panel {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}
.page-tool .header {
  text-align: left;
  margin: 18px 0 22px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.page-tool .header h1 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-tool .logo { height: 34px; }
.page-tool .header-right { color: var(--text-muted); font-size: 12px; margin-top: 8px; }
.page-tool .topbar { margin-bottom: 12px; }

.tool-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.tool-shell form { margin: 0; }
.form-group { margin-bottom: 18px; }
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tool-submit {
  width: 100%;
  margin-top: 8px;
}
.progress-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.progress-box h3 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.progress-item {
  margin: 14px 0;
  display: flex;
  align-items: center;
  gap: 11px;
}
.progress-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.progress-icon.active {
  background: var(--primary);
  color: #fff;
}
.progress-icon.done {
  background: var(--success);
  color: #fff;
}
.progress-text {
  color: var(--text-muted);
  font-size: 13px;
}
.progress-text.active {
  color: var(--primary-hover);
  font-weight: 700;
}
.progress-text.done {
  color: var(--success);
  font-weight: 600;
}
.progress-bar {
  width: 100%;
  height: 9px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 18px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  width: 0%;
  transition: width 0.5s ease;
}
.download-section {
  display: none;
  margin-top: 20px;
  padding: 20px;
  background: var(--success-soft);
  border: 1px solid rgba(22, 163, 74, 0.18);
  border-radius: var(--radius);
  text-align: center;
}
.download-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.download-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px 18px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
}
.download-btn:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

body.page-tool {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .page-header { grid-template-columns: 1fr; align-items: start; }
  .card-grid { grid-template-columns: 1fr; }
  .page-tool, body.page-tool { flex-direction: column; }
  .page-tool .side-col, .page-tool .right-panel, body.page-tool .right-panel { width: 100%; position: static; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .insights-workspace.active { flex-direction: column; height: auto; }
  .insights-sidebar { width: 100%; max-height: 40vh; }
}
