/* Postik AI Funnel Generator & Modal Sheet Styles (Obsidian + Champagne Gold) */

/* ---------- AI Feature Promo Card ---------- */
.ai-feature-card {
  background: linear-gradient(135deg, rgba(217, 180, 108, 0.10) 0%, rgba(19, 19, 22, 0.96) 55%, rgba(217, 180, 108, 0.06) 100%);
  border: 1px solid rgba(217, 180, 108, 0.28);
  border-top-color: rgba(239, 208, 146, 0.42);
  border-radius: 16px;
  padding: 16px;
  margin: 14px 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 28px -14px rgba(217, 180, 108, 0.25);
}
.ai-feature-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.ai-feature-icon-box {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(239, 208, 146, 0.22), rgba(217, 180, 108, 0.08));
  border: 1px solid rgba(217, 180, 108, 0.42);
  color: #efd092;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-feature-text-block {
  flex: 1;
  min-width: 0;
}
.ai-feature-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #f4f2ee);
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}
.ai-feature-desc {
  font-size: 12.5px;
  color: var(--text-muted, #a3a09a);
  line-height: 1.4;
  margin: 0;
}
.ai-feature-btn {
  width: 100%;
  background: linear-gradient(180deg, #f3dcab 0%, #d9b46c 100%);
  border: 1px solid rgba(255, 240, 200, 0.55);
  color: #09090b;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 20px -10px rgba(217, 180, 108, 0.5);
  transition: all 0.15s ease;
  display: block;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ai-feature-btn:hover {
  background: linear-gradient(180deg, #f7e3b9 0%, #e1bd77 100%);
  border-color: rgba(255, 240, 200, 0.7);
  color: #09090b;
}
.ai-feature-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- AI Modal Sheet & Header ---------- */
.ai-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
  touch-action: none;
}
.ai-modal-overlay.active {
  display: flex !important;
}
.ai-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 5, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: aiFadeIn 0.22s ease-out;
  touch-action: none;
  overscroll-behavior: contain;
}
.ai-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 540px;
  min-width: 0;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--bg-surface, #111113);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px 26px 0 0;
  padding: 12px 18px calc(24px + env(safe-area-inset-bottom, 0px)) 18px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  box-sizing: border-box;
  animation: aiSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes aiFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes aiSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.ai-modal-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  margin: 0 auto 14px auto;
  flex-shrink: 0;
}
.ai-modal-header {
  position: relative;
  z-index: 2;
  background: var(--bg-surface, #111113);
  padding-top: 2px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.ai-modal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ai-badge-gemini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-subtle, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-accent, rgba(255, 255, 255, 0.32));
  color: var(--gold-200, #ffffff);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}
.ai-modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #a3a09a);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-modal-close-btn:active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}
.ai-modal-headline {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main, #f4f2ee);
  margin: 0 0 4px 0;
  letter-spacing: -0.3px;
}
.ai-modal-tagline {
  font-size: 12.5px;
  color: var(--text-muted, #a3a09a);
  margin: 0 0 12px 0;
  line-height: 1.4;
}

/* ---------- Prompt Step & Quick Chips ---------- */
.ai-chips-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim, #8a8781);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.ai-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  touch-action: pan-x;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.ai-chips-scroll::-webkit-scrollbar {
  display: none;
}
.ai-chip {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main, #f4f2ee);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.ai-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover, rgba(255, 255, 255, 0.4));
  color: #ffffff;
}
.ai-chip:active {
  transform: scale(0.96);
  background: var(--accent-subtle, rgba(255, 255, 255, 0.12));
}
.ai-input-group {
  margin-bottom: 8px;
}
.ai-input-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main, #f4f2ee);
  margin-bottom: 6px;
}
.ai-prompt-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--bg-elevated, #18181b);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text-main, #f4f2ee);
  font-size: 13.5px;
  line-height: 1.5;
  box-sizing: border-box;
  resize: vertical;
  min-height: 92px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-prompt-textarea:focus {
  outline: none;
  border-color: var(--border-focus, #ffffff);
  box-shadow: 0 0 0 3px var(--accent-glow, rgba(255, 255, 255, 0.22));
}
.ai-target-link-hint {
  font-size: 11.5px;
  color: var(--text-dim, #8a8781);
  line-height: 1.4;
  display: block;
  margin-bottom: 14px;
}
.ai-generate-submit-btn {
  position: relative;
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient, #ffffff);
  border: none;
  border-radius: 14px;
  color: var(--on-accent, #09090b);
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 6px 22px var(--accent-glow, rgba(255, 255, 255, 0.25)), inset 0 1px 0 rgba(255, 250, 235, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ai-generate-submit-btn:hover {
  transform: translateY(-1px);
}
.ai-generate-submit-btn:active {
  transform: scale(0.98);
}
.ai-btn-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  pointer-events: none;
  animation: aiShimmerSweep 3s infinite;
}
@keyframes aiShimmerSweep {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.7; }
}

/* ---------- Step 2: Loading & Progress Animation ---------- */
#aiStepLoading {
  overflow: hidden;
}
.ai-loading-container {
  padding: 10px 8px 16px 8px;
  text-align: center;
}
.ai-pulsing-orb {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 0 auto 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb-core {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-gradient, #ffffff);
  color: var(--on-accent, #09090b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 22px var(--accent-glow, rgba(255, 255, 255, 0.4));
  animation: orbPulse 1.8s infinite ease-in-out;
  z-index: 2;
}
.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--border-accent, rgba(255, 255, 255, 0.32));
}
.ring-1 {
  width: 68px;
  height: 68px;
  border-top-color: var(--gold-200, #ffffff);
  animation: spin 2.4s linear infinite;
}
.ring-2 {
  width: 82px;
  height: 82px;
  border-bottom-color: var(--gold-600, #d4d4d8);
  animation: spin 3.6s linear infinite reverse;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 18px rgba(255, 255, 255, 0.35); }
  50% { transform: scale(1.08); box-shadow: 0 0 32px rgba(255, 255, 255, 0.65); }
}
.ai-loading-status {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main, #f4f2ee);
  margin-bottom: 14px;
}
.ai-loading-stepper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
  text-align: left;
}
.ai-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-dim, #8a8781);
  transition: all 0.3s ease;
}
.ai-step-item.active {
  color: var(--gold-200, #ffffff);
  font-weight: 700;
}
.ai-step-item.done {
  color: var(--status-success, #10b981);
}
.ai-step-item .step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: all 0.3s;
}
.ai-step-item.active .step-dot {
  background: var(--gold-400, #ffffff);
  box-shadow: 0 0 8px var(--gold-400, #ffffff);
  transform: scale(1.3);
}
.ai-step-item.done .step-dot {
  background: var(--status-success, #10b981);
  box-shadow: 0 0 6px var(--status-success, #10b981);
}

/* ---------- Step 3: Result, Preview, Tabs & Manual Edit ---------- */
.ai-result-strategy-card {
  background: var(--accent-subtle, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-accent, rgba(255, 255, 255, 0.32));
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.strategy-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-primary, #ffffff);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.strategy-text {
  font-size: 12.5px;
  color: var(--text-main, #f4f2ee);
  line-height: 1.45;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ai-preview-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.ai-preview-card {
  background: var(--bg-elevated, #18181b);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.ai-preview-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 28px;
  min-width: 0;
}
.ai-preview-card-head > div:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.preview-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #a3a09a);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-model-badge {
  color: var(--status-success, #10b981);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-timer-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--gold-200, #ffffff);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.ai-preview-val-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main, #f4f2ee);
  margin-bottom: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  min-width: 0;
}
.ai-preview-val-sub {
  font-size: 12px;
  color: var(--accent-primary, #ffffff);
  font-weight: 600;
  margin-top: 2px;
}
.tg-bubble-preview {
  background: var(--bg-surface, #111113);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--text-main, #f4f2ee);
  font-size: 13px;
  line-height: 1.48;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.tg-bubble-preview b, .tg-bubble-preview strong {
  font-weight: 700;
  color: #ffffff;
}
.tg-bubble-preview i, .tg-bubble-preview em {
  font-style: italic;
  color: var(--text-muted, #a3a09a);
}
.tg-btn-preview {
  background: var(--accent-gradient, #ffffff);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--on-accent, #09090b);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 2px 8px var(--accent-glow, rgba(255, 255, 255, 0.22));
  margin-bottom: 4px;
}
.ai-mode-tabs {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 14px;
  gap: 3px;
  min-width: 0;
}
.ai-tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted, #a3a09a);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.2px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 36px;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ai-tab-btn.active {
  background: var(--accent-gradient, #ffffff);
  color: var(--on-accent, #09090b);
  box-shadow: 0 3px 12px var(--accent-glow, rgba(255, 255, 255, 0.25));
}
.ai-tab-btn:hover:not(.active) {
  color: var(--text-main, #f4f2ee);
  background: rgba(255, 255, 255, 0.06);
}
.ai-card-edit-btn {
  background: var(--accent-subtle, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-accent, rgba(255, 255, 255, 0.32));
  color: var(--accent-primary, #ffffff);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.ai-card-edit-btn:hover, .ai-card-edit-btn:active {
  background: var(--accent-primary, #ffffff);
  color: var(--on-accent, #09090b);
}

/* ---------- AI Manual Edit Sections ---------- */
.ai-edit-form-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.ai-edit-card {
  background: var(--bg-elevated, #18181b);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.ai-edit-card.highlight-pulse {
  border-color: var(--accent-primary, #ffffff);
  box-shadow: 0 0 18px var(--accent-glow, rgba(255, 255, 255, 0.28));
}
.ai-edit-card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main, #f4f2ee);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.ai-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ai-field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted, #a3a09a);
  letter-spacing: 0.3px;
}
.ai-field-input, .ai-field-textarea, .ai-field-select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-base, #0a0a0b);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-main, #f4f2ee);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  color-scheme: dark;
}
.ai-field-input:focus, .ai-field-textarea:focus, .ai-field-select:focus {
  border-color: var(--border-focus, #ffffff);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(255, 255, 255, 0.22));
}
.ai-field-textarea {
  resize: vertical;
  line-height: 1.45;
}
.ai-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ai-result-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  margin-top: 16px;
}
.ai-btn-apply {
  width: 100%;
  padding: 13px;
  background: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 12px;
  color: #09090b;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.ai-btn-apply:active {
  transform: scale(0.98);
}
.ai-btn-regenerate {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text-main, #f4f2ee);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ai-btn-regenerate:active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
