* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
}

.logout-link {
  color: #888;
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s;
}

.logout-link:hover {
  color: #f97316;
}

main {
  max-width: 800px;
  margin: 0 auto;
}

/* Config */
.config-section {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Settings details (collapsible) */
.settings-details {
  margin-bottom: 1rem;
  cursor: default;
}

.settings-summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: #aaa;
  cursor: pointer;
  padding: 0.3rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-summary::-webkit-details-marker {
  display: none;
}

.settings-summary::before {
  content: "\25B6";
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.settings-details[open] > .settings-summary::before {
  transform: rotate(90deg);
}

.settings-content {
  padding-top: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.85rem;
  color: #aaa;
  font-weight: 500;
}

.api-key-row {
  display: flex;
  gap: 0.5rem;
}

.api-key-row input {
  flex: 1;
}

input[type="password"],
input[type="text"],
select {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

textarea {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #f97316;
}

.field-hint {
  font-size: 0.75rem;
  color: #666;
  font-style: italic;
}

input[type="file"] {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 0.8rem;
}

#toggleKey {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  color: #aaa;
  padding: 0 0.7rem;
  cursor: pointer;
  font-size: 1rem;
}

#toggleKey:hover {
  background: #333;
}

button#transcribeBtn {
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 0.5rem;
}

button#transcribeBtn:hover:not(:disabled) {
  opacity: 0.85;
}

button#transcribeBtn:disabled {
  background: #444;
  color: #777;
  cursor: not-allowed;
}

/* Login button */
.login-btn {
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 0.5rem;
  width: 100%;
}

.login-btn:hover {
  opacity: 0.85;
}

/* Error message */
.error-message {
  background: #4a1a1a;
  color: #ec7063;
  border: 1px solid #ec7063;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

/* Audio preview */
.audio-preview {
  margin-top: 1.5rem;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1rem 1.5rem;
}

.audio-preview-label {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.audio-preview audio {
  width: 100%;
  height: 36px;
  border-radius: 6px;
}

/* Status */
.status-section {
  margin-top: 1.5rem;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1rem 1.5rem;
}

.progress-bar {
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.progress-fill {
  height: 100%;
  background: #f97316;
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s;
}

.progress-fill.indeterminate {
  width: 30%;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

#statusText {
  font-size: 0.85rem;
  color: #aaa;
}

/* Results */
.result-section {
  margin-top: 1.5rem;
}

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

.result-header h2 {
  font-size: 1.2rem;
  color: #fff;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.result-actions button {
  background: #222;
  border: 1px solid #333;
  border-radius: 6px;
  color: #f97316;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.result-actions button:hover {
  background: #333;
}

/* Transcript */
.transcript {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 1.5rem;
  line-height: 1.7;
  max-height: 70vh;
  overflow-y: auto;
}

.segment {
  margin-bottom: 1rem;
  padding-left: 1rem;
  border-left: 3px solid #333;
}

.segment-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.speaker-label {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.timestamp {
  font-size: 0.75rem;
  color: #666;
  font-family: "SF Mono", "Fira Code", monospace;
}

.segment-text {
  font-size: 0.95rem;
  color: #ddd;
}

/* Speaker colors */
.speaker-0 { background: #1e3a5f; color: #5dade2; border-color: #5dade2; }
.speaker-1 { background: #4a1942; color: #c39bd3; border-color: #c39bd3; }
.speaker-2 { background: #1a4731; color: #58d68d; border-color: #58d68d; }
.speaker-3 { background: #4a3f1a; color: #f7dc6f; border-color: #f7dc6f; }
.speaker-4 { background: #4a1a1a; color: #ec7063; border-color: #ec7063; }
.speaker-5 { background: #1a3f4a; color: #76d7c4; border-color: #76d7c4; }
.speaker-6 { background: #3f1a4a; color: #bb8fce; border-color: #bb8fce; }
.speaker-7 { background: #4a3a1a; color: #f0b27a; border-color: #f0b27a; }

/* Utilities */
.hidden {
  display: none;
}

/* Scrollbar */
.transcript::-webkit-scrollbar {
  width: 6px;
}

.transcript::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.transcript::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.transcript::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .config-section {
    padding: 1rem;
  }

  .header-row {
    flex-direction: column;
    gap: 0.3rem;
  }
}
