/* ==========================================================================
   STS Translate: Modern Glassmorphic Dark UI (macOS Aesthetic)
   ========================================================================== */

:root {
  --bg-primary: #0a0c10;
  --bg-secondary: #12161f;
  --bg-surface: rgba(22, 27, 38, 0.75);
  --bg-surface-hover: rgba(30, 38, 54, 0.85);
  --bg-input: rgba(13, 17, 23, 0.9);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --border-active: rgba(56, 189, 248, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-purple: #c084fc;

  --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
}

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

body {
  font-family: var(--font-stack);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(192, 132, 252, 0.07) 0%, transparent 45%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 1100px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 36px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(192, 132, 252, 0.2));
  border: 1px solid var(--border-subtle);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

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

.status-idle .status-dot { background: var(--text-muted); }
.status-connecting .status-dot {
  background: var(--accent-amber);
  animation: pulse-dot 1s infinite alternate;
}
.status-active .status-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse-dot 0.8s infinite alternate;
}
.status-error .status-dot { background: var(--accent-rose); }

@keyframes pulse-dot {
  from { opacity: 0.4; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.15); }
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card.full-width {
  grid-column: 1 / -1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  font-size: 20px;
}

.card-title h2 {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.flex-1 {
  flex: 1;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.label-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 18px;
  padding-right: 32px;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--border-active);
}

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

.form-control.textarea {
  background-image: none;
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
  padding-right: 14px;
}

.device-meta {
  font-size: 11px;
  color: var(--accent-cyan);
  margin-top: 2px;
}

/* Language Selection Row */
.language-selection-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.btn-swap {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.2s ease;
}

.btn-swap:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  transform: rotate(180deg);
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #7dd3fc;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Control Banner & CoreAudio Control Zone */
.control-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 20px;
}

.coreaudio-control-zone {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.action-row {
  display: flex;
  width: 100%;
}

.action-zone {
  display: flex;
  align-items: center;
  gap: 24px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.btn-full {
  width: 100%;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

.btn-primary.btn-active {
  background: linear-gradient(135deg, #e11d48, #be123c);
  box-shadow: 0 4px 18px rgba(225, 29, 72, 0.45);
}

.btn-primary.btn-active:hover {
  background: linear-gradient(135deg, #be123c, #9f1239);
}

/* VU Meter */
.meter-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.meter-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.vu-meter {
  width: 100%;
  height: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.vu-meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #10b981, #f59e0b 80%, #ef4444 100%);
  border-radius: 9999px;
  transition: width 0.08s ease-out;
}

.session-info {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.info-tag {
  flex: 1 1 calc(50% - 8px);
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.tag-label {
  color: var(--text-muted);
}

.tag-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Transcript Feed */
.transcript-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transcript-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transcript-title h3 {
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.pulse-indicator.active {
  background: var(--accent-emerald);
  animation: pulse-dot 1s infinite alternate;
}

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

.btn-small {
  padding: 5px 12px;
  font-size: 11px;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.transcript-feed {
  background: #080b11;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  font-family: var(--font-stack);
  font-size: 14px;
  line-height: 1.7;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
  margin: auto;
  text-align: center;
  max-width: 440px;
}

.transcript-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.25s ease-out;
}

.transcript-meta {
  font-size: 11px;
  color: var(--accent-purple);
  font-weight: 600;
}

.user-entry .user-meta {
  color: var(--accent-cyan);
}

.user-entry .user-text {
  color: #94a3b8;
  font-style: italic;
}

.transcript-text {
  font-size: 15px;
  color: #f8fafc;
}

.transcript-interrupted {
  color: var(--accent-amber);
  font-size: 12px;
  font-style: italic;
  border-left: 2px solid var(--accent-amber);
  padding-left: 8px;
  margin: 4px 0;
}

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

/* Footer */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.key-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 500;
}

.key-badge.missing {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

/* Responsive */
@media (max-width: 840px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .control-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}
