body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: #1d1d1f;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 15px 20px;
  background: transparent;
  width: 95%;
  position: relative;
  box-sizing: border-box;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 30px;
  text-align: center;
}

/* Top controls: Start on left, actions on right */
.top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.record-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 2;
}

.top-controls .transcription-actions {
  display: flex;
  gap: 10px;
  margin: 0;
  flex: 1;
}

/* Dual channel toggle checkbox */
.dual-channel-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  user-select: none;
  white-space: nowrap;
}

.dual-channel-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #88c2ff;
}

.dual-channel-toggle span {
  font-weight: 500;
}

.dual-channel-toggle:hover {
  color: #88c2ff;
}

body.dark-theme .dual-channel-toggle {
  color: #a0a0a0;
}

body.dark-theme .dual-channel-toggle:hover {
  color: #88c2ff;
}

#recordButton {
  flex: 1;
  height: 50px;
  border-radius: 8px;
  background-color: #88c2ff;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

#recordButton:hover {
  background-color: #60a4ed;
  transform: translateY(-2px);
}

#recordButton.recording {
  background-color: #ff3b30;
  animation: pulse 2s infinite;
}

.transcript-container {
  position: relative;
  margin-top: 30px;
}

.copy-button-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.enhanced-transcript-container {
  position: relative;
  margin-top: 0;
}

textarea {
  width: 100%;
  min-height: 150px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 15px;
  background: #fafafa;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}

.copy-button {
  padding: 8px 12px;
  background: #88c2ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 20px;
  flex-wrap: wrap;
}

.action-button {
  flex: 0 1 120px;
  max-width: 150px;
  height: 50px;
  border-radius: 8px;
  background-color: #88c2ff;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-button:hover {
  background-color: #60a4ed;
  transform: translateY(-2px);
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

@media (max-width: 480px) {
  .container {
    margin: 0 auto;
    padding: 0 15px 10px 15px;
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: 1.75rem;
    margin-bottom: 20px;
  }

  textarea {
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .button-container {
    gap: 10px;
    padding: 10px;
    flex-wrap: wrap;
  }

  .action-button {
    flex: 0 1 100px;
    max-width: 100px;
    height: 40px;
    font-size: 0.85rem;
  }

  .top-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .transcription-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .transcription-actions .action-button {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* Status bar - top row with theme toggle, timer, connection status */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.timer {
  font-size: 1.2rem;
  text-align: center;
}

.connection-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ff3b30;
  /* Red by default */
  transition: background-color 0.3s ease;
}

.connection-status.connected {
  background-color: #88c2ff;
  /* Green when connected */
}

.connection-status.connecting {
  animation: blink 1s infinite;
}

body.dark-theme {
  background: #1d1d1f;
  color: #f5f5f7;
}

body.dark-theme #recordButton {
  background-color: #88c2ff;
  /* Green */
}

body.dark-theme #recordButton.recording {
  background-color: #b50101;
  /* Orange */
}

body.dark-theme .copy-button {
  background: #88c2ff;
  /* Green */
}

@keyframes blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* Dark theme specific styles */
body.dark-theme .container {
  background: transparent;
  color: #f5f5f7;
}

body.dark-theme textarea {
  background: #1c1c1e;
  color: #f5f5f7;
  border-color: #3a3a3c;
}

body.dark-theme .action-button {
  background-color: #88c2ff;
}

body.dark-theme .action-button:hover {
  background-color: #60a4ed;
}

/* Toast messages */
.message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message.show {
  opacity: 1;
}

.message.error {
  background: #ff3b30;
  color: white;
}

.message.success {
  background: #34c759;
  color: white;
}

/* Disabled button state */
.action-button:disabled {
  background-color: #c0c0c0;
  cursor: not-allowed;
  opacity: 0.6;
}

.action-button:disabled:hover {
  background-color: #c0c0c0;
  transform: none;
}

/* Primary button style */
.action-button.primary {
  background-color: #34c759;
}

.action-button.primary:hover {
  background-color: #2da44e;
}

.action-button.primary:disabled {
  background-color: #c0c0c0;
}

body.dark-theme .action-button.primary {
  background-color: #34c759;
}

body.dark-theme .action-button.primary:hover {
  background-color: #2da44e;
}

body.dark-theme .action-button:disabled {
  background-color: #555;
  opacity: 0.5;
}

/* Transcription actions button container */
.transcription-actions {
  margin-top: 10px;
  margin-bottom: 10px;
}

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Dual transcript container */
.dual-transcript-container {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.transcript-box {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Box header with label and copy button */
.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.box-header label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  margin-bottom: 0;
}

/* Small copy button for labels and tabs */
.copy-btn-small {
  padding: 4px 10px;
  font-size: 0.8rem;
  background: #88c2ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn-small:hover {
  background: #60a4ed;
}

body.dark-theme .copy-btn-small {
  background: #88c2ff;
}

body.dark-theme .copy-btn-small:hover {
  background: #60a4ed;
}

.transcript-box label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: #666;
}

.transcript-box textarea {
  flex: 1;
  min-height: 150px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.transcript-box.selected textarea {
  border-color: #88c2ff;
  box-shadow: 0 0 0 3px rgba(136, 194, 255, 0.3);
}

.transcript-box.selected label,
.transcript-box.selected .box-header label {
  color: #88c2ff;
  font-weight: 600;
}

/* Dark theme for dual transcript */
body.dark-theme .transcript-box label,
body.dark-theme .box-header label {
  color: #a0a0a0;
}

body.dark-theme .transcript-box.selected label,
body.dark-theme .transcript-box.selected .box-header label {
  color: #88c2ff;
}

body.dark-theme .transcript-box.selected textarea {
  border-color: #88c2ff;
  box-shadow: 0 0 0 3px rgba(136, 194, 255, 0.2);
}

/* Mobile responsive for dual transcript */
@media (max-width: 480px) {
  .dual-transcript-container {
    flex-direction: column;
    gap: 20px;
  }

  .top-controls {
    flex-direction: column;
    gap: 10px;
  }

  .record-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* Start button takes full width and bolder */
  #recordButton {
    flex: none;
    width: 100%;
    min-width: unset;
    height: 56px;
    font-size: 1.1rem;
    font-weight: 600;
  }

  /* Dual, Sheet in record-section - hide them, we'll use a separate row */
  .record-section .dual-channel-toggle {
    display: none;
  }

  /* Todo row hidden on mobile too */
  .todo-row {
    display: none;
  }

  /* Mobile checkbox row - Dual, Sheet, Todo horizontal */
  .mobile-checkbox-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin: 20px 0;
  }

  .top-controls .transcription-actions {
    width: 100%;
    justify-content: center;
  }

  .dual-channel-toggle {
    font-size: 0.85rem;
  }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 481px) {
  .mobile-checkbox-row {
    display: none;
  }
}

/* Enhanced section with tabs */
.enhanced-section {
  margin-top: 15px;
}

/* Result tabs */
.result-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
}

.result-tabs .copy-btn-small {
  margin-left: 0;
}

.result-tab {
  padding: 8px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px 8px 0 0;
  background: #f5f5f5;
  color: #666;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: none;
}

.result-tab:hover:not(:disabled) {
  background: #e8e8e8;
}

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

.result-tab.active {
  background: #88c2ff;
  color: white;
  border-color: #88c2ff;
}

/* Result source label */
.result-source {
  font-size: 0.7rem;
  color: #888;
  margin-left: auto;
  white-space: nowrap;
}

.result-source:empty {
  display: none;
}

/* Append Notion button container */
.append-notion-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Dark theme for tabs */
body.dark-theme .result-tab {
  background: #3a3a3c;
  border-color: #555;
  color: #a0a0a0;
}

body.dark-theme .result-tab:hover:not(:disabled) {
  background: #4a4a4c;
}

body.dark-theme .result-tab.active {
  background: #88c2ff;
  color: white;
  border-color: #88c2ff;
}

body.dark-theme .result-source {
  color: #a0a0a0;
}

/* Mobile responsive for tabs */
@media (max-width: 480px) {
  .result-tabs {
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .result-tab {
    padding: 6px 12px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .result-source {
    font-size: 0.65rem;
    white-space: normal;
  }
}
