/* ============================================
   BrandMe AI — Mobile-First Styles
   ============================================ */

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

:root {
  --bg: #0d0d0f;
  --bg2: #17171b;
  --bg3: #1e1e24;
  --card: #1a1a20;
  --border: #2a2a35;
  --accent: #7c5cfc;
  --accent2: #c471f5;
  --text: #f0f0f5;
  --text2: #9090a8;
  --text3: #6060780;
  --success: #22c55e;
  --warn: #f59e0b;
  --error: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Onboard ---- */
.onboard-screen {
  background: var(--bg);
  overflow-y: auto;
  padding: 0 0 32px;
}

.onboard-hero {
  background: linear-gradient(160deg, #1a1030 0%, #0d0d0f 60%);
  padding: 60px 24px 40px;
  text-align: center;
  position: relative;
}

.onboard-hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 40px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 40px 40px 0 0;
}

.logo-mark {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(124,92,252,0.6));
}

.onboard-hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.accent {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  margin-top: 10px;
  color: var(--text2);
  font-size: 15px;
}

.onboard-form {
  margin: 24px 16px 0;
}

/* ---- Card ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ---- Fields ---- */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text2);
}

.field input, .field textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus, .field textarea:focus {
  border-color: var(--accent);
}

/* ---- Photo Upload ---- */
.photo-upload {
  width: 100%;
  height: 140px;
  background: var(--bg3);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}

.photo-upload:hover, .photo-upload.has-photo {
  border-color: var(--accent);
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 14px;
}

.upload-icon { font-size: 32px; }

.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  padding: 12px 20px;
  text-decoration: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-full { width: 100%; }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

.mt-sm { margin-top: 12px; }

/* ---- Chat Header ---- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.chat-header-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-title { font-weight: 700; font-size: 15px; }
.chat-sub { font-size: 12px; color: var(--text2); }

.icon-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.icon-btn:hover, .icon-btn.active {
  border-color: var(--accent);
  background: rgba(124,92,252,0.1);
}

/* ---- Video Panel Drawer ---- */
.video-panel {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  max-height: 260px;
  overflow-y: auto;
  flex-shrink: 0;
}

.video-panel-inner { padding: 16px; }

.empty-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: var(--text2);
  font-size: 14px;
  text-align: center;
}

.empty-panel span { font-size: 32px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
}

.scenes-mini { display: flex; flex-direction: column; gap: 8px; }

.scene-mini-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.scene-mini-card:hover { border-color: var(--accent); }

.scene-num {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.scene-mini-title { font-size: 13px; font-weight: 600; }
.scene-mini-status { font-size: 11px; color: var(--text2); display: flex; align-items: center; gap: 5px; margin-top: 2px; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.done { background: var(--success); }
.status-dot.loading { background: var(--warn); animation: pulse 1s infinite; }
.status-dot.pending { background: var(--border); }

/* ---- Messages ---- */
.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  scroll-behavior: smooth;
}

.messages { display: flex; flex-direction: column; gap: 12px; }

.msg-row {
  display: flex;
}

.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }

.msg-bubble {
  max-width: 82%;
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.55;
}

.msg-bubble.user {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bubble.assistant {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-text p { margin-bottom: 6px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text strong { color: var(--accent2); }
.msg-text ul, .msg-text ol { padding-left: 18px; margin: 6px 0; }
.msg-text li { margin-bottom: 4px; }

.msg-action {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ---- Typing indicator ---- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text2);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ---- Input Bar ---- */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-bar textarea {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 11px 14px;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.input-bar textarea:focus { border-color: var(--accent); }

.send-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.send-btn:hover:not(:disabled) { transform: scale(1.08); }
.send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Preview Screen ---- */
.preview-screen { background: var(--bg); }

.download-bar {
  flex-shrink: 0;
  padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.video-preview-mini {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  max-height: 200px;
  background: #000;
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-player-wrap { border-radius: var(--radius); overflow: hidden; }
.video-player { width: 100%; display: block; border-radius: var(--radius); }

.scenes-list { display: flex; flex-direction: column; gap: 16px; }

.scene-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
  cursor: pointer;
}

.scene-card.selected { border-color: var(--accent); }

.scene-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}

.scene-badge {
  background: rgba(124,92,252,0.15);
  color: var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scene-card-title { font-weight: 600; font-size: 14px; }

.scene-image-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg3);
  overflow: hidden;
}

.scene-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
}

.scene-img-placeholder span:first-child { font-size: 32px; }

.scene-img-placeholder.generating { cursor: default; }

.scene-script { padding: 14px 16px; }

.scene-narration {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 10px;
}

.scene-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.scene-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text2);
}

.scene-prompt-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.scene-prompt-text {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  font-style: italic;
}

.generate-all-wrap { margin-top: 8px; }

/* ---- Spinner ---- */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0 0 0;
}

.modal {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 32px 24px 40px;
}

.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-sub { color: var(--text2); font-size: 14px; margin-bottom: 20px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  z-index: 200;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--error); color: var(--error); }

/* ---- Transitions ---- */
.slide-down-enter-active, .slide-down-leave-active {
  transition: all 0.3s ease;
  overflow: hidden;
}

.slide-down-enter-from, .slide-down-leave-to {
  max-height: 0;
  opacity: 0;
}

.slide-down-enter-to, .slide-down-leave-from {
  max-height: 260px;
  opacity: 1;
}

.toast-enter-active, .toast-leave-active { transition: all 0.3s ease; }
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateX(-50%) translateY(10px); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
