/* ===========================================
   ResidentialServices.net - AI Home Services
   Color Palette:
   - Primary: #10B981 (Emerald)
   - Secondary: #14B8A6 (Teal)
   - Accent: #06B6D4 (Cyan)
   - Background: #0f172a (Dark Slate)
   - Surface: #1e293b (Slate 800)
   - Text: #F1F5F9 (Light Gray)
   - Muted: #64748B (Slate)
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: #0f172a;
  color: #F1F5F9;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #10B981 0%, #14B8A6 50%, #06B6D4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-warm {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Service Cards */
.service-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 1rem;
  background: linear-gradient(135deg, #10B981, #14B8A6);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.service-card:hover::before {
  opacity: 0.3;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(16, 185, 129, 0.15);
}

/* Floating Animation */
.floating {
  animation: float 8s ease-in-out infinite;
}

.floating-delayed {
  animation: float 8s ease-in-out infinite;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

/* Pulse Ring */
.pulse-ring {
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.6;
  }
}

/* Start Button */
.start-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
}

.start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.start-btn:hover::before {
  opacity: 1;
}

.start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(16, 185, 129, 0.4), 0 0 100px rgba(20, 184, 166, 0.2);
}

/* Ambient Particles */
.ambient-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particle-drift 12s ease-in-out infinite;
}

@keyframes particle-drift {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.3;
  }
  25% {
    transform: translate(30px, -20px) scale(1.2);
    opacity: 0.6;
  }
  50% {
    transform: translate(-10px, -40px) scale(0.8);
    opacity: 0.4;
  }
  75% {
    transform: translate(-30px, -15px) scale(1.1);
    opacity: 0.5;
  }
}

/* Chat overlay mobile fixes */
#chat-overlay {
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for iOS */
  -webkit-overflow-scrolling: touch;
}

/* Chat Interface */
.chat-interface {
  animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Ensure chat messages area is scrollable and takes available space */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0; /* Important for flex child scrolling */
}

/* Keep input fixed at bottom on mobile */
@media (max-width: 768px) {
  #chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    height: -webkit-fill-available;
  }

  .chat-interface {
    height: 100%;
    height: -webkit-fill-available;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Message Bubbles */
.message-bubble {
  animation: message-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes message-appear {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Typing Indicator */
.typing-dot {
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

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

/* Typing Cursor */
.typing-cursor {
  animation: cursor-blink 0.9s ease-in-out infinite;
  color: #10B981;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Step Cards */
.step-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-card:hover {
  transform: translateY(-8px);
}

/* Chat Preview Mockup */
.chat-preview-bubble {
  animation: preview-fade 0.5s ease-out backwards;
}

.chat-preview-bubble:nth-child(1) { animation-delay: 0.2s; }
.chat-preview-bubble:nth-child(2) { animation-delay: 0.8s; }
.chat-preview-bubble:nth-child(3) { animation-delay: 1.4s; }

@keyframes preview-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glassmorphism */
.glass {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-light {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.5);
}

/* Focus States */
input:focus, button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* Provider Cards */
.provider-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.provider-card:hover {
  transform: scale(1.02);
}

/* Service Tags */
.service-tag {
  transition: all 0.3s ease;
}

.service-tag:hover {
  transform: scale(1.05);
}

/* Ambient Background Gradient */
.ambient-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(20, 184, 166, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 50% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Line Clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Deal Cards */
.deal-card {
  transition: all 0.3s ease;
}

.deal-card:hover {
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateX(4px);
}

/* Prompt Tags */
.prompt-tag {
  transition: all 0.3s ease;
}

.prompt-tag:hover {
  transform: translateX(4px);
}
