/* =====================
   CSS VARIABLES
   ===================== */
:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --card: #16213e;
  --border: #2a2a4a;
  --primary: #e94560;
  --primary-dark: #c73652;
  --accent: #7c4dff;
  --text: #e8e8f0;
  --text-secondary: #8888aa;
  --success: #4caf50;
  --warning: #ff9800;
  --error-color: #f44336;

  --speaker-1: #7c4dff;
  --speaker-2: #00bcd4;
  --speaker-3: #ff9800;
  --speaker-4: #4caf50;
  --speaker-5: #e91e63;

  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.18s ease;
}

/* =====================
   RESET & BASE
   ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* =====================
   VIEWS
   ===================== */
.view {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================
   HEADER
   ===================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.header h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.header-title h1 {
  text-align: left;
  font-size: 19px;
}

.logo-icon {
  font-size: 22px;
  line-height: 1;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  min-width: 38px;
  min-height: 38px;
}

.icon-btn:active {
  color: var(--text);
  background: var(--border);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.header-spacer {
  min-width: 38px;
}

/* =====================
   ERROR BANNER
   ===================== */
.error-banner {
  background: rgba(244, 67, 54, 0.12);
  border-bottom: 1px solid rgba(244, 67, 54, 0.25);
  color: #ff6b6b;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1.4;
}

.error-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.error-close {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0 2px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.7;
}

.error-close:active { opacity: 1; }

/* =====================
   RECORD VIEW
   ===================== */
.record-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 28px;
  overflow: hidden;
}

/* Waveform / Mic idle area */
.waveform-container {
  width: 220px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mic-idle {
  color: var(--text-secondary);
  opacity: 0.35;
  transition: opacity 0.3s;
}

.mic-idle svg {
  width: 80px;
  height: 80px;
}

/* Mic meter canvas */
#mic-meter {
  display: block;
  border-radius: 6px;
  background: transparent;
}

.meter-paused {
  opacity: 0.3;
}

/* Timer */
.timer-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

#timer {
  font-size: 52px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  color: var(--text);
  transition: color 0.3s;
}

#timer.recording { color: var(--primary); }

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  animation: blink 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

.rec-dot.paused {
  animation: none;
  opacity: 0.4;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-text {
  color: var(--text-secondary);
  font-size: 15px;
  min-height: 22px;
}

.screen-off-hint {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: .7;
  margin-top: -6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.screen-off-hint::before {
  content: '🔒';
  font-size: 11px;
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

/* Record button — large pulsing ring */
.record-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
  padding: 0;
  position: relative;
}

.record-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(233, 69, 96, 0.3);
  animation: ring-pulse 2s ease-out infinite;
}

@keyframes ring-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.record-btn svg {
  width: 38px;
  height: 38px;
  color: var(--primary);
}

.record-btn:active {
  transform: scale(0.93);
  box-shadow: 0 0 24px rgba(233, 69, 96, 0.35);
}

/* Stop / Pause buttons */
.stop-btn, .pause-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  padding: 0;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
}

.stop-btn svg, .pause-btn svg {
  width: 22px;
  height: 22px;
}

.stop-btn { border-color: var(--primary); color: var(--primary); }
.stop-btn:active, .pause-btn:active {
  background: var(--border);
  transform: scale(0.93);
}

.view-results-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.view-results-btn:active {
  color: var(--text);
  border-color: var(--text-secondary);
}

/* =====================
   SETTINGS VIEW
   ===================== */
.settings-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.settings-group {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.settings-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.setting-item { margin-bottom: 16px; }
.setting-item:last-child { margin-bottom: 0; }

.setting-item label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.setting-item input,
.setting-item select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.setting-item select {
  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='%238888aa' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

.setting-item input:focus,
.setting-item select:focus { border-color: var(--accent); }

.setting-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.45;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn {
  flex: 1;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.btn:active {
  opacity: 0.8;
  transform: scale(0.97);
}

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

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }

.test-result {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.4;
  display: none;
}

.test-result.visible { display: block; }
.test-result.testing { background: rgba(124,77,255,.1); border: 1px solid rgba(124,77,255,.3); color: #a78bfa; }
.test-result.success { background: rgba(76,175,80,.1); border: 1px solid rgba(76,175,80,.3); color: #81c784; }
.test-result.error-state { background: rgba(244,67,54,.1); border: 1px solid rgba(244,67,54,.3); color: #e57373; }

/* Setup guide */
.guide {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.guide-step p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-step strong { color: var(--text); }

/* =====================
   PROCESSING VIEW
   ===================== */
.view-processing { background: var(--bg); }

.processing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 22px;
  text-align: center;
}

.spinner {
  width: 64px;
  height: 64px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.processing-main h2 { font-size: 22px; font-weight: 600; }

.processing-stage {
  color: var(--text-secondary);
  font-size: 15px;
  min-height: 22px;
  max-width: 280px;
}

.progress-bar {
  width: 100%;
  max-width: 300px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 2px;
  transition: width 0.6s ease;
}

.processing-hint {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 260px;
  line-height: 1.5;
}

/* =====================
   RESULTS VIEW
   ===================== */
.view-results { background: var(--bg); }

.results-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 13px 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.badge {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

/* ---- Summary Tab ---- */
.summary-tab h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  margin-top: 20px;
}

.summary-tab h3:first-child { margin-top: 0; }

.summary-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 36px;
  font-size: 14px;
  line-height: 1.55;
  position: relative;
}

.summary-list li::before {
  content: '•';
  position: absolute;
  left: 14px;
  top: 11px;
  color: var(--accent);
  font-size: 20px;
  line-height: 1.2;
}

.participants {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.participant {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px 6px 6px;
}

.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.participant-avatar.sp-1 { background: var(--speaker-1); }
.participant-avatar.sp-2 { background: var(--speaker-2); }
.participant-avatar.sp-3 { background: var(--speaker-3); }
.participant-avatar.sp-4 { background: var(--speaker-4); }
.participant-avatar.sp-5 { background: var(--speaker-5); }

.participant span { font-size: 14px; }

/* ---- Transcript Tab ---- */
.transcript-tab {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- Audio player ---- */
.tx-player {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.tx-play-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tx-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 32px;
}

.tx-scrubber-wrap {
  flex: 1;
  cursor: pointer;
  padding: 8px 0;
  position: relative;
}

.tx-scrubber-track {
  position: relative;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.tx-scrubber-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
}

.tx-scrubber-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
}

/* ---- Plain transcript text ---- */
.transcript-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tx-line {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .15s;
}

.tx-word {
  display: inline;
}

.tx-word.tx-word-active {
  background: #facc15;
  color: #1a1a1a;
  border-radius: 3px;
  padding: 0 1px;
}

.tx-speaker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  position: relative;
}

.tx-speaker {
  font-weight: 700;
  color: var(--accent);
}

.tx-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0;
  padding: 1px 3px;
  border-radius: 4px;
  transition: opacity .15s, background .15s;
  line-height: 1;
}

.tx-line:hover .tx-edit-btn,
.tx-speaker-wrap:hover .tx-edit-btn {
  opacity: 1;
}

.tx-edit-btn:hover {
  background: var(--surface);
  color: var(--accent);
}

/* ---- Rename popover ---- */
.tx-rename-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  white-space: nowrap;
}

.tx-rename-popover-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 5px 9px;
  width: 160px;
}

.tx-rename-popover-input:focus {
  outline: none;
  border-color: var(--accent);
}

.tx-rename-popover-ok {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
}

.timestamp {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ---- Actions Tab ---- */
.actions-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.action-check { flex-shrink: 0; padding-top: 2px; }

.action-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

.action-content { flex: 1; }

.action-text {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-owner, .action-deadline {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--card);
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  text-align: center;
}

.empty-icon {
  font-size: 44px;
  opacity: 0.5;
}

.empty-state p { color: var(--text-secondary); font-size: 15px; }

/* =====================
   HEADER ACTIONS
   ===================== */
.header-actions {
  display: flex;
  gap: 2px;
}

/* =====================
   UPLOAD ROW (record screen)
   ===================== */
.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.upload-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.upload-divider-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.upload-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.upload-btn:active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124, 77, 255, 0.08);
}

/* =====================
   RECENT MEETINGS (record screen)
   ===================== */
.recent-meetings {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.recent-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.recent-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: border-color var(--transition), background var(--transition);
}

.recent-item:active { background: var(--card); border-color: var(--accent); }

.recent-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* =====================
   MODEL FETCH ROW (settings)
   ===================== */
.models-fetch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-sm {
  flex: none;
  padding: 9px 16px;
  font-size: 13px;
  white-space: nowrap;
}

.fetch-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.fetch-info.fetching { color: var(--accent); }
.fetch-info.success  { color: var(--success); }
.fetch-info.error-info { color: var(--error-color); }

/* Custom model picker — inline (no absolute positioning, no clipping issues) */
.model-picker { width: 100%; }

.model-input-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.model-input-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
  min-width: 0;
}

.model-input-row input:focus { border-color: var(--accent); }

.model-chevron {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.model-chevron svg { width: 18px; height: 18px; }
.model-chevron:active { background: var(--border); color: var(--text); border-color: var(--accent); }

/* Inline dropdown — part of document flow, no overflow clipping */
.model-dropdown {
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.model-dropdown.hidden { display: none; }

.model-search-input {
  width: 100%;
  background: var(--bg);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  display: block;
}

.model-search-input::placeholder { color: var(--text-secondary); }

.model-items {
  max-height: 200px;
  overflow-y: auto;
}

.model-option {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  line-height: 1.3;
  transition: background var(--transition);
}

.model-option:last-child { border-bottom: none; }
.model-option:active { background: var(--accent); color: white; }

.model-option-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* =====================
   HISTORY VIEW
   ===================== */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 0;
  transition: border-color var(--transition);
}

.history-item:has(.history-item-btn:active) { border-color: var(--accent); }

.history-item-btn {
  flex: 1;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 10px 14px;
}

.history-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.download-btn { color: var(--accent); opacity: 0.5; flex-shrink: 0; text-decoration: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; }
.download-btn:active { opacity: 1; }
.delete-btn { color: var(--error-color); opacity: 0.5; flex-shrink: 0; }
.delete-btn:active { opacity: 1; }

/* =====================
   SCROLLBAR
   ===================== */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
