/* 
 * IVR Flow & Voice Studio - Premium Light Theme Workspace
 * Light Glassmorphism and Layout System
 * Note: Google Fonts loaded non-blocking via <link> in index.php head
 */
/* System font fallback while Google Fonts loads */

/* --- Light Theme Design Tokens --- */
:root {
  --bg-base: hsl(210, 25%, 96%);
  --bg-panel: hsla(210, 20%, 99%, 0.8);
  --bg-surface: hsla(0, 0%, 100%, 0.7);
  --bg-surface-hover: hsla(0, 0%, 100%, 0.95);
  --bg-input: hsl(0, 0%, 100%);
  
  --border-color: hsla(220, 15%, 85%, 0.9);
  --border-active: hsla(190, 100%, 40%, 0.5);
  --border-pulse: hsla(270, 90%, 60%, 0.5);
  
  --accent-cyan: hsl(190, 100%, 38%);
  --accent-cyan-glow: hsla(190, 100%, 38%, 0.12);
  --accent-purple: hsl(270, 85%, 55%);
  --accent-purple-glow: hsla(270, 85%, 55%, 0.12);
  --accent-green: hsl(142, 76%, 36%);
  --accent-red: hsl(355, 78%, 45%);
  
  --text-primary: hsl(224, 25%, 12%);
  --text-secondary: hsl(220, 15%, 32%);
  --text-muted: hsl(218, 10%, 52%);
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  --gradient-primary: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  --gradient-status: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
  
  --shadow-lg: 0 10px 30px -8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-glow-cyan: 0 0 20px hsla(190, 100%, 38%, 0.08);
  --shadow-glow-purple: 0 0 20px hsla(270, 85%, 55%, 0.08);
  
  --backdrop-blur: blur(25px);
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
}

/* --- Base & Scrollbar --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* Ambient glow */
body::before {
  content: '';
  position: absolute;
  top: -10vh;
  left: 20vw;
  width: 65vw;
  height: 60vh;
  background: radial-gradient(circle, hsla(190, 100%, 38%, 0.04) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsla(220, 15%, 80%, 0.8);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --- Buttons & Inputs --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: hsl(0, 0%, 100%);
  box-shadow: 0 4px 15px hsla(190, 100%, 38%, 0.15);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px hsla(190, 100%, 38%, 0.25);
  filter: brightness(1.05);
  color: hsl(0, 0%, 100%);
}

.btn-danger {
  background: var(--accent-red);
  color: hsl(0, 0%, 100%);
  border: none;
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
  color: hsl(0, 0%, 100%);
  border-color: transparent;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

/* --- Application Header --- */
.app-header {
  height: 65px;
  background: var(--bg-panel);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.app-logo svg {
  width: 28px;
  height: 28px;
  fill: var(--accent-cyan);
}

.app-logo span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Main Workspace Layout --- */
.app-workspace {
  flex-grow: 1;
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100% - 65px);
  overflow: hidden;
}

.workspace-panel {
  background: var(--bg-panel);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.workspace-panel.right-panel {
  display: none;
}

.panel-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: hsla(210, 20%, 98%, 0.5);
}

.panel-header h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.panel-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* --- Left Panel: Speaker Voices --- */
.voice-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1rem;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.voice-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-surface-hover);
  box-shadow: var(--shadow-glow-cyan);
}

.voice-card.playing {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}

.voice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.voice-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.voice-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  background: hsla(190, 100%, 38%, 0.08);
  color: var(--accent-cyan);
  border: 1px solid hsla(190, 100%, 38%, 0.15);
}

.voice-badge.female {
  background: hsla(270, 90%, 60%, 0.08);
  color: var(--accent-purple);
  border-color: hsla(270, 90%, 60%, 0.15);
}

.voice-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.voice-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.voice-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.voice-controls input[type=range] {
  -webkit-appearance: none;
  background: var(--border-color);
  height: 4px;
  border-radius: 2px;
  outline: none;
}

.voice-controls input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-secondary);
  cursor: pointer;
}

.voice-test-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Waveform Animation */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
  flex-grow: 1;
  background: var(--bg-input);
  border-radius: var(--border-radius-sm);
  padding: 0 0.5rem;
  border: 1px solid var(--border-color);
  opacity: 0.4;
}

.waveform.active {
  opacity: 1;
  border-color: var(--accent-purple-glow);
}

.wave-bar {
  width: 3px;
  height: 4px;
  background: var(--accent-cyan);
  border-radius: 1px;
}

.waveform.active .wave-bar {
  background: var(--accent-purple);
  animation: bounce 0.8s infinite ease-in-out alternate;
}

.waveform.active .wave-bar:nth-child(2) { animation-delay: 0.15s; }
.waveform.active .wave-bar:nth-child(3) { animation-delay: 0.3s; }
.waveform.active .wave-bar:nth-child(4) { animation-delay: 0.45s; }
.waveform.active .wave-bar:nth-child(5) { animation-delay: 0.1s; }
.waveform.active .wave-bar:nth-child(6) { animation-delay: 0.25s; }

@keyframes bounce {
  from { height: 4px; }
  to { height: 20px; }
}

/* --- Center Panel: Canvas & Flow Designer --- */
.canvas-panel {
  background: hsl(210, 20%, 93%);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.canvas-toolbar {
  height: 50px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
}

.canvas-scroller {
  flex-grow: 1;
  overflow: auto;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  background-image: 
    radial-gradient(hsla(220, 10%, 65%, 0.15) 1px, transparent 0),
    radial-gradient(hsla(220, 10%, 65%, 0.15) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* Flow Node (Card representation) */
.flow-node {
  width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
  position: relative;
  display: flex;
  flex-direction: column;
}

.flow-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 4px 0 0 4px;
}

.flow-node.active-node {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px hsla(142, 76%, 36%, 0.15);
}

.flow-node.active-node::before {
  background: var(--accent-green);
}

.node-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: hsla(210, 15%, 97%, 0.8);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.node-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.node-id-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--bg-input);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.node-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.node-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.node-row label {
  color: var(--text-secondary);
  font-weight: 600;
}

/* DTMF Menu Routes Styling */
.node-routes-box {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.routes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.route-item {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.route-key-select {
  padding: 0.4rem 0.5rem;
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.route-target-select {
  padding: 0.4rem 0.5rem;
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.75rem;
}

/* Connection Lines Indicators */
.flow-connector {
  width: 2px;
  height: 30px;
  background: hsla(220, 15%, 75%, 0.8);
  position: relative;
}

.flow-connector::after {
  content: '▼';
  font-size: 8px;
  color: hsla(220, 15%, 70%, 0.8);
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
}

/* --- Right Panel: Simulator & Exporter --- */

/* Phone Screen Simulator */
.simulator-box {
  background: hsl(210, 20%, 94%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-lg);
}

.phone-screen {
  width: 100%;
  height: 120px;
  background: hsl(220, 25%, 10%);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.6);
}

.phone-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(0, 210, 255, 0.05), transparent);
  pointer-events: none;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.screen-status {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  margin: 0.5rem 0;
  color: hsl(0, 0%, 100%);
}

.screen-details {
  font-size: 0.7rem;
  color: hsl(210, 10%, 70%);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dial Pad Grid */
.dialpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 220px;
}

.dial-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: hsl(0, 0%, 100%);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.dial-btn:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: hsl(210, 25%, 98%);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.dial-btn:active:not(:disabled) {
  background: var(--accent-cyan-glow);
}

.dial-btn:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: not-allowed;
}

.dial-num {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.dial-letters {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: -2px;
}

.phone-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.phone-actions .btn {
  flex: 1;
}

/* Config Exporter Box */
.exporter-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
}

.code-textarea {
  width: 100%;
  height: 180px;
  background: hsl(0, 0%, 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.75rem;
  outline: none;
  resize: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(5px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: translateY(20px);
  transition: var(--transition-smooth);
}

.modal-overlay.open .modal-box {
  transform: translateY(0);
}

/* --- Layout Responsiveness adjustments --- */
@media (max-width: 1100px) {
  .app-workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .workspace-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    height: auto;
  }
  .workspace-panel.right-panel {
    border-left: none;
  }
}

/* --- New Layout Scroller --- */
.workspace-scroller {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background-image: 
    radial-gradient(hsla(220, 10%, 75%, 0.1) 1px, transparent 0),
    radial-gradient(hsla(220, 10%, 75%, 0.1) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* --- Card Styles --- */
.workspace-card {
  background: var(--bg-panel);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition-smooth);
}
.workspace-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}
.workspace-card .card-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.badge-ai {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  background: hsla(270, 90%, 60%, 0.08);
  color: var(--accent-purple);
  border: 1px solid hsla(270, 90%, 60%, 0.15);
  text-transform: uppercase;
}
.badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  background: hsla(190, 100%, 38%, 0.08);
  color: var(--accent-cyan);
  border: 1px solid hsla(190, 100%, 38%, 0.15);
  text-transform: uppercase;
}
.card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- AI Card Customizations --- */
.ai-card {
  border-left: 4px solid var(--accent-purple);
}
.ai-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.ai-loader-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--accent-purple);
  font-weight: 500;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid hsla(270, 85%, 55%, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Speakers Avatar Grid --- */
.speakers-avatar-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.speaker-avatar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.speaker-avatar-item img {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-md);
  object-fit: cover;
  border: 2px solid var(--border-color);
  transition: var(--transition-smooth);
  box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}
.speaker-avatar-item:hover img, .speaker-avatar-item:hover .speaker-avatar-none-box {
  transform: scale(1.1);
  border-color: var(--accent-cyan);
}
.speaker-avatar-item.selected img, .speaker-avatar-item.selected .speaker-avatar-none-box {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px hsla(270, 85%, 55%, 0.45);
  transform: scale(1.05);
  animation: pulse-selected-speaker 1s infinite alternate ease-in-out;
}
.speaker-avatar-item.playing img, .speaker-avatar-item.playing .speaker-avatar-none-box {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px hsla(190, 100%, 38%, 0.85);
  animation: pulse-speaking-speaker 0.45s infinite alternate ease-in-out;
}
@keyframes pulse-selected-speaker {
  0% {
    transform: scale(1.02);
    box-shadow: 0 0 6px hsla(270, 85%, 55%, 0.3);
    border-color: hsla(270, 85%, 55%, 0.7);
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 20px hsla(270, 85%, 55%, 0.75);
    border-color: var(--accent-purple);
  }
}
@keyframes pulse-speaking-speaker {
  0% {
    transform: scale(0.98);
    box-shadow: 0 0 6px hsla(190, 100%, 38%, 0.4);
    filter: brightness(0.95);
  }
  100% {
    transform: scale(1.15);
    box-shadow: 0 0 30px hsla(190, 100%, 38%, 0.95);
    filter: brightness(1.3);
  }
}
.speaker-avatar-name {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.4rem;
  color: var(--text-secondary);
}
.speaker-avatar-gender {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: -1px;
}

/* --- Selected Speaker Controls --- */
.selected-speaker-panel {
  background: hsla(210, 20%, 96%, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  margin-top: 0.5rem;
  animation: fadeIn 0.35s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.speaker-details-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.speaker-details-row h3 {
  font-size: 0.95rem;
  font-weight: 700;
}
.speaker-sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.speaker-sliders-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.speaker-sliders-grid input[type=range] {
  -webkit-appearance: none;
  background: var(--border-color);
  height: 4px;
  border-radius: 2px;
  outline: none;
}
.speaker-sliders-grid input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
}

/* --- Music Avatar Grid --- */
.music-avatar-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.music-avatar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
}
.music-avatar-circle {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 2px solid var(--border-color);
  transition: var(--transition-smooth);
  box-shadow: 0 4px 8px rgba(0,0,0,0.04);
  background: white;
  user-select: none;
}
.music-avatar-item:hover .music-avatar-circle {
  transform: scale(1.1);
  border-color: var(--accent-cyan);
}
.music-avatar-item.selected .music-avatar-circle {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px hsla(270, 85%, 55%, 0.45);
  transform: scale(1.05);
}
.music-avatar-item.playing .music-avatar-circle {
  border-color: var(--accent-green);
  box-shadow: 0 0 25px hsla(142, 76%, 36%, 0.85);
  animation: pulse-playing-intense 0.45s infinite alternate ease-in-out;
}
@keyframes pulse-playing-intense {
  0% { 
    transform: scale(0.98);
    box-shadow: 0 0 6px hsla(142, 76%, 36%, 0.4);
    filter: brightness(0.95);
  }
  100% { 
    transform: scale(1.15);
    box-shadow: 0 0 35px hsla(142, 76%, 36%, 0.95);
    filter: brightness(1.35);
  }
}
.music-avatar-name {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.4rem;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.music-avatar-genre {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: -1px;
}

/* --- Canvas in Card Override --- */
.canvas-card .canvas-scroller {
  background: hsl(210, 20%, 93%);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  min-height: 380px;
  max-height: 700px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

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

/* --- Media Queries --- */
@media (max-width: 1200px) {
  .speakers-avatar-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .music-avatar-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
@media (max-width: 1100px) {
  .app-workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
  }
  .workspace-scroller {
    overflow-y: visible;
  }
  .workspace-panel.right-panel {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 2rem;
  }
}
@media (max-width: 600px) {
  .speakers-avatar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .music-avatar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .speaker-sliders-grid {
    grid-template-columns: 1fr;
  }
}
