/* ==========================================================================
   Omnizart Studio — AI Music Theory & Analysis UI Styles
   Glassmorphic slide-out drawer, formatted report cards, and interactive Q&A
   ========================================================================== */

/* Analysis Trigger Button in Results Topbar */
.btn-ai-analyze {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22) 0%, rgba(99, 102, 241, 0.28) 100%);
  border: 1px solid rgba(167, 139, 250, 0.45);
  border-radius: var(--radius-pill, 9999px);
  color: #e0e7ff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.18);
  white-space: nowrap;
}

.btn-ai-analyze:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.38) 0%, rgba(99, 102, 241, 0.45) 100%);
  border-color: rgba(196, 181, 253, 0.7);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.32);
  transform: translateY(-1px);
}

.btn-ai-analyze:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.btn-ai-analyze i.sparkle-icon {
  color: #c084fc;
  animation: ai-glow 2.5s ease-in-out infinite alternate;
}

@keyframes ai-glow {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #a855f7); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 6px #c084fc); }
}

/* Backdrop Overlay */
.ai-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 940;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ai-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Analysis Side Drawer Panel */
.ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  max-width: 100vw;
  background: var(--bg-surface, #11141d);
  border-left: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.55);
  z-index: 950;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-drawer.open {
  transform: translateX(0);
}

/* Drawer Header */
.ai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-elevated, rgba(255, 255, 255, 0.02));
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.ai-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-drawer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill, 9999px);
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
}

.ai-drawer-close {
  background: transparent;
  border: none;
  color: var(--text-dim, #94a3b8);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  transition: all 0.15s;
}

.ai-drawer-close:hover {
  color: var(--text-main, #ffffff);
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
}

/* Drawer Body (Scrollable Chat & Analysis Content) */
.ai-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Initial Prompt / Placeholder */
.ai-empty-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 16px;
  color: var(--text-dim, #94a3b8);
  gap: 12px;
}

.ai-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
  font-size: 22px;
}

.ai-empty-text {
  font-size: 13px;
  line-height: 1.5;
  max-width: 300px;
}

/* Result Card */
.ai-card {
  background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 8px);
  padding: 16px;
  line-height: 1.6;
  font-size: 13px;
  color: var(--text-main, #cbd5e1);
}

.ai-card h4 {
  margin: 12px 0 6px 0;
  color: var(--text-main, #e2e8f0);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-card h4:first-child {
  margin-top: 0;
}

.ai-card strong {
  color: var(--text-main, #ffffff);
  font-weight: 600;
}

.ai-card p {
  margin: 6px 0;
}

/* Loading Pulse inside Drawer */
.ai-loading-box {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(139, 92, 246, 0.06);
  border: 1px dashed rgba(167, 139, 250, 0.35);
  border-radius: var(--radius-sm, 8px);
  color: #c4b5fd;
  font-size: 12.5px;
}

.ai-loading-box.active {
  display: flex;
}

.ai-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a855f7;
  animation: ai-pulse 1.2s infinite ease-in-out;
}

@keyframes ai-pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Chat Bubbles */
.ai-bubble {
  padding: 12px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  line-height: 1.5;
  max-width: 92%;
  word-break: break-word;
}

.ai-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(79, 70, 229, 0.45));
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #ffffff;
}

.ai-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-elevated, rgba(255, 255, 255, 0.035));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  color: var(--text-main, #e2e8f0);
}

/* Quick Question Suggestion Chips */
.ai-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}

.ai-chip {
  background: var(--bg-base, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-pill, 9999px);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim, #cbd5e1);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.ai-chip:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(167, 139, 250, 0.4);
  color: var(--text-main, #f8fafc);
}

/* Drawer Footer / Input Area */
.ai-drawer-footer {
  padding: 14px 18px;
  background: var(--bg-elevated, rgba(255, 255, 255, 0.02));
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-input {
  flex: 1;
  background: var(--bg-base, rgba(0, 0, 0, 0.25));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 6px);
  padding: 9px 12px;
  color: var(--text-main, #f8fafc);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.ai-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.ai-btn-send {
  background: #8b5cf6;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm, 6px);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-btn-send:hover:not(:disabled) {
  background: #7c3aed;
  transform: translateY(-1px);
}

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

/* Light Theme Overrides */
[data-theme="light"] .ai-drawer {
  background: #ffffff;
  border-left-color: #e2e8f0;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .ai-drawer-header {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .ai-card {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

[data-theme="light"] .ai-card h4 {
  color: #0f172a;
}

[data-theme="light"] .ai-bubble.assistant {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .ai-drawer-footer {
  background: #f8fafc;
  border-top-color: #e2e8f0;
}

[data-theme="light"] .ai-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .ai-chip {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}

[data-theme="light"] .ai-chip:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #6d28d9;
}

@media (max-width: 640px) {
  .ai-drawer {
    width: 100vw;
  }
}

