/* CSS Custom Properties for Enhanced Theme Support */
:root {
  --primary-color: #667eea;
  --primary-dark: #5a67d8;
  --primary-light: #a0aec0;
  --secondary-color: #f093fb;
  --accent-color: #ffd89b;
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --error-color: #f56565;
  --bg-color: #f7fafc;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --surface-color: #ffffff;
  --surface-elevated: #ffffff;
  --text-color: #2d3748;
  --text-muted: #718096;
  --text-light: #a0aec0;
  --border-color: #e2e8f0;
  --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-heavy: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-accent: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
  --border-radius: 12px;
  --border-radius-large: 20px;
  --border-radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease-out;
  --animation-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-color: #1a202c;
  --bg-gradient: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  --surface-color: #2d3748;
  --surface-elevated: #4a5568;
  --text-color: #f7fafc;
  --text-muted: #a0aec0;
  --text-light: #718096;
  --border-color: #4a5568;
  --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-heavy: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  background: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  transition: var(--transition);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

#theme-btn {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

#theme-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition);
  z-index: -1;
}

#theme-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-large);
  border-color: var(--primary-color);
}

#theme-btn:hover::before {
  opacity: 0.1;
}

#theme-btn i {
  font-size: 1.2rem;
  color: var(--text-color);
  transition: var(--transition);
}

/* Enhanced Header */
header {
  text-align: center;
  padding: 3rem 1rem 2rem;
  background: var(--surface-color);
  box-shadow: var(--shadow-medium);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0.05;
  z-index: 0;
}

.header-content {
  position: relative;
  z-index: 1;
}

.logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo-section i {
  font-size: 3rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: float 3s ease-in-out infinite;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface-elevated);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-light);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.status-indicator:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success-color);
  animation: pulse 2s infinite;
  box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
}

.status-dot.connected {
  animation: pulse-success 2s infinite;
}

.status-dot.disconnected {
  background: var(--error-color);
  animation: pulse-error 2s infinite;
}

/* Main Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  position: relative;
}

/* Enhanced Learning Dashboard */
.learning-dashboard {
  background: var(--surface-color);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-large);
  margin-bottom: 2rem;
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.learning-dashboard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--gradient-primary);
  color: white;
  position: relative;
}

.dashboard-header h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
  color: white;
}

.dashboard-header i {
  margin-right: 0.5rem;
  opacity: 0.9;
}

#toggle-dashboard {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

#toggle-dashboard:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

#toggle-dashboard i {
  color: white;
  font-size: 1rem;
  margin: 0;
}

.dashboard-content {
  padding: 2rem;
}

.progress-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.progress-card {
  background: var(--surface-elevated);
  border-radius: var(--border-radius-large);
  padding: 1.5rem;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.progress-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: var(--transition);
}

.progress-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-large);
}

.progress-card:hover::before {
  transform: scaleX(1);
}

.progress-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.card-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  opacity: 0.1;
  z-index: 0;
}

.card-icon.grammar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-icon.pronunciation {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.card-icon.vocabulary {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.card-icon.fluency {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.card-icon i {
  position: relative;
  z-index: 1;
}

.card-content {
  flex: 1;
}

.card-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.score {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 1s ease-out;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2s infinite;
}

.learning-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.5rem;
  background: var(--bg-color);
  border-radius: var(--border-radius-large);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.stat-item i {
  color: var(--primary-color);
  font-size: 1.1rem;
}

/* Enhanced Learning Modes */
.learning-modes {
  background: var(--surface-color);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-large);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.learning-modes::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0.02;
  z-index: 0;
}

.learning-modes > * {
  position: relative;
  z-index: 1;
}

.learning-modes h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 2rem;
  text-align: center;
}

.learning-modes h3 i {
  margin-right: 0.75rem;
  color: var(--primary-color);
  font-size: 1.3rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.mode-card {
  background: var(--surface-elevated);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition);
  z-index: 0;
}

.mode-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-heavy);
  border-color: var(--primary-color);
}

.mode-card:hover::before {
  opacity: 0.05;
}

.mode-card:hover .mode-icon {
  transform: scale(1.1) rotate(5deg);
}

.mode-card:hover h4 {
  color: var(--primary-color);
}

.mode-card.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
  transform: translateY(-4px);
  box-shadow: var(--shadow-large);
}

.mode-card.active::before {
  opacity: 0.1;
}

.mode-card.active h4,
.mode-card.active p {
  color: white;
}

.mode-card.active .mode-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: scale(1.05);
}

.mode-card > * {
  position: relative;
  z-index: 1;
}

.mode-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--border-radius-large);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--gradient-primary);
  color: white;
  margin: 0 auto 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-medium);
}

.mode-card h4 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.mode-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  transition: var(--transition);
}

/* Enhanced Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: -450px;
  width: 450px;
  height: 100vh;
  background: var(--surface-color);
  box-shadow: var(--shadow-heavy);
  z-index: 999;
  transition: right 0.4s var(--animation-bounce);
  overflow-y: auto;
  padding: 0;
  border-left: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
}

.settings-panel.open {
  right: 0;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  background: var(--gradient-primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.settings-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  margin: 0;
}

.settings-header i {
  margin-right: 0.5rem;
  opacity: 0.9;
}

#close-settings {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

#close-settings:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1) rotate(90deg);
}

#close-settings i {
  color: white;
  font-size: 1.2rem;
  margin: 0;
}

.settings-panel .setting-group {
  margin: 0 2rem 2rem;
  padding: 1.5rem;
  background: var(--surface-elevated);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.settings-panel .setting-group:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.setting-group label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
}

.setting-group select {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 1rem;
  transition: var(--transition);
  cursor: pointer;
}

.setting-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.setting-group select:hover {
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-medium);
  position: relative;
  overflow: hidden;
}

.btn-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-large);
}

.btn-secondary:hover::before {
  left: 100%;
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-secondary i {
  margin-right: 0.5rem;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-success {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(72, 187, 120, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
  }
}

@keyframes pulse-error {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(245, 101, 101, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 101, 101, 0);
  }
}

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

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

.slide-in-up {
  animation: slideInUp 0.6s ease-out;
}

/* Enhanced Responsive Design */
@media (max-width: 1024px) {
  .settings-panel {
  width: 400px;
    right: -400px;
  }
  
  .mode-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  .progress-cards {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }
  
  header {
    padding: 2rem 1rem 1.5rem;
  }
  
  .settings-panel {
    width: 100vw;
    right: -100vw;
  }
  
  .learning-dashboard,
  .learning-modes {
    padding: 1.5rem;
  }
  
  .dashboard-content {
    padding: 1.5rem;
  }
  
  .progress-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .mode-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .learning-stats {
    gap: 1rem;
  }
  
  .stat-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .logo-section {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .logo-section i {
    font-size: 2.5rem;
  }
}

@media (max-width: 480px) {
  .theme-toggle {
    top: 15px;
    right: 15px;
  }
  
  #theme-btn {
    width: 45px;
    height: 45px;
  }
  
  .mode-card {
    padding: 1.5rem;
  }
  
  .mode-icon {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
  }
  
  .progress-card {
    padding: 1.25rem;
  }
  
  .card-icon {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }
  
  .score {
    font-size: 1.5rem;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles */
button:focus,
select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 60vh;
}

/* Feedback Panel */
.feedback-panel {
  background: var(--surface-color);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-medium);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: var(--transition);
}

.feedback-panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-large);
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--gradient-secondary);
  color: white;
}

.feedback-header h4 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  color: white;
}

.feedback-header i {
  margin-right: 0.5rem;
  opacity: 0.9;
}

#toggle-feedback {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

#toggle-feedback:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

#toggle-feedback i {
  color: white;
  font-size: 0.9rem;
  margin: 0;
}

.feedback-content {
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
}

.feedback-item {
  background: var(--surface-elevated);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.feedback-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-light);
}

.feedback-item h5 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedback-item h5 i {
  color: var(--primary-color);
}

.feedback-item div {
  color: var(--text-muted);
  line-height: 1.5;
}

/* Chat History */
.chat-history {
  background: var(--surface-color);
  border-radius: var(--border-radius-large);
  padding: 1.5rem;
  box-shadow: var(--shadow-light);
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}

.welcome-message {
  margin-bottom: 2rem;
}

.message {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: slideInUp 0.3s ease;
}

.message:last-child {
  margin-bottom: 0;
}

.message-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-light);
}

.user-message .message-avatar {
  background: var(--gradient-primary);
  color: white;
}

.tutor-message .message-avatar {
  background: var(--gradient-secondary);
  color: white;
}

.message-content {
  flex: 1;
  background: var(--surface-elevated);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  position: relative;
  line-height: 1.6;
}

.user-message .message-content {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  opacity: 0.8;
}

/* Current Conversation */
.current-conversation {
  background: var(--surface-color);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow-light);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.current-conversation:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.conversation-item {
  margin-bottom: 1.5rem;
}

.conversation-item:last-child {
  margin-bottom: 0;
}

.label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.label i {
  font-size: 1rem;
}

.output-you, .output-bot {
  display: block;
  padding: 1.25rem;
  background: var(--surface-elevated);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  font-style: normal;
  min-height: 3rem;
  line-height: 1.6;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.output-you:hover, .output-bot:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-light);
}

/* Enhanced Voice Controls */
.voice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 3rem;
  background: linear-gradient(135deg, rgba(57, 194, 201, 0.05) 0%, rgba(102, 126, 234, 0.05) 100%);
  border-radius: var(--border-radius-xl);
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.voice-controls::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(57, 194, 201, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.voice-controls > * {
  position: relative;
  z-index: 1;
}

/* Enhanced Microphone Button */
.mic-button {
  position: relative;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  border: none;
  border-radius: 50%;
  width: 140px;
  height: 140px;
  color: white;
  font-size: 3.5rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 25px 50px rgba(102, 126, 234, 0.4),
    0 15px 30px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    0 0 0 0 rgba(102, 126, 234, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  overflow: hidden;
  transform: scale(1);
  animation: subtlePulse 4s ease-in-out infinite;
}

.mic-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 60%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 50%;
}

.mic-button::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.6), rgba(118, 75, 162, 0.6));
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: blur(8px);
}

.mic-button:hover {
  transform: scale(1.08) translateY(-8px);
  box-shadow: 
    0 35px 70px rgba(102, 126, 234, 0.5),
    0 20px 40px rgba(0, 0, 0, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 0 40px rgba(102, 126, 234, 0.3);
  animation: none;
}

.mic-button:hover::before {
  opacity: 1;
}

.mic-button:hover::after {
  opacity: 1;
}

.mic-button:active {
  transform: scale(1.02) translateY(-4px);
  transition: all 0.1s ease;
}

.mic-button.recording {
  animation: recordingPulse 2s ease-in-out infinite;
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  box-shadow: 
    0 0 0 0 rgba(255, 107, 107, 0.7),
    0 25px 50px rgba(255, 107, 107, 0.5),
    0 15px 30px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.mic-button.recording::after {
  content: '';
  position: absolute;
  top: -25px;
  left: -25px;
  right: -25px;
  bottom: -25px;
  border: 4px solid rgba(255, 107, 107, 0.4);
  border-radius: 50%;
  animation: pulseRing 2s infinite;
  z-index: -1;
}

.mic-button i {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
  transition: all 0.3s ease;
}

.mic-button:hover i {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* Enhanced Control Buttons */
.control-buttons {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surface-elevated);
  padding: 2rem;
  border-radius: var(--border-radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.control-buttons::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(118, 75, 162, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.control-buttons > * {
  position: relative;
  z-index: 1;
}

.control-btn {
  width: 70px;
  height: 70px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surface-elevated);
  color: var(--text-color);
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.control-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 0;
  border-radius: 50%;
}

.control-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  border-radius: 50%;
  z-index: 1;
}

.control-btn:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 
    0 15px 35px rgba(57, 194, 201, 0.3),
    0 8px 15px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.control-btn:hover::before {
  opacity: 0.1;
}

.control-btn:hover::after {
  width: 80px;
  height: 80px;
}

.control-btn:active {
  transform: translateY(-1px) scale(1.02);
  transition: all 0.1s ease;
}

.control-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 
    0 12px 30px rgba(57, 194, 201, 0.4),
    0 6px 12px rgba(0, 0, 0, 0.1);
}

.control-btn.active::before {
  opacity: 1;
}

.control-btn i {
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.control-btn:hover i {
  transform: scale(1.1);
}

/* Specific button styling */
#settings-btn {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(102, 126, 234, 0.05) 100%);
}

#settings-btn:hover {
  border-color: #667EEA;
  color: #667EEA;
  box-shadow: 
    0 15px 35px rgba(102, 126, 234, 0.3),
    0 8px 15px rgba(0, 0, 0, 0.1);
}

#mute-btn {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
}

#mute-btn:hover {
  border-color: #FF9800;
  color: #FF9800;
  box-shadow: 
    0 15px 35px rgba(255, 152, 0, 0.3),
    0 8px 15px rgba(0, 0, 0, 0.1);
}

#stop-btn {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(244, 67, 54, 0.05) 100%);
}

#stop-btn:hover {
  border-color: #F44336;
  color: #F44336;
  box-shadow: 
    0 15px 35px rgba(244, 67, 54, 0.3),
    0 8px 15px rgba(0, 0, 0, 0.1);
}

#feedback-btn {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
}

#feedback-btn:hover {
  border-color: #4CAF50;
  color: #4CAF50;
  box-shadow: 
    0 15px 35px rgba(76, 175, 80, 0.3),
    0 8px 15px rgba(0, 0, 0, 0.1);
}

/* Enhanced Diagnostic Button */
.diagnostic-btn {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  border: none;
  color: white;
  padding: 15px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 10px 25px rgba(255, 107, 107, 0.3),
    0 5px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagnostic-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.diagnostic-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 15px 35px rgba(255, 107, 107, 0.4),
    0 8px 15px rgba(0, 0, 0, 0.1);
}

.diagnostic-btn:hover::before {
  left: 100%;
}

.diagnostic-btn:active {
  transform: translateY(-1px) scale(1.02);
}

/* Enhanced Session Timer */
.session-timer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%),
    var(--surface-elevated);
  border-radius: var(--border-radius-large);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 10px 25px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-weight: 600;
  color: var(--text-color);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.session-timer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(57, 194, 201, 0.05) 0%, rgba(102, 126, 234, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.session-timer:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.session-timer:hover::before {
  opacity: 1;
}

.session-timer i {
  color: var(--primary-color);
  font-size: 1.2rem;
  position: relative;
  z-index: 1;
}

.session-timer span {
  position: relative;
  z-index: 1;
}

/* Enhanced Animations */
@keyframes recordingPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 
      0 0 0 0 rgba(255, 107, 107, 0.7),
      0 25px 50px rgba(255, 107, 107, 0.5);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 
      0 0 0 25px rgba(255, 107, 107, 0),
      0 30px 60px rgba(255, 107, 107, 0.6);
  }
}

@keyframes pulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 
      0 25px 50px rgba(102, 126, 234, 0.4),
      0 15px 30px rgba(0, 0, 0, 0.1),
      inset 0 2px 0 rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow: 
      0 30px 60px rgba(102, 126, 234, 0.5),
      0 20px 40px rgba(0, 0, 0, 0.15),
      inset 0 2px 0 rgba(255, 255, 255, 0.4);
  }
}

/* Button Group Styling */
.control-buttons {
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: var(--border-radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 
    0 10px 25px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .voice-controls {
    padding: 2rem 1rem;
    gap: 1.5rem;
  }
  
  .mic-button {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
  }
  
  .control-buttons {
    gap: 1rem;
    padding: 1rem;
  }
  
  .control-btn {
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
  }
  
  .diagnostic-btn {
    width: 60px;
    height: 60px;
    font-size: 16px;
  }
  
  .session-timer {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .mic-button {
    width: 90px;
    height: 90px;
    font-size: 2.2rem;
  }
  
  .control-btn {
    width: 55px;
    height: 55px;
    font-size: 1.3rem;
  }
  
  .diagnostic-btn {
    width: 55px;
    height: 55px;
    font-size: 15px;
  }
  
  .voice-controls {
    padding: 1.5rem 0.5rem;
  }
  
  .control-buttons {
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  
  .session-timer {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Dark theme adjustments */
[data-theme="dark"] .voice-controls {
  background: linear-gradient(135deg, rgba(57, 194, 201, 0.08) 0%, rgba(102, 126, 234, 0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .control-btn {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--surface-elevated);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .session-timer {
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--surface-elevated);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .control-buttons {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.05);
}
