@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Light theme */
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --text-muted: #bdc3c7;
  --accent: #3498db;
  --accent-hover: #2980b9;
  --success: #27ae60;
  --error: #e74c3c;
  --warning: #f39c12;
  
  /* Neumorphic shadows */
  --shadow-light: #ffffff;
  --shadow-dark: #d1d9e6;
  --shadow-inset-light: inset 5px 5px 10px var(--shadow-dark);
  --shadow-inset-dark: inset -5px -5px 10px var(--shadow-light);
  --shadow-outset: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  --shadow-pressed: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  
  /* Animations */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #2c3e50;
  --bg-secondary: #34495e;
  --text-primary: #ecf0f1;
  --text-secondary: #bdc3c7;
  --text-muted: #7f8c8d;
  --accent: #3498db;
  --accent-hover: #5dade2;
  --success: #2ecc71;
  --error: #e74c3c;
  --warning: #f39c12;
  
  --shadow-light: #3d5368;
  --shadow-dark: #1e2833;
  --shadow-inset-light: inset 5px 5px 10px var(--shadow-dark);
  --shadow-inset-dark: inset -5px -5px 10px var(--shadow-light);
  --shadow-outset: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  --shadow-pressed: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: var(--transition);
}

.container {
  background: var(--bg-primary);
  border-radius: 32px;
  padding: 48px;
  max-width: 640px;
  width: 100%;
  box-shadow: var(--shadow-outset);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-primary);
  box-shadow: var(--shadow-outset);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: translateY(-2px);
}

.theme-toggle:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(0);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
  transition: var(--transition);
}

h1 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 48px;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.status {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  min-height: 24px;
  letter-spacing: -0.01em;
}

.recording-area {
  margin: 48px 0;
}

.record-button {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-outset);
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.record-button:hover {
  transform: translateY(-4px);
}

.record-button:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(0);
}

.record-button.recording {
  animation: recordPulse 2s infinite ease-in-out;
}

.record-button svg {
  width: 32px;
  height: 32px;
  fill: var(--accent);
  transition: var(--transition);
}

.record-button.recording svg {
  fill: var(--error);
}

@keyframes recordPulse {
  0%, 100% { 
    box-shadow: var(--shadow-outset), 0 0 0 0 rgba(231, 76, 60, 0.4); 
  }
  50% { 
    box-shadow: var(--shadow-outset), 0 0 0 20px rgba(231, 76, 60, 0); 
  }
}

.button-text {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.waveform {
  height: 80px;
  margin: 32px 0;
  background: var(--bg-primary);
  border-radius: 20px;
  box-shadow: var(--shadow-inset-light), var(--shadow-inset-dark);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px;
}

.waveform.active {
  display: flex;
}

.waveform-bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 0.8s infinite ease-in-out;
  opacity: 0.8;
}

.waveform-bar:nth-child(1) { animation-delay: 0s; height: 16px; }
.waveform-bar:nth-child(2) { animation-delay: 0.1s; height: 28px; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; height: 40px; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; height: 32px; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; height: 20px; }
.waveform-bar:nth-child(6) { animation-delay: 0.3s; height: 28px; }
.waveform-bar:nth-child(7) { animation-delay: 0.2s; height: 36px; }
.waveform-bar:nth-child(8) { animation-delay: 0.1s; height: 24px; }
.waveform-bar:nth-child(9) { animation-delay: 0s; height: 16px; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); opacity: 0.8; }
  50% { transform: scaleY(1.8); opacity: 1; }
}

.timer {
  font-size: 28px;
  color: var(--text-primary);
  font-weight: 600;
  margin: 24px 0;
  font-variant-numeric: tabular-nums;
  display: none;
  letter-spacing: -0.02em;
}

.timer.active {
  display: block;
}

.transcription-area {
  margin: 40px 0;
  text-align: left;
}

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

.transcription-header h2 {
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.copy-button {
  padding: 12px 20px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-outset);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.copy-button:hover {
  transform: translateY(-2px);
}

.copy-button:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(0);
}

.copy-button svg {
  width: 18px;
  height: 18px;
  fill: var(--text-secondary);
  flex-shrink: 0;
  stroke: var(--text-secondary);
  stroke-width: 1.5;
  fill: none;
}

.copy-button.copied {
  color: var(--success);
}

.copy-button.copied svg {
  stroke: var(--success);
}

.transcription-text {
  background: var(--bg-primary);
  border-radius: 20px;
  box-shadow: var(--shadow-inset-light), var(--shadow-inset-dark);
  padding: 24px;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.transcription-text.empty {
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  box-shadow: var(--shadow-inset-light), var(--shadow-inset-dark);
  margin: 24px 0;
  overflow: hidden;
  display: none;
}

.progress-bar.active {
  display: block;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.settings {
  display: flex;
  justify-content: space-around;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--shadow-dark);
  gap: 32px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.setting-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.setting-select {
  padding: 12px 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-outset);
  min-width: 140px;
  letter-spacing: -0.01em;
}

.setting-select:hover {
  transform: translateY(-1px);
}

.setting-select:focus {
  outline: none;
  box-shadow: var(--shadow-pressed);
}

.error {
  background: var(--bg-primary);
  border: 2px solid var(--error);
  color: var(--error);
  padding: 20px;
  border-radius: 20px;
  margin: 24px 0;
  display: none;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-outset);
}

.error.active {
  display: block;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 32px 24px;
    margin: 10px;
  }
  
  h1 {
    font-size: 28px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .record-button {
    width: 100px;
    height: 100px;
  }
  
  .record-button svg {
    width: 28px;
    height: 28px;
  }
  
  .settings {
    flex-direction: column;
    gap: 20px;
  }
  
  .setting-select {
    min-width: 100%;
  }
}

/* Scrollbar styling */
.transcription-text::-webkit-scrollbar {
  width: 6px;
}

.transcription-text::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

.transcription-text::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

.transcription-text::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Focus styles for accessibility */
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Loading animation */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.status.loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid var(--text-muted);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}