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

:root {
  --primary: #FF6B35;
  --secondary: #004E89;
  --accent: #F7931E;
  --success: #06A77D;
  --danger: #D62839;
  --warning: #FF9500;
  --bg: #0F1419;
  --surface: #1A1F2E;
  --border: #2D3748;
  --text: #E8EAF6;
  --text-secondary: #B0BEC5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--bg) 0%, #1a1f2e 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px 0;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.section:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.1);
}

.section h2 {
  margin-bottom: 20px;
  font-size: 1.4rem;
  color: var(--text);
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.form-group input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.char-count {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: right;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #FF5722;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #003A70;
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover:not(:disabled) {
  background: #E67E0E;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #049070;
}

.btn-danger {
  background: var(--danger);
  color: white;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn-danger:hover:not(:disabled) {
  background: #BB1F32;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
  width: 100%;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-top: 8px;
}

.device-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.device-info {
  background: var(--bg);
  border-left: 4px solid var(--success);
  padding: 12px;
  border-radius: 6px;
}

.device-details {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.status {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.status.connected {
  background: rgba(6, 168, 125, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.status.disconnected {
  background: rgba(214, 40, 57, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.songs-list {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.song-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.song-entry:last-child {
  margin-bottom: 0;
}

.file-input-wrapper {
  position: relative;
  margin-bottom: 16px;
}

#wavFile {
  display: none;
}

.file-label {
  display: block;
  padding: 20px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}

.file-label:hover {
  border-color: var(--primary);
  background: rgba(255, 107, 53, 0.05);
}

.file-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 8px;
}

.validation-message {
  margin-top: 12px;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.validation-success {
  background: rgba(6, 168, 125, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
  padding: 12px;
  border-radius: 6px;
}

.validation-error {
  background: rgba(214, 40, 57, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 12px;
  border-radius: 6px;
}

.file-info-display {
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid var(--primary);
  margin-bottom: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

#progressText {
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  font-size: 1.1rem;
}

.log-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  height: 250px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.log-entry {
  padding: 4px 0;
  color: var(--text-secondary);
}

.log-entry.log-info {
  color: var(--text-secondary);
}

.log-entry.log-success {
  color: var(--success);
}

.log-entry.log-error {
  color: var(--danger);
}

footer {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  margin-top: 40px;
}

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

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

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

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

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.8rem;
  }

  .section {
    padding: 16px;
  }

  .device-controls {
    flex-direction: column;
  }

  .device-controls button {
    width: 100%;
  }

  .btn-large {
    font-size: 1rem;
    padding: 12px 20px;
  }

  .songs-list {
    max-height: 400px;
  }

  .log-output {
    height: 200px;
  }
}
