:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --success: #059669;
  --danger: #DC2626;
  --warning: #D97706;
  --bg-main: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #0F172A;
  --text-sub: #64748B;
  --border: #E2E8F0;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 500px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid #FFFFFF;
}

.user-info .user-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.user-info .app-subtitle {
  font-size: 11px;
  color: var(--text-sub);
  background: #F1F5F9;
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px; /* Space for bottom nav */
  overflow-y: auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
  display: block;
}

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

/* TAB 1: Voice Recorder */
.recorder-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.recording-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #F1F5F9;
  padding: 8px 16px;
  border-radius: 30px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-sub);
}

.status-dot.recording {
  background: var(--danger);
  animation: pulseDot 1.2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 8px rgba(220, 38, 38, 0.6); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.timer {
  font-family: monospace;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
}

/* 8-Bar Waveform Visualizer */
.visualizer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 60px;
  margin-bottom: 16px;
}

.v-bar {
  width: 6px;
  background: #CBD5E1;
  border-radius: 4px;
  transition: height 0.08s ease;
}

.v-bar.active {
  background: linear-gradient(180deg, var(--primary) 0%, #818CF8 100%);
}

/* Decibel Level Meter */
.mic-level-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.meter-label {
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
}

.meter-bar-bg {
  flex: 1;
  height: 6px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}

.meter-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  transition: width 0.05s ease;
}

.meter-val {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-sub);
  min-width: 38px;
  text-align: right;
}

/* Control Buttons */
.recorder-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.ctrl-btn {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-record-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 26px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.main-record-btn:active {
  transform: scale(0.94);
}

.main-record-btn.recording {
  background: var(--danger);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
}

.sub-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #F1F5F9;
  color: var(--text-main);
  font-size: 16px;
}

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

.sub-btn:not(:disabled):hover {
  background: #E2E8F0;
}

.recorder-hint {
  font-size: 12px;
  color: var(--text-sub);
}

/* Playback and Transcribe Card */
.audio-playback-card {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  text-align: left;
}

.playback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.text-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
}

.text-btn.danger {
  color: var(--danger);
}

.audio-playback-card audio {
  width: 100%;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 8px;
}

.primary-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: all 0.2s;
}

.primary-btn:active {
  transform: scale(0.98);
}

/* Transcription Results */
.transcription-result-card {
  margin-top: 20px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.result-header h3 {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn-group {
  display: flex;
  gap: 6px;
}

.pill-btn {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #F8FAFC;
  cursor: pointer;
}

.pill-btn.highlight {
  background: #06C755; /* LINE Green */
  color: #FFFFFF;
  border-color: #06C755;
}

.diarization-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.speaker-bubble {
  background: #F8FAFC;
  border-radius: var(--radius-md);
  padding: 12px;
  border-left: 4px solid var(--primary);
}

.speaker-bubble.spk-2 {
  border-left-color: #EC4899;
  background: #FDF2F8;
}

.spk-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  display: block;
}

.speaker-bubble.spk-2 .spk-tag {
  color: #DB2777;
}

.spk-text {
  font-size: 13px;
  line-height: 1.5;
  color: #1E293B;
}

.summary-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 12px;
}

.summary-box h4 {
  font-size: 12px;
  font-weight: 700;
  color: #B45309;
  margin-bottom: 6px;
}

.summary-box p, .summary-box li {
  font-size: 12px;
  color: #78350F;
  line-height: 1.5;
}

/* TAB 2: Files Vault */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.stat-name {
  font-size: 11px;
  color: var(--text-sub);
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title-bar h3 {
  font-size: 14px;
  font-weight: 700;
}

.sync-status {
  font-size: 11px;
  color: var(--success);
}

.files-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

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

.file-icon {
  font-size: 20px;
}

.file-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-all;
}

.file-time {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

.file-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #F1F5F9;
  color: var(--text-sub);
  font-weight: 600;
}

.ocr-preview-box {
  background: #F8FAFC;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
  max-height: 60px;
  overflow-y: auto;
}

.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-sm.danger {
  color: var(--danger);
  border-color: #FECACA;
}

/* TAB 3: Todos */
.todo-quick-add {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.todo-quick-add input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
}

.todo-quick-add input:focus {
  border-color: var(--primary);
}

.todo-quick-add select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  background: #FFFFFF;
}

.add-btn {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  width: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.todo-filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.filter-tab {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-sub);
  cursor: pointer;
}

.filter-tab.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.todo-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.todo-item-card.completed {
  opacity: 0.6;
  background: #F8FAFC;
}

.todo-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.todo-text {
  font-size: 13px;
  color: var(--text-main);
}

.todo-item-card.completed .todo-text {
  text-decoration: line-through;
}

.todo-meta {
  font-size: 10px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* Bottom Nav */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 500px;
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-sub);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

.nav-item i {
  font-size: 18px;
}

.nav-item.active {
  color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.9);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
