@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-bg: #0a0e27;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(79, 172, 254, 0.05) 0%, transparent 50%);
  z-index: -1;
  animation: backgroundShift 15s ease infinite;
}

@keyframes backgroundShift {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

/* Header */
.header {
  text-align: center;
  padding: var(--spacing-xl) 0;
  margin-bottom: var(--spacing-lg);
}

.header h1 {
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-sm);
  animation: fadeInDown 0.8s ease;
}

.header p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 300;
  animation: fadeInUp 0.8s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: var(--spacing-lg);
  animation: fadeIn 1s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.glass-card:hover {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-2px);
}

/* Voice Selection Panel */
.voice-panel {
  position: sticky;
  top: var(--spacing-lg);
  max-height: calc(100vh - 2 * var(--spacing-lg));
  overflow-y: auto;
}

.voice-panel::-webkit-scrollbar {
  width: 6px;
}

.voice-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.voice-panel::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: 10px;
}

.panel-header {
  margin-bottom: var(--spacing-md);
}

.panel-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.panel-header h2::before {
  content: '🎤';
  font-size: 1.75rem;
}

/* Filter Buttons */
.filter-group {
  margin-bottom: var(--spacing-md);
}

.filter-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-buttons {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--primary-gradient);
  transition: width 0.4s ease, height 0.4s ease;
  transform: translate(-50%, -50%);
  z-index: -1;
}

.filter-btn:hover::before,
.filter-btn.active::before {
  width: 200%;
  height: 200%;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--text-primary);
  border-color: transparent;
  transform: translateY(-2px);
}

/* Voice Cards */
.voice-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.voice-card {
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.voice-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  padding: 2px;
  background: var(--primary-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.voice-card:hover::before,
.voice-card.selected::before {
  opacity: 1;
}

.voice-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(5px);
}

.voice-card.selected {
  background: rgba(102, 126, 234, 0.15);
}

.voice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
}

.voice-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.voice-badge {
  padding: 0.25rem 0.75rem;
  background: var(--primary-gradient);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.voice-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-xs);
}

.preview-btn {
  width: 100%;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
}

.preview-btn:hover {
  background: var(--accent-gradient);
  color: var(--text-primary);
  border-color: transparent;
}

.preview-btn.playing {
  background: var(--success);
  border-color: transparent;
}

/* Text Input Area */
.text-area-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.textarea-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.textarea-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.char-counter {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.text-input {
  width: 100%;
  min-height: 300px;
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  line-height: 1.8;
  resize: vertical;
  transition: all 0.3s ease;
}

.text-input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.text-input::placeholder {
  color: var(--text-muted);
}

/* Emotion Tags */
.emotion-tags {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.emotion-tag {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.emotion-tag:hover,
.emotion-tag.active {
  background: var(--secondary-gradient);
  border-color: transparent;
  color: var(--text-primary);
  transform: scale(1.05);
}

/* Controls */
.controls {
  display: flex;
  gap: var(--spacing-md);
}

.btn {
  flex: 1;
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.6);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn-success {
  background: var(--success);
  color: var(--text-primary);
}

.btn-success:hover {
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

/* Audio Player */
.audio-player {
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.player-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
  margin-bottom: var(--spacing-md);
}

.wave-bar {
  width: 4px;
  background: var(--primary-gradient);
  border-radius: 4px;
  animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 50px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 40px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 30px; animation-delay: 0.4s; }
.wave-bar:nth-child(6) { height: 45px; animation-delay: 0.5s; }
.wave-bar:nth-child(7) { height: 35px; animation-delay: 0.6s; }
.wave-bar:nth-child(8) { height: 25px; animation-delay: 0.7s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

.player-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.play-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-gradient);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.6);
}

/* Responsive */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .voice-panel {
    position: static;
    max-height: none;
  }
  
  .header h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 640px) {
  .header h1 {
    font-size: 2rem;
  }
  
  .controls {
    flex-direction: column;
  }
  
  .filter-buttons {
    flex-direction: column;
  }
  
  .container {
    padding: var(--spacing-sm);
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hide class */
.hidden {
  display: none;
}
