/**
 * Ɉ Acoustic - Main Stylesheet
 * Clean, minimal design for acoustic group formation
 */

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --accent-blue: #4facfe;
  --accent-green: #00f2fe;
  --accent-gold: #f5af19;
  --accent-purple: #667eea;
  --error: #f44336;
  --success: #4caf50;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 2rem;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.version {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
}

/* Status Bar */
.status-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.status-indicator {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  flex: 1;
  text-align: center;
}

.status-connected { color: var(--success); }
.status-connecting { color: var(--accent-gold); }
.status-disconnected { color: var(--text-secondary); }
.status-error { color: var(--error); }

/* Error Display */
.error-display {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* Info Section */
.info-section {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.info-value {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  color: var(--accent-blue);
}

.info-accuracy {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.jay-code {
  color: var(--accent-gold);
  font-weight: 600;
}

.tone-display {
  width: 100%;
  text-align: center;
  padding: 0.5rem;
}

.tone-label {
  color: var(--text-secondary);
  margin-right: 0.5rem;
}

.tone-value {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 1.2rem;
  color: var(--accent-gold);
  background: rgba(245, 175, 25, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
}

/* Action Section */
.action-section {
  margin-bottom: 1.5rem;
}

.btn-primary {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-primary.active {
  background: linear-gradient(135deg, var(--error), #ff6b6b);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--accent-green));
}

/* Sections */
.section {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.section h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

/* Waveform Animation */
.waveform {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  height: 80px;
  margin: 1.5rem 0;
}

.wave {
  width: 60px;
  height: 60px;
  border: 2px solid var(--accent-blue);
  border-radius: 50%;
  opacity: 0;
}

.waveform.active .wave {
  animation: pulse 2s ease-out infinite;
}

.waveform.active .wave:nth-child(1) { animation-delay: 0s; }
.waveform.active .wave:nth-child(2) { animation-delay: 0.4s; }
.waveform.active .wave:nth-child(3) { animation-delay: 0.8s; }

@keyframes pulse {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Audio Level */
.audio-level {
  background: var(--bg-card);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  min-height: 60px;
}

.no-signal {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.peak-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.peak-freq {
  font-size: 0.7rem;
  color: var(--text-secondary);
  width: 60px;
  text-align: right;
}

.peak-level {
  height: 8px;
  background: var(--accent-blue);
  border-radius: 4px;
  transition: width 0.1s;
}

.peak-level.strong {
  background: var(--accent-green);
}

.peak-db {
  font-size: 0.7rem;
  color: var(--text-secondary);
  width: 40px;
}

.hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* Role Display */
.role-display {
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 1rem;
  font-weight: 600;
}

.badge.coordinator {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
}

.badge.member {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  color: white;
}

/* Members List */
.members-section {
  text-align: left;
  margin: 1rem 0;
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: 0.5rem;
  transition: transform 0.2s;
}

.member-card:hover {
  transform: translateX(4px);
}

.member-card.is-me {
  border: 1px solid var(--accent-blue);
}

.member-emoji {
  font-size: 1.5rem;
}

.member-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.member-name {
  font-weight: 500;
}

.badge-you {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--accent-blue);
  color: white;
  border-radius: 1rem;
}

.no-members {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

/* Debug Section */
.debug-section {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.debug-section summary {
  cursor: pointer;
  padding: 0.5rem;
}

.debug-content {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  font-family: 'SF Mono', Monaco, monospace;
}

/* Responsive */
@media (max-width: 360px) {
  #app {
    padding: 0.75rem;
  }
  
  .header h1 {
    font-size: 1.25rem;
  }
  
  .status-bar {
    flex-direction: column;
    gap: 0.5rem;
  }
}
