/* 
  AI Search Assistant Premium Redesign Styling
  OpenAI, Linear, and Apple inspired design theme.
*/

:root {
  --ai-accent-blue: #2563eb;
  --ai-accent-violet: #7c3aed;
  --ai-text-title: #0f172a;
  --ai-text-body: #475569;
  --ai-text-muted: #64748b;
  --ai-card-bg: rgba(255, 255, 255, 0.72);
  --ai-card-border: rgba(255, 255, 255, 0.25);
  --ai-font-family: 'Inter', -apple-system, sans-serif;
}

/* --- CARD WRAPPER / CONTAINER --- */
.demo-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 660px;
  min-height: 560px;
  background: var(--ai-card-bg);
  border: 1px solid var(--ai-card-border);
  border-radius: 30px;
  padding: 42px;
  box-shadow: 
    0 30px 80px rgba(45, 80, 255, 0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
  
  /* Floating & entry animations */
  animation: 
    aiCardLoad 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    aiCardFloat 6s ease-in-out infinite 0.8s;
  opacity: 0;
  transform: translateY(30px);
}

/* --- BACKGROUND DECORATIONS --- */
.card-deco-radial {
  position: absolute;
  top: -50px;
  left: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.card-deco-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(37, 99, 235, 0.03) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}

/* --- TOP STATUS AREA --- */
.ai-card-top {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 1.5rem;
  z-index: 2;
}

/* AI Avatar Component */
.ai-avatar-container {
  position: relative;
  width: 54px;
  height: 54px;
}

.ai-avatar-glow {
  position: absolute;
  inset: -6px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.4) 0%, transparent 75%);
  border-radius: 50%;
  animation: avatarGlow 3s ease-in-out infinite;
}

.ai-avatar-orb {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  box-shadow: 
    0 4px 12px rgba(37, 99, 235, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.ai-avatar-core {
  width: 22px;
  height: 22px;
  background: radial-gradient(circle, #60a5fa 0%, #2563eb 60%, #1d4ed8 100%);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
  animation: corePulse 2s ease-in-out infinite;
}

.ai-avatar-orbit {
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(37, 99, 235, 0.15);
  border-radius: 50%;
  animation: orbitRotate 10s linear infinite;
}

.orbit-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #7c3aed;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.8);
}

.orbit-particle.p1 {
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
}

.orbit-particle.p2 {
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.8);
}

/* LIVE Indicator */
.ai-status-indicator {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 4px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
  animation: statusPulse 2s infinite;
}

.status-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--ai-font-family);
}

/* --- TYPOGRAPHY & HEADER --- */
.demo-header {
  text-align: center;
  margin-bottom: 1.5rem;
  z-index: 2;
  position: relative;
}

h2.demo-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--ai-text-title);
  font-family: var(--ai-font-family);
  letter-spacing: -0.5px;
}

p.demo-desc {
  color: var(--ai-text-body);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 auto;
  max-width: 440px;
  font-family: var(--ai-font-family);
}

/* --- FEATURE PILLS --- */
.feature-pills {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  z-index: 2;
  position: relative;
}

.feature-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ai-text-body);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
  font-family: var(--ai-font-family);
}

.feature-pill i {
  font-size: 1rem;
  color: var(--ai-accent-blue);
}

.feature-pill:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

/* --- TRANSITIONS AREA --- */
.content-area-container {
  flex: 0 0 285px;
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
  width: 100%;
  min-height: 285px;
  max-height: 285px;
  overflow: hidden;
  z-index: 2;
}

#default-content {
  transition: opacity 0.4s ease;
  width: 100%;
}

/* --- INPUT AREA --- */
.input-container {
  width: 100%;
  z-index: 2;
  position: relative;
}

.ai-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 8px 8px 8px 20px;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.04),
    inset 0 1px 1px rgba(255, 255, 255, 0.8);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  box-sizing: border-box;
}

.ai-input-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 
    0 10px 30px rgba(37, 99, 235, 0.08),
    0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-chat-icon {
  font-size: 1.2rem;
  color: var(--ai-text-muted);
  margin-right: 12px;
  flex-shrink: 0;
}

.ai-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ai-text-title);
  font-size: 1rem;
  font-family: var(--ai-font-family);
  outline: none;
  padding: 8px 0;
  box-sizing: border-box;
}

.ai-input::placeholder {
  color: var(--ai-text-muted);
}

/* Send Button */
.ai-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--ai-accent-blue) 0%, var(--ai-accent-violet) 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.25);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  margin-left: 8px;
}

.ai-send-btn svg {
  width: 16px;
  height: 16px;
  transform: translate(1px, 0);
  transition: transform 0.2s ease;
}

.ai-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 
    0 4px 15px rgba(124, 58, 237, 0.4),
    0 0 10px rgba(37, 99, 235, 0.2);
}

.ai-send-btn:active {
  transform: scale(0.96);
}

/* --- FOOTER AREA --- */
.ai-card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ai-text-muted);
  margin-top: 1.2rem;
  z-index: 2;
  position: relative;
  font-family: var(--ai-font-family);
}

.ai-card-footer i {
  font-size: 0.85rem;
  color: #10b981; /* Green lock for trust */
}

/* --- AI RESPONSE CONTAINER --- */
.ai-response-area {
  display: none;
  opacity: 0;
  flex-direction: column;
  justify-content: flex-start;
  transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.ai-response-area.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.ai-response-text {
  font-size: 1.2rem;
  font-weight: 450;
  line-height: 1.5;
  color: var(--ai-text-title);
  margin-bottom: 0.9rem;
  font-family: var(--ai-font-family);
  max-height: 170px;
  overflow-y: auto;
  padding-right: 5px;
}

.ai-response-text a {
  color: var(--ai-accent-blue);
  text-decoration: none;
  font-weight: 650;
}

.ai-response-text pre {
  white-space: pre-wrap;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.85rem;
  overflow-x: auto;
}

.ai-response-text code {
  background: rgba(15, 23, 42, 0.06);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.88em;
}

.ai-response-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--ai-font-family);
}

.ai-source-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.ai-source-row::-webkit-scrollbar {
  display: none;
}

.ai-source-row a,
.ai-source-row span {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 180px;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--ai-accent-blue);
  border: 1px solid rgba(37, 99, 235, 0.15);
  font-size: 0.72rem;
  font-weight: 650;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-response-text::-webkit-scrollbar {
  width: 4px;
}

.ai-response-text::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.ai-reset-btn {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ai-text-body);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--ai-font-family);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-reset-btn i {
  font-size: 0.95rem;
}

.ai-reset-btn:hover {
  background: #ffffff;
  color: var(--ai-accent-blue);
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* --- HERO WRAPPER SPECIFIC POSITIONING --- */
.hero-ai-search {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

@media (max-width: 600px) {
  .hero-ai-search {
    justify-self: center;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding-inline: 0;
  }

  .hero-ai-search .demo-wrapper {
    width: min(100%, 360px);
    max-width: 360px;
    min-height: auto;
    padding: 24px 22px;
    margin-inline: auto;
    animation: aiCardLoad 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none;
  }

  .hero-ai-search .content-area-container {
    flex-basis: auto;
    min-height: auto;
    max-height: none;
    margin-bottom: 1rem;
    overflow: visible;
  }

  .hero-ai-search .ai-card-top {
    margin-bottom: 1rem;
  }

  .hero-ai-search h2.demo-title {
    display: block;
    font-size: 1.65rem;
    line-height: 1.12;
    margin-bottom: 8px;
    white-space: normal;
  }

  .hero-ai-search p.demo-desc {
    font-size: 0.86rem;
    line-height: 1.45;
    max-width: 285px;
  }

  .hero-ai-search .feature-pills {
    margin-top: 1rem;
    gap: 8px;
  }

  .hero-ai-search .feature-pill {
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .hero-ai-search .ai-response-text {
    max-height: 108px;
    font-size: 1rem;
    line-height: 1.45;
  }

  .hero-ai-search .ai-source-row a,
  .hero-ai-search .ai-source-row span {
    max-width: 145px;
  }

  .hero-ai-search .ai-response-meta {
    margin-bottom: 10px;
  }

  .hero-ai-search .ai-input-wrapper {
    min-height: 54px;
    max-height: 54px;
    padding: 7px 7px 7px 14px;
    overflow: hidden;
  }

  .hero-ai-search .ai-input {
    min-width: 0;
    height: 38px;
    font-size: 0.86rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .hero-ai-search .ai-send-btn {
    width: 38px;
    height: 38px;
    margin-left: 6px;
  }
}

/* --- KEYFRAME ANIMATIONS --- */
@keyframes aiCardLoad {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes aiCardFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes avatarGlow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

@keyframes corePulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.08);
    filter: brightness(1.15);
  }
}

@keyframes orbitRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes statusPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.4;
  }
}
