/* ==========================================================================
   Ajay Upadhyay Studio - Light-First Modern CSS (Algrohack-Inspired Simplicity)
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  --color-primary: #059669;
  --color-primary-hover: #047857;
  --color-primary-light: #ecfdf5;
  --color-surface: #ffffff;
  --color-surface-subtle: #f8fafc;
  --color-text-main: #121111;
  --color-text-muted: #51515a;
  --color-border: #e2e8f0;
}

/* Base resets & typography */
html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
}

body {
  color: var(--color-text-main);
  background-color: #ffffff;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.font-display {
  font-family: var(--font-display);
}

/* Background Grids & Algrohack-Style Ambient Glow */
.bg-grid-subtle {
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

.glow-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
  transition: opacity 0.5s ease;
}

.glow-emerald {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 70%);
}

.glow-teal {
  background: radial-gradient(circle, rgba(20, 184, 166, 0.16) 0%, rgba(20, 184, 166, 0) 70%);
}

.glow-indigo {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0) 70%);
}

/* Hairline & Clean Cards */
.hairline {
  border: 1px solid rgba(18, 17, 17, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.clean-card {
  background-color: #ffffff;
  border: 1px solid rgba(18, 17, 17, 0.08);
  border-radius: 1.5rem;
  box-shadow: 0 2px 8px -2px rgba(18, 17, 17, 0.04);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.clean-card:hover {
  border-color: rgba(5, 150, 105, 0.35);
  box-shadow: 0 20px 35px -10px rgba(18, 17, 17, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
  transform: translateY(-4px);
}

/* Floating Navigation */
.glass-nav {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(18, 17, 17, 0.06);
}

/* Algrohack-style Pill Buttons */
.pill-button {
  border-radius: 9999px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-button:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.3);
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Subtle floating animations */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.animate-float {
  animation: floatSlow 4.5s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

.animate-pulse-glow {
  animation: pulseGlow 7s ease-in-out infinite;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f8fafc;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Chatbot Styles - Fixed Circular Button at Bottom-Right */
.chatbot-container {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 10000;
  font-family: var(--font-sans);
  pointer-events: none;
}

.chatbot-container > * {
  pointer-events: auto;
}

#chatToggleContainer {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 10000 !important;
}

#chatToggleBtn {
  cursor: pointer;
}

#chatToggleContainer:hover #chatTooltip {
  opacity: 1;
  transform: translateX(0);
}

.chat-bubble-window {
  position: fixed !important;
  bottom: 92px !important;
  right: 24px !important;
  z-index: 10001 !important;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(18, 17, 17, 0.1);
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(18, 17, 17, 0.18), 0 0 0 1px rgba(18, 17, 17, 0.04);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.chat-bubble-window.minimized {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.9) translateY(16px) !important;
  display: none !important;
}

/* Mobile Responsive Optimizations for Chat & Touch */
@media (max-width: 640px) {
  #chatToggleContainer {
    bottom: 16px !important;
    right: 16px !important;
  }
  #chatToggleBtn {
    width: 50px !important;
    height: 50px !important;
  }
  .chat-bubble-window {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
    bottom: 76px !important;
    height: calc(100vh - 96px) !important;
    max-height: 520px !important;
    border-radius: 1.25rem !important;
  }
  /* Prevent iOS Safari from zooming into form fields on focus */
  input, select, textarea {
    font-size: 16px !important;
  }
}

.chat-message {
  animation: fadeInMessage 0.25s ease-out forwards;
}

@keyframes fadeInMessage {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.typing-dot {
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Dark mode fallback if user toggles */
html.dark body {
  background-color: #0b0f17;
  color: #f1f5f9;
}
html.dark .clean-card {
  background-color: #111827;
  border-color: rgba(255, 255, 255, 0.08);
}
html.dark .glass-nav {
  background: rgba(11, 15, 23, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
html.dark .chat-bubble-window {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

/* ==========================================================================
   Modern Preloader Animation (Algrohack-Inspired Smooth Simplicity)
   ========================================================================== */
#sitePreloader {
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

#sitePreloader.preloader-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(1.02);
}

@keyframes preloaderBar {
  0% { width: 0%; }
  45% { width: 68%; }
  85% { width: 92%; }
  100% { width: 100%; }
}

.preloader-bar {
  animation: preloaderBar 0.85s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes preloaderPop {
  0% { transform: scale(0.88); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.animate-preloader-pop {
  animation: preloaderPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
