/* server/app/static/css/app.css */

/* === Design tokens (matching Android app) === */
:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --primary: #3D8E9E;
  --primary-pale: #E0F4F6;
  --primary-dark: #347a88;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #E0E0E0;
  --border-light: #F0F0F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 10px;
  --radius-full: 9999px;
  --status-pending: #FFA726;
  --status-processing: #42A5F5;
  --status-done: #66BB6A;
  --status-error: #EF5350;
  --speaker-0: #3D8E9E;
  --speaker-1: #C9704D;
  --speaker-2: #5C6BC0;
  --speaker-3: #66BB6A;
  --speaker-4: #AB47BC;
  --speaker-5: #FF7043;
  --speaker-6: #6D4C41;
  --speaker-7: #00ACC1;
}

/* === App shell === */
.app-screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
}
.app-screen.active { display: flex; }

/* === Screen header (Task 7 naming) === */
.screen-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}
.screen-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.screen-logo { border-radius: 50%; }
.screen-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.screen-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}
.screen-header-btn:hover { background: var(--border); }
.screen-body {
  flex: 1;
  overflow-y: auto;
}

/* === Bottom bar (Task 7 naming) === */
.screen-bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--surface);
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border-light);
}
.bottom-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
}
.bottom-btn-primary {
  background: var(--status-error);
  color: white;
}
.bottom-btn-primary svg { stroke: white; }
.bottom-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.bottom-btn-secondary:hover { border-color: var(--primary); }

/* Hide old site header/footer when app screens are active */
.app-screen.active ~ .header,
body:has(.app-screen.active) > .header,
body:has(.app-screen.active) > header,
body:has(.app-screen.active) > footer,
body:has(.app-screen.active) > .footer { display: none !important; }

/* === App header === */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.app-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.app-header-brand img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.app-header-brand span {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.app-header-actions {
  display: flex;
  gap: 4px;
}
.app-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s;
}
.app-header-btn:hover { background: var(--border); }
.app-back {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Bottom bar === */
.app-bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--surface);
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border-light);
}
.btn-record {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--status-error);
  color: white;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.btn-import {
  flex: 1;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.btn-import:hover { border-color: var(--primary); }

/* === Tag filter bar === */
.tag-bar {
  padding: 10px 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tag-bar::-webkit-scrollbar { display: none; }
.tag-chip-filter {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.tag-chip-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* === Section headers === */
.section-header {
  padding: 8px 16px 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* === Job card === */
.job-card {
  margin: 0 12px 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  cursor: pointer;
  transition: box-shadow 0.15s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.job-card:hover { box-shadow: var(--shadow-md); }
.job-card-border {
  width: 4px;
  flex-shrink: 0;
}
.job-card-body {
  padding: 12px 14px;
  flex: 1;
  min-width: 0;
}
.job-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.job-card-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.job-card-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  flex-shrink: 0;
}
.job-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.job-card-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.tag-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  color: white;
}

/* === Empty state === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state h3 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* === Recording screen === */
.record-screen { background: #FAFAFA; }
.record-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 32px;
}
.record-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-error);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.record-indicator span {
  font-size: 13px;
  color: var(--status-error);
  font-weight: 500;
}
.record-timer {
  font-size: 52px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  margin-bottom: 32px;
}
.record-waveform {
  width: 100%;
  height: 60px;
  background: #F0F0F0;
  border-radius: 8px;
  margin-bottom: 40px;
}
.record-buttons {
  display: flex;
  align-items: center;
  gap: 32px;
}
.record-btn-pause {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-pale);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.record-btn-main {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--status-error);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239,83,80,0.3);
  transition: border-radius 0.2s, transform 0.1s;
}
.record-btn-main.recording {
  border-radius: 16px;
  animation: pulse-scale 1.5s ease-in-out infinite;
}
@keyframes pulse-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.record-btn-inner-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
}
.record-btn-inner-square {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: white;
}
.record-hint {
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

/* === Result screen === */
.result-audio-bar {
  padding: 10px 16px;
  background: #FAFAFA;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}
.audio-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-pale);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.result-meta {
  padding: 12px 16px;
}
.result-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.result-tags {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tag-add-btn {
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 14px;
  background: var(--primary-pale);
  color: var(--primary);
  cursor: pointer;
  border: 1.5px solid var(--primary);
  outline: none;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
  -webkit-appearance: none;
  appearance: none;
}
.speaker-list {
  padding: 0 16px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.speaker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 6px;
}
.speaker-row:hover { background: var(--border-light); }
.speaker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.speaker-name { flex: 1; font-size: 13px; }

/* === Transcript segments === */
.transcript {
  padding: 0 16px 100px;
}
.segment {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.segment-ts {
  width: 52px;
  display: flex;
  align-items: flex-start;
  gap: 3px;
  padding-top: 3px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 11px;
}
.segment-ts:hover { opacity: 0.7; }
.segment-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.segment-speaker {
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.segment-speaker:hover { text-decoration: underline; }
.segment-text {
  font-size: 14px;
  margin-top: 2px;
  line-height: 1.5;
}

/* === Result bottom actions === */
.result-actions {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  padding: 8px 24px;
  display: flex;
  justify-content: space-evenly;
}
.result-action {
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 8px;
}
.result-action svg { color: var(--primary); }
.result-action span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* === Dialog/Modal === */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  width: calc(100% - 48px);
  max-width: 360px;
  box-sizing: border-box;
  overflow: hidden;
  max-height: 80vh;
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}
.dialog > div:first-of-type {
  overflow-y: auto;
  max-height: 60vh;
}
.dialog h3 {
  font-size: 17px;
  margin-bottom: 12px;
}
.dialog input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.dialog input:focus {
  outline: none;
  border-color: var(--primary);
}
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dialog-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.dialog-btn-cancel {
  background: none;
  color: var(--text-secondary);
}
.dialog-btn-confirm {
  background: var(--primary);
  color: white;
}
.dialog-btn-danger {
  background: var(--status-error);
  color: white;
}

/* === Context menu === */
.context-menu {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 4px 0;
  min-width: 200px;
}
.context-menu-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}
.context-menu-item:hover { background: var(--border-light); }
.context-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  z-index: 200;
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === Upload progress === */
.upload-bar {
  margin: 0 12px;
  background: var(--border-light);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
}
.upload-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

/* === File picker (hidden) === */
#file-picker { display: none; }
