/* Sonic Advanced - CSS Styling */

:root {
  --primary: #6200ea;
  --primary-light: #9d46ff;
  --primary-dark: #0a00b6;
  --text: #ffffff;
  --background: black;
  --surface: #1e1e1e;
  --surface-light: #2a2a2a;
  --error: #cf6679;
  --success: #4caf50;
  --warning: #ffc107;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background);
  color: var(--text);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  box-shadow: 0 0px 10px rgb(167, 1, 244, 0.5);
  margin-top: 20px;
  border-radius: 10px;
}

header {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2rem 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
  color: var(--primary-light);
  text-align: center;
  font-size: 3rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.subtitle {
  text-align: center;
  color: var(--text);
  font-size: 1.3rem;
  margin-bottom: 0;
  padding: 0 2rem;
  opacity: 0.9;
}

/* Header Feature Badges */
.header-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(45deg, var(--primary), var(--primary-dark));
  padding: 0.75rem 1.25rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2);
  transition: all 0.3s ease;
  white-space: nowrap;
  min-width: 180px;
}

.feature-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 0px 20px rgba(255, 255, 255, 0.4), 0 0px 30px rgba(157, 70, 255, 0.3), inset 0 0 25px rgba(0, 0, 0, 0.2);
}

/* Mode Section */
.mode-section {
  background: linear-gradient(135deg, #0a0a0a 0%, #2a0a2a 20%, #3d1a4f 40%, #1a0a3d 60%, #4f1a3d 80%, #0a0a0a 100%);
  padding: 2rem;
  margin-bottom: 2rem;
  border-radius: 12px;
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(157, 70, 255, 0.3);
  width: 90%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.mode-toggle {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.mode-btn {
  background: linear-gradient(135deg, rgba(157, 70, 255, 0.1), rgba(74, 20, 140, 0.1));
  border: 2px solid rgba(157, 70, 255, 0.3);
  color: var(--text);
  padding: 1rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary-dark) 100%);
  border-color: var(--primary-light);
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2);
}

.mode-btn:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 50%, var(--primary-dark) 100%);
  transform: translateY(-2px);
}

.mode-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  margin: 0;
  font-style: italic;
}

/* Generation Form */
.generation-section {
  background: linear-gradient(135deg, #0a0a0a 0%, #2a0a2a 20%, #3d1a4f 40%, #1a0a3d 60%, #4f1a3d 80%, #0a0a0a 100%);
  padding: 2.5rem;
  margin-bottom: 2rem;
  border-radius: 12px;
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(157, 70, 255, 0.3);
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.mode-fields {
  transition: all 0.3s ease;
}

.option-group {
  margin-bottom: 2rem;
}

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

.option-group label i {
  color: var(--primary);
  width: 20px;
  text-align: center;
}

.char-counter {
  margin-left: auto;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: normal;
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.error {
  color: var(--error);
}

/* AI Lyrics Button */
.ai-lyrics-btn {
  background: linear-gradient(45deg, #ff6b35, #f7931e);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.ai-lyrics-btn:hover {
  background: linear-gradient(45deg, #f7931e, #ff6b35);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.ai-lyrics-btn:disabled {
  background: linear-gradient(45deg, #666, #555);
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

/* AI Thinking Indicator */
#aiThinking {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #0a0a0a 0%, #2a0a2a 20%, #3d1a4f 40%, #1a0a3d 60%, #4f1a3d 80%, #0a0a0a 100%);
  color: var(--primary-light);
  padding: 2rem 3rem;
  border-radius: 15px;
  border: 2px solid var(--primary-light);
  box-shadow: 
    0 0px 30px rgba(255, 255, 255, 0.4), 
    0 0px 50px rgba(157, 70, 255, 0.3), 
    inset 0 0 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  z-index: 3000;
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  animation: thinking-pulse 1.5s ease-in-out infinite;
}

@keyframes thinking-pulse {
  0%, 100% { 
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  50% { 
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
  }
}

.option-group input,
.option-group select,
.option-group textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(157, 70, 255, 0.3);
  color: var(--text);
  padding: 1rem;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

.option-group input:focus,
.option-group select:focus,
.option-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(157, 70, 255, 0.2);
}

.option-group textarea {
  resize: vertical;
  min-height: 60px;
}

.option-description {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.4;
}

/* Checkbox Styling */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(157, 70, 255, 0.2);
  transition: all 0.3s ease;
}

.checkbox-label:hover {
  background: rgba(157, 70, 255, 0.1);
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 0;
  height: 0;
}

.checkmark {
  height: 20px;
  width: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(157, 70, 255, 0.5);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.checkbox-label input:checked ~ .checkmark {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.checkbox-label input:checked ~ .checkmark::after {
  content: "✓";
  color: white;
  font-weight: bold;
  font-size: 14px;
}

/* Advanced Parameters */
.advanced-parameters {
  margin-top: 2rem;
  border-top: 1px solid rgba(157, 70, 255, 0.2);
  padding-top: 2rem;
}

.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: linear-gradient(45deg, rgba(157, 70, 255, 0.1), rgba(74, 20, 140, 0.1));
  border: 2px solid var(--primary-light);
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.advanced-toggle:hover {
  background: linear-gradient(45deg, rgba(157, 70, 255, 0.2), rgba(74, 20, 140, 0.2));
  transform: translateY(-1px);
}

.advanced-options {
  margin-top: 1rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(157, 70, 255, 0.1);
  border-radius: 8px;
  animation: slideDown 0.3s ease;
}

/* Range Sliders */
input[type="range"] {
  width: 100%;
  height: 8px;
  background: rgba(157, 70, 255, 0.3);
  outline: none;
  border-radius: 4px;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-light);
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-light);
  cursor: pointer;
  border-radius: 50%;
  border: none;
}

/* Generate Button */
.generate-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary-dark) 100%);
  color: var(--text);
  border: 2px solid rgba(157, 70, 255, 0.3);
  border-radius: 12px;
  padding: 1.5rem 3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.3rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.generate-btn:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 50%, var(--primary-dark) 100%);
  transform: translateY(-2px);
  box-shadow: 0 0px 20px rgba(255, 255, 255, 0.4), 0 0px 30px rgba(157, 70, 255, 0.3), inset 0 0 25px rgba(0, 0, 0, 0.2);
}

.generate-btn:disabled {
  background: linear-gradient(135deg, #555 0%, #444 50%, #333 100%);
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

/* Loading Section */
.loading {
  background: linear-gradient(135deg, #0a0a0a 0%, #2a0a2a 20%, #3d1a4f 40%, #1a0a3d 60%, #4f1a3d 80%, #0a0a0a 100%);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem auto;
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(157, 70, 255, 0.3);
  width: 90%;
  text-align: center;
}

.loading-content {
  max-width: 600px;
  margin: 0 auto;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(157, 70, 255, 0.3);
  border-top: 5px solid var(--primary-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem auto;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.generation-tips {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(157, 70, 255, 0.2);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
  text-align: left;
}

.generation-tips h4 {
  color: var(--primary-light);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.generation-tips ul {
  list-style: none;
  padding: 0;
}

.generation-tips li {
  padding: 0.5rem 0;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.generation-tips li:last-child {
  border-bottom: none;
}

/* Results Section */
.results-section {
  background: linear-gradient(135deg, #0a0a0a 0%, #2a0a2a 20%, #3d1a4f 40%, #1a0a3d 60%, #4f1a3d 80%, #0a0a0a 100%);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: 0 0px 15px rgba(255, 255, 255, 0.3), 0 0px 25px rgba(157, 70, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(157, 70, 255, 0.3);
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

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

.results-info {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-badge.success {
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid #4caf50;
  color: #4caf50;
}

.result-badge.info {
  background: rgba(33, 150, 243, 0.2);
  border: 1px solid #2196f3;
  color: #2196f3;
}

/* Music Results */
.music-results {
  margin-bottom: 2rem;
}

.music-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(157, 70, 255, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

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

.music-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary-light);
}

.music-status {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.music-status.completed {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
  border: 1px solid #4caf50;
}

.music-player {
  width: 100%;
  margin: 1rem 0;
}

.music-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.music-btn {
  background: linear-gradient(45deg, var(--primary), var(--primary-light));
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.music-btn:hover {
  background: linear-gradient(45deg, var(--primary-light), var(--primary));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(157, 70, 255, 0.4);
}

/* Stems Section */
.stems-section {
  border-top: 1px solid rgba(157, 70, 255, 0.2);
  padding-top: 2rem;
}

.stems-section h3 {
  color: var(--primary-light);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.stems-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stems-btn {
  background: linear-gradient(135deg, rgba(157, 70, 255, 0.1), rgba(74, 20, 140, 0.1));
  border: 2px solid rgba(157, 70, 255, 0.3);
  color: var(--text);
  padding: 1.5rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.stems-btn:hover {
  background: linear-gradient(135deg, rgba(157, 70, 255, 0.2), rgba(74, 20, 140, 0.2));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(157, 70, 255, 0.3);
}

.stems-btn i {
  font-size: 2rem;
  color: var(--primary-light);
}

.stems-btn small {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: normal;
}

/* Error and Success Messages */
.error-message {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid #f44336;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin: 1rem auto;
  color: #ff5252;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 90%;
}

.error-message::before {
  content: "⚠️";
  font-size: 1.2rem;
  margin-top: 0.1rem;
}

.success-message {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid #4caf50;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin: 1rem auto;
  color: #66bb6a;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 90%;
}

.success-message::before {
  content: "✅";
  font-size: 1.2rem;
  margin-top: 0.1rem;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .header-info {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0 1rem;
    margin: 1rem;
  }
  
  .feature-badge {
    font-size: 0.8rem;
    padding: 0.6rem 0.8rem;
    min-width: unset;
  }
  
  .subtitle {
    font-size: 1rem;
    padding: 0 1rem;
  }
  
  .container {
    padding: 1rem;
  }
  
  .mode-toggle {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .mode-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
  
  .generation-section,
  .mode-section,
  .results-section {
    width: 95%;
    padding: 1.5rem;
  }
  
  .stems-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .stems-btn {
    padding: 1.25rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .stems-btn i {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .header-info {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0 1.5rem;
    margin: 0.5rem;
  }
  
  .feature-badge {
    font-size: 0.7rem;
    padding: 0.5rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
    padding: 0 1.5rem;
  }
  
  .container {
    padding: 0.5rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .stems-options {
    grid-template-columns: 1fr;
  }
  
  .option-group input,
  .option-group select,
  .option-group textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .generate-btn {
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
  }
  
  .ai-lyrics-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }
  
  #aiThinking {
    padding: 1.5rem 2rem;
    font-size: 1.1rem;
  }
  
  .option-group label {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .char-counter {
    margin-left: 0;
    align-self: flex-end;
  }
  
  .ai-lyrics-btn {
    align-self: flex-end;
    margin-left: 0;
  }
}
