/* ============================================
   Motion Sync page-specific styles
   ============================================ */

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

/* ============ UPLOAD ZONES ============ */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  min-height: 180px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 150ms, background 150ms;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--text);
  background: var(--bg-alt);
}
.upload-zone.has-file {
  border-style: solid;
  border-color: var(--text);
  cursor: default;
}

.upload-zone-prompt {
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-icon { font-size: 36px; line-height: 1; }
.upload-title { font-weight: 700; font-size: 15px; }
.upload-hint { font-size: 12px; color: var(--text-mute); }

.upload-zone-preview {
  position: relative;
}
.upload-zone-preview img,
.upload-zone-preview video {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  background: #000;
}
.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.upload-zone-progress {
  padding: 24px 20px;
}
.upload-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 150ms;
}
.upload-progress-label {
  font-size: 12px;
  color: var(--text-soft);
  text-align: center;
}

/* ============ OPTIONS ============ */
.option-row { margin-bottom: 12px; }

.option-toggle {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  padding: 4px 0;
}
.option-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch {
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  background: var(--bg-alt);
  border-radius: 999px;
  position: relative;
  transition: background 150ms;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 180ms;
}
.option-toggle input:checked ~ .toggle-switch { background: var(--text); }
.option-toggle input:checked ~ .toggle-switch::after { transform: translateX(20px); }

.toggle-label { flex: 1; line-height: 1.4; }
.toggle-label strong { display: block; font-size: 14px; }
.toggle-desc { font-size: 12px; color: var(--text-mute); }

.length-picker {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.length-label { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.length-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.length-opt {
  position: relative;
  cursor: pointer;
}
.length-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.length-opt span {
  display: block;
  text-align: center;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  transition: border-color 150ms, background 150ms;
}
.length-opt span small {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-mute);
}
.length-opt input:checked ~ span {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--text) inset;
}

/* ============ GENERATE BUTTON ============ */
.generate-btn {
  margin-top: 8px;
  font-size: 17px;
  padding: 18px 20px;
  position: relative;
}
.generate-btn .cost-tag {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.generate-disclaimer {
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  margin: 12px 0 0;
}

/* ============ GENERATING STATE ============ */
.generating-card {
  background: var(--surface-dark);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 24px 28px;
  text-align: center;
}
.generating-spinner-wrap { margin-bottom: 18px; }
.generating-spinner {
  display: inline-block;
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.generating-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.generating-sub { font-size: 14px; opacity: 0.78; margin-bottom: 20px; }
.generating-progress {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}
.generating-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.generating-progress-fill {
  height: 100%;
  background: var(--accent-2);
  width: 0%;
  transition: width 300ms;
}
.generating-time { font-size: 12px; opacity: 0.7; }
.generating-help { font-size: 13px; opacity: 0.78; margin: 0; }
.generating-help a { color: var(--accent-2); text-decoration: underline; }

/* ============ DONE STATE ============ */
.done-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.done-badge {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  margin: 16px 16px 8px;
}
#done-video {
  width: 100%;
  max-height: 70vh;
  background: #000;
  display: block;
}
.done-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
}
.done-actions .btn { padding: 14px; font-size: 14px; }
.done-share {
  background: var(--surface-accent);
  padding: 16px;
  border-top: 1px solid var(--border);
}
.done-share-label { font-size: 14px; margin: 0 0 10px; color: var(--text); }
.done-share .btn { padding: 14px; font-size: 14px; }
.done-share-help {
  font-size: 12px;
  color: var(--text-soft);
  margin: 10px 0 0;
  text-align: center;
}
.done-share-help code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============ DURATION DISPLAY (replaces length picker) ============ */
.duration-info {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.duration-label { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.duration-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}
.duration-value.set {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--text) inset;
}
.duration-value .cost-pill {
  display: inline-block;
  background: var(--surface-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
}
.duration-help { font-size: 12px; color: var(--text-mute); }

/* ============ DASHBOARD: PROMINENT PROCESSING CARD ============ */
.processing-banner {
  background: linear-gradient(135deg, #fff7e6 0%, #fff1d6 100%);
  border: 2px solid var(--accent-2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.processing-banner .spin {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
.processing-banner-body { flex: 1; min-width: 0; }
.processing-banner-title { font-weight: 800; font-size: 15px; margin-bottom: 2px; }
.processing-banner-sub { font-size: 13px; color: var(--text-soft); }
.processing-banner-time { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

/* ============ INLINE PROCESSING ROW IN GEN LIST ============ */
.gen-item-processing {
  background: linear-gradient(135deg, #fff7e6 0%, #fff1d6 100%);
  border-color: var(--accent-2);
  border-width: 2px;
}
.gen-item-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.gen-item-sub {
  font-size: 12px;
  color: var(--text-soft);
}
.mini-spin {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(0,0,0,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

/* ============ VIDEO PREVIEW MODAL ============ */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-tap-highlight-color: transparent;
}
.video-modal-close {
  position: absolute;
  top: calc(12px + var(--safe-top));
  right: 12px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
}
.video-modal-body {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.video-modal-body video {
  width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-lg);
  background: #000;
  display: block;
}
.video-modal-actions { width: 100%; }
.video-modal-actions .btn { width: 100%; }

.gen-tengok-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}
.gen-tengok-btn:hover { background: var(--bg-alt); }

/* ============ INLINE VIDEO CARD (replaces Tengok modal) ============ */
.gen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.gen-card-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #000;
  object-fit: contain;
}
.gen-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 13px;
}
.gen-card-time { flex: 1; color: var(--text-mute); }
.gen-card-download {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-alt);
}
.gen-card-download:active { transform: scale(0.97); }


/* ============ COLLAPSIBLE GEN ROW (mobile-first, no modal) ============ */
.gen-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
}
.gen-row-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}
.gen-row-time { flex: 1; color: var(--text-mute); font-size: 13px; }
.gen-row-caret {
  font-size: 14px;
  color: var(--text-mute);
  transition: transform 180ms;
}
.gen-row-body { padding: 0 14px 14px; }
.gen-row-video {
  display: block;
  width: 100%;
  max-height: 50vh;
  border-radius: var(--radius-sm);
  background: #000;
  object-fit: contain;
}
.gen-row-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.gen-row-actions .btn {
  flex: 1;
  padding: 12px 14px;
  font-size: 14px;
}

/* ============ ANONYMOUS-START EMAIL MODAL ============ */
.email-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.email-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 22px calc(28px + var(--safe-bottom));
  box-shadow: 0 -20px 40px rgba(0,0,0,0.3);
}
.email-modal-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 0 0 4px;
}
.email-modal-sub {
  font-size: 14px;
  color: var(--text-soft);
  margin: 0 0 18px;
}
.email-modal-card .input { font-size: 16px; }
.email-modal-submit {
  margin-top: 14px;
}
.email-modal-hint {
  font-size: 12px;
  color: var(--text-mute);
  margin: 14px 0 0;
  line-height: 1.5;
}
.email-modal-existing-hint {
  font-size: 13px;
  color: #78350f;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 12px 0 0;
}
.email-modal-cancel {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 13px;
  padding: 16px 0 0;
  width: 100%;
  cursor: pointer;
  text-decoration: underline;
}

/* Desktop centering */
@media (min-width: 600px) {
  .email-modal { align-items: center; padding: 16px; }
  .email-modal-card { border-radius: var(--radius-lg); }
}

/* ============ ANONYMOUS FREE-TRIAL LIMIT NOTICE ============ */
.anon-trial-notice {
  margin-top: 8px;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.45;
}

/* ============================================
   SHARE MODAL (post-generation)
   ============================================ */
.share-modal[hidden] { display: none; }
.share-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.share-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(6, 36, 19, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
  animation: shareFadeIn 0.2s ease-out;
}
.share-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 20px 22px 28px;
  margin: 0 12px;
  pointer-events: auto;
  max-height: 90vh;
  overflow-y: auto;
  animation: shareSlideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}
@keyframes shareFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shareSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.share-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: rgba(254, 252, 232, 0.08);
  color: var(--text-soft);
  border: 0; border-radius: 50%;
  font-size: 20px; line-height: 28px;
  cursor: pointer;
}

.share-modal-hero {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 9 / 16;
  max-height: 280px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.share-modal-video {
  width: 100%; height: 100%;
  object-fit: cover;
}

.share-modal-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text-soft);
}
.share-modal-sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-mute);
  line-height: 1.5;
}
.share-modal-sub strong { color: #4ade80; font-weight: 700; }

.share-modal-captions-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  margin: 0 0 10px;
}
.share-caption-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.share-caption-card {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.22);
  border-radius: 12px;
  padding: 12px 10px;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.share-caption-card:hover, .share-caption-card.is-active {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.16);
}
.share-caption-name {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}
.share-caption-preview {
  font-size: 10px;
  color: var(--text-mute);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-modal-actions {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.share-modal-action-share {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
}
.share-modal-skip {
  font-size: 13px;
}

.share-modal-link-row {
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
  margin: 0;
}
.share-modal-link-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0,0,0,0.25);
  padding: 2px 8px;
  border-radius: 4px;
  color: #4ade80;
  font-size: 11px;
}

@media (min-width: 600px) {
  .share-modal { align-items: center; }
  .share-modal-sheet { border-radius: 20px; margin: 0 16px; }
}
