/* ── Mediaspot AI Assistant — Frontend Styles ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

.mai-app {
  --mai-bg:       #0a0a0a;
  --mai-surface:  #141414;
  --mai-surface2: #1e1e1e;
  --mai-border:   rgba(255,255,255,0.08);
  --mai-text:     #f0f0f0;
  --mai-muted:    rgba(255,255,255,0.45);
  --mai-dim:      rgba(255,255,255,0.22);
  --mai-accent:   #e0504a;
  --mai-glow:     rgba(224,80,74,0.3);
  --mai-radius:   14px;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--mai-bg);
  color: var(--mai-text);
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* ── Welcome ── */
.mai-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0 20px;
  text-align: center;
  transition: opacity 0.35s;
}
.mai-welcome.is-hidden { opacity: 0; pointer-events: none; display: none; }

.mai-orb-canvas { width: 280px; height: 280px; margin-bottom: 6px; }

.mai-title {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
  color: var(--mai-text);
}
.mai-subtitle {
  font-size: 14px;
  color: var(--mai-muted);
  font-weight: 300;
  margin: 0 0 28px;
}

.mai-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 32px;
}
.mai-chip {
  background: var(--mai-surface);
  border: 1px solid var(--mai-border);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--mai-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.mai-chip:hover { color: var(--mai-text); border-color: var(--mai-dim); background: var(--mai-surface2); }

/* ── Chat ── */
.mai-chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
  display: none;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}
.mai-chat.is-active { display: flex; }
.mai-chat::-webkit-scrollbar { width: 4px; }
.mai-chat::-webkit-scrollbar-thumb { background: var(--mai-surface2); border-radius: 4px; }

.mai-msg {
  display: flex;
  gap: 12px;
  animation: maiSlideUp 0.3s ease;
}
@keyframes maiSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mai-msg--user { flex-direction: row-reverse; }

.mai-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.mai-avatar--ai {
  background: linear-gradient(135deg, #e05050, #9040c0);
  color: white;
}
.mai-avatar--user {
  background: var(--mai-surface2);
  border: 1px solid var(--mai-border);
  color: var(--mai-muted);
  font-size: 15px;
}

.mai-bubble {
  max-width: 78%;
  padding: 11px 16px;
  border-radius: var(--mai-radius);
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.mai-msg--ai .mai-bubble {
  background: var(--mai-surface);
  border: 1px solid var(--mai-border);
  border-bottom-left-radius: 4px;
}
.mai-msg--user .mai-bubble {
  background: rgba(224,80,74,0.12);
  border: 1px solid rgba(224,80,74,0.25);
  border-bottom-right-radius: 4px;
}
.mai-bubble img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}

/* Typing dots */
.mai-typing { display: flex; gap: 5px; align-items: center; padding: 4px 0; }
.mai-typing span {
  width: 7px; height: 7px;
  background: var(--mai-muted);
  border-radius: 50%;
  animation: maiDot 1.2s infinite;
}
.mai-typing span:nth-child(2) { animation-delay: 0.2s; }
.mai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes maiDot {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* ── Toolbar ── */
.mai-toolbar { flex-shrink: 0; padding: 8px 0 24px; }

.mai-image-preview {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.mai-image-preview:empty { display: none; }
.mai-thumb-wrap {
  position: relative; width: 56px; height: 56px;
}
.mai-thumb-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--mai-border);
}
.mai-thumb-remove {
  position: absolute; top: -5px; right: -5px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--mai-surface2); border: 1px solid var(--mai-border);
  color: var(--mai-muted); font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1;
}
.mai-thumb-remove:hover { color: var(--mai-text); }

.mai-input-bar {
  display: flex;
  align-items: flex-end;
  background: var(--mai-surface);
  border: 1px solid var(--mai-border);
  border-radius: var(--mai-radius);
  padding: 10px 12px;
  gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mai-input-bar:focus-within {
  border-color: var(--mai-dim);
  box-shadow: 0 0 0 3px var(--mai-glow);
}

.mai-bar-btn {
  background: none; border: none;
  color: rgba(255,255,255,0.28);
  cursor: pointer; padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
  display: flex; align-items: center; flex-shrink: 0;
}
.mai-bar-btn:hover { color: var(--mai-muted); }

#mai-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--mai-text); font-family: inherit;
  font-size: 14.5px; resize: none;
  min-height: 24px; max-height: 140px;
  line-height: 1.5; padding: 2px 0;
}
#mai-input::placeholder { color: rgba(255,255,255,0.22); }

.mai-send-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--mai-accent);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 0 14px var(--mai-glow);
}
.mai-send-btn:hover:not(:disabled) { transform: scale(1.08); box-shadow: 0 0 22px var(--mai-glow); }
.mai-send-btn:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
.mai-send-btn svg { pointer-events: none; }

.mai-disclaimer {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.18);
  margin: 8px 0 0;
  font-weight: 300;
}

/* ── Locked screen ── */
.mai-app--locked {
  min-height: 80vh;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.mai-orb-bg {
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(224,80,74,0.25) 0%, rgba(224,80,74,0.06) 50%, transparent 70%);
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  pointer-events: none;
  animation: maiPulse 4s ease-in-out infinite;
}
@keyframes maiPulse {
  0%,100% { transform: translate(-50%,-60%) scale(1); opacity: 0.8; }
  50%      { transform: translate(-50%,-60%) scale(1.1); opacity: 1; }
}
.mai-locked-content {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; text-align: center; max-width: 480px;
  padding: 40px 24px; position: relative; z-index: 1;
}
.mai-locked-icon { color: rgba(255,255,255,0.3); }
.mai-locked-msg {
  color: var(--mai-muted);
  font-size: 15px; line-height: 1.7;
  font-weight: 300;
}
.mai-login-btn {
  background: var(--mai-accent);
  color: white; border: none;
  padding: 10px 28px; border-radius: 99px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 0 14px var(--mai-glow);
}
.mai-login-btn:hover { opacity: 0.88; transform: scale(1.03); color: white; text-decoration: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .mai-app { padding: 0 14px; }
  .mai-orb-canvas { width: 220px; height: 220px; }
  .mai-bubble { max-width: 92%; font-size: 14px; }
  .mai-chip { font-size: 12px; padding: 6px 12px; }
}
