/* ===== AI TITLE GENERATOR STYLES ===== */

/* Hero */
.ait-hero {
  position: relative;
  padding: 60px 0 40px;
  background: #fff;
  text-align: center;
  overflow: hidden;
}
.ait-hero-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1e90ff, #4facfe, #f5a623);
}
.ait-hero-icon {
  margin: 0 auto 16px;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.08), rgba(245, 166, 35, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
}
.ait-hero-title {
  font-size: 42px;
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #1e90ff, #4facfe, #f5a623);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ait-hero-sub {
  font-size: 15px;
  color: #888;
  font-weight: 400;
}

/* Input section */
.ait-input-section {
  padding: 0 0 40px;
  background: #fff;
}
.ait-input-card {
  max-width: 920px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e5edf5;
  border-radius: 18px;
  padding: 28px 32px 24px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.05);
}
.ait-input-row {
  display: flex;
  gap: 12px;
}
.ait-input {
  flex: 1.15;
  height: 80px;
  padding: 0 22px;
  border: 2px solid #e0e4ea;
  border-radius: 12px;
  font-size: 18px;
  color: #222;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-cn), sans-serif;
}
.ait-input:focus {
  border-color: #1e90ff;
  background: #fff;
}
.ait-input::placeholder {
  color: #9aa1ab;
}
.ait-input[aria-invalid="true"] {
  border-color: #d92d20;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.08);
}
.ait-field-error {
  margin-top: 8px;
  color: #b42318;
  font-size: 13px;
  line-height: 1.5;
}
.ait-field-error[hidden] {
  display: none;
}

/* Generate button */
.ait-generate-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 28px;
  height: 56px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e90ff, #4facfe);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s;
  font-family: var(--font-cn), sans-serif;
}
.ait-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(30, 144, 255, 0.3);
}
.ait-generate-btn:active {
  transform: translateY(0);
}
.ait-generate-btn:focus-visible,
.ait-chip:focus-visible,
.ait-copy-btn:focus-visible,
.ait-cta-btn:focus-visible {
  outline: 3px solid rgba(30, 144, 255, 0.28);
  outline-offset: 3px;
}
.ait-generate-btn.is-loading .ait-btn-icon {
  animation: aitSpin 0.8s linear infinite;
}
.ait-generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.ait-btn-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
.ait-hero-icon svg {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}
.ait-cta-left svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
.ait-input-row,
.ait-input {
  position: relative;
  z-index: 1;
}
.ait-input {
  min-width: 0;
  pointer-events: auto;
}

/* Loading spinner inside button */
.ait-generate-btn .ait-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: aitSpin 0.8s linear infinite;
}
@keyframes aitSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Loading message below button */
.ait-loading-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}
/* Double circle spinner */
.ait-loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
}
.ait-loading-spinner .ait-spin-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.ait-loading-spinner .ait-spin-ring.outer {
  border: 4px solid rgba(30, 144, 255, 0.15);
  border-top-color: #1e90ff;
  border-right-color: #4facfe;
  animation: aitSpinCW 0.8s linear infinite;
}
.ait-loading-spinner .ait-spin-ring.inner {
  top: 12px;
  left: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  border: 3px solid rgba(245, 166, 35, 0.15);
  border-bottom-color: #f5a623;
  border-left-color: #f5a623;
  animation: aitSpinCCW 0.6s linear infinite;
}
@keyframes aitSpinCW {
  to {
    transform: rotate(360deg);
  }
}
@keyframes aitSpinCCW {
  to {
    transform: rotate(-360deg);
  }
}
.ait-loading-text {
  margin-top: 12px;
  font-size: 14px;
  color: #666;
  text-align: center;
}
.ait-loading-text .ait-kw {
  color: #1e90ff;
  font-weight: 600;
}

/* Quick-fill chips */
.ait-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.ait-chip-label {
  font-size: 12px;
  color: #999;
}
.ait-chip {
  padding: 5px 14px;
  border: 1px solid #e0e4ea;
  border-radius: 20px;
  background: #f9fafb;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-cn), sans-serif;
}
.ait-chip:hover {
  border-color: #1e90ff;
  color: #1e90ff;
  background: rgba(30, 144, 255, 0.04);
}

/* placeholder — sections below filled via edit */
/* Results count row */
.ait-results-count-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto 16px;
  padding: 0 4px;
}
.ait-results-count {
  font-size: 20px;
  font-weight: 700;
  color: #333;
}
.ait-count-num {
  color: #1e90ff;
  font-style: normal;
}
.ait-results-keyword {
  font-size: 14px;
  color: #888;
}
.ait-results-keyword span {
  color: #1e90ff;
  font-weight: 600;
}

/* Results - Two column grid */
.ait-results-list {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ait-results-empty {
  grid-column: 1 / -1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  border: 1px dashed #cfd8e3;
  border-radius: 18px;
  text-align: center;
  color: #7a8492;
  background: linear-gradient(145deg, rgba(30, 144, 255, 0.025), rgba(245, 166, 35, 0.025));
}
.ait-empty-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: #1e90ff;
  background: linear-gradient(145deg, rgba(30, 144, 255, 0.12), rgba(245, 166, 35, 0.1));
}
.ait-empty-icon svg {
  width: 43px;
  height: 43px;
}
.ait-results-empty strong {
  color: #273142;
  font-size: 18px;
}
.ait-results-empty span {
  font-size: 14px;
}

/* Title card - adapts to grid */
.ait-title-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 14px;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  opacity: 0;
  transform: translateY(16px);
  flex-direction: column;
}
.ait-title-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.ait-title-card:hover {
  border-color: rgba(30, 144, 255, 0.62);
  background: #f8faff;
  box-shadow: 0 6px 24px rgba(30, 144, 255, 0.12);
}
.ait-title-skeleton {
  min-height: 122px;
  padding: 18px;
  border: 1px solid #edf0f4;
  border-radius: 14px;
  background: #fff;
}
.ait-skeleton-tag,
.ait-skeleton-line {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 45%, #eef2f6 65%);
  background-size: 220% 100%;
  animation: aitSkeleton 1.2s ease-in-out infinite;
}
.ait-skeleton-tag {
  width: 72px;
  height: 22px;
  margin-bottom: 19px;
}
.ait-skeleton-line {
  width: 88%;
  height: 15px;
  margin-top: 10px;
}
.ait-skeleton-line.is-short {
  width: 58%;
}
@keyframes aitSkeleton {
  to { background-position: -220% 0; }
}

/* Tag row with reference label */
.ait-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

/* Reference badge */
.ait-rate-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  color: #888;
}
.ait-rate-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: #888;
}

/* Tag badge - inline in card */
.ait-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.ait-tag svg {
  flex-shrink: 0;
}
.ait-tag span {
  line-height: 1;
}

/* Colored tag styles */
.ait-tag-avoid {
  background: #ef4444;
  color: #fff;
}
.ait-tag-geo {
  background: #3b82f6;
  color: #fff;
}
.ait-tag-deep {
  background: #8b5cf6;
  color: #fff;
}
.ait-tag-emotion {
  background: #ec4899;
  color: #fff;
}
.ait-tag-data {
  background: #06b6d4;
  color: #fff;
}
.ait-tag-hot {
  background: #f97316;
  color: #fff;
}
.ait-tag-authority {
  background: #eab308;
  color: #fff;
}
.ait-tag-tutorial {
  background: #22c55e;
  color: #fff;
}
.ait-tag-compare {
  background: #6366f1;
  color: #fff;
}
.ait-tag-trend {
  background: #14b8a6;
  color: #fff;
}
.ait-tag-crisis {
  background: #b91c1c;
  color: #fff;
}
.ait-tag-fate {
  background: #7c3aed;
  color: #fff;
}
.ait-tag-startup {
  background: #0ea5e9;
  color: #fff;
}
.ait-tag-media {
  background: #64748b;
  color: #fff;
}
.ait-tag-ads {
  background: #f59e0b;
  color: #fff;
}
.ait-tag-reveal {
  background: #dc2626;
  color: #fff;
}

/* Title row - title + copy button */
.ait-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

/* Title text */
.ait-title-text {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  color: #333;
  line-height: 1.6;
}

/* Copy button - icon only, right aligned */
.ait-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  flex-shrink: 0;
}
.ait-copy-btn:hover {
  background: rgba(30, 144, 255, 0.08);
}
.ait-copy-btn:hover svg {
  stroke: #1e90ff;
}
.ait-copy-btn svg {
  width: 28px;
  height: 28px;
  stroke: #999;
}
.ait-copy-btn.copied {
  background: rgba(34, 197, 94, 0.08);
}
.ait-copy-btn.copied svg {
  stroke: #22c55e;
}

/* Input - taller */
.ait-input {
  flex: 1;
  height: 56px;
  padding: 0 18px;
  border: 2px solid #e0e4ea;
  border-radius: 12px;
  font-size: 16px;
  color: #222;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-cn), sans-serif;
}
.ait-input:focus {
  border-color: #1e90ff;
  background: #fff;
}
.ait-input::placeholder {
  color: #bbb;
}

/* CTA */
.ait-cta-section {
  padding: 12px 0 60px;
  background: #fff;
}
.ait-cta-card {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  border-radius: 14px;
  border: 2px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #1e90ff, #f5a623) border-box;
  opacity: 0.5;
  transition: opacity 0.4s;
}
.ait-cta-card.active {
  opacity: 1;
}
.ait-cta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #333;
  line-height: 1.6;
}
.ait-cta-left strong {
  color: #1e90ff;
  font-size: 20px;
}
.ait-cta-btn {
  flex-shrink: 0;
  padding: 10px 24px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e90ff, #f5a623);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.25s;
  white-space: nowrap;
}
.ait-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30, 144, 255, 0.3);
}

.ait-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10020;
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 10px;
  background: #047857;
  color: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ait-toast[hidden] {
  display: none;
}
.ait-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.ait-toast.is-error {
  background: #b42318;
}

/* Responsive */
@media (max-width: 768px) {
  .ait-hero {
    padding: 44px 0 28px;
  }
  .ait-hero-title {
    font-size: 24px;
  }
  .ait-input-card {
    padding: 22px 20px 18px;
  }
  .ait-input-row {
    flex-direction: column;
  }
  .ait-generate-btn {
    width: 100%;
    justify-content: center;
  }
  .ait-title-card {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
  }
  .ait-title-text {
    width: 100%;
    order: 2;
  }
  .ait-copy-btn {
    order: 3;
    margin-left: auto;
  }
  .ait-cta-card {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }
  .ait-cta-left {
    flex-direction: column;
  }
  .ait-results-list {
    grid-template-columns: 1fr;
  }
  .ait-results-count-row {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .ait-results-empty {
    min-height: 240px;
  }
}
@media (max-width: 480px) {
  .ait-hero-title {
    font-size: 20px;
  }
  .ait-hero-sub {
    font-size: 13px;
  }
  .ait-input {
    height: 60px;
    font-size: 15px;
  }
  .ait-generate-btn {
    height: 60px;
    font-size: 14px;
  }
  .ait-title-text {
    font-size: 16px;
  }
  .ait-copy-btn {
    width: 22px;
    height: 22px;
  }
  .ait-copy-btn svg {
    width: 22px;
    height: 22px;
  }
  .ait-results-count {
    font-size: 16px;
  }
  .ait-results-empty {
    min-height: 210px;
    padding: 30px 18px;
  }
  .ait-empty-icon {
    width: 62px;
    height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ait-generate-btn,
  .ait-title-card,
  .ait-copy-btn,
  .ait-cta-btn,
  .ait-toast {
    transition: none;
  }
  .ait-generate-btn.is-loading .ait-btn-icon,
  .ait-loading-spinner .ait-spin-ring,
  .ait-skeleton-tag,
  .ait-skeleton-line {
    animation: none;
  }
}
