/* ============================================
   ASK RICHARD POLK AI - Design System
   Matching Reference Design
   ============================================ */

/* CSS Custom Properties */
:root {
  /* Colors - Updated to match reference */
  --color-bg-dark: #0a0704;
  --color-bg-gradient-1: #1a1008;
  --color-bg-gradient-2: #0d0906;
  --color-bg-warm: #2a1a0a;
  --color-golden-primary: #c4a06a;
  --color-golden-secondary: #9a7d52;
  --color-golden-glow: rgba(160, 120, 80, 0.3);
  --color-text-primary: #d4b896;
  --color-text-secondary: rgba(212, 184, 150, 0.8);
  --color-text-muted: rgba(212, 184, 150, 0.6);
  --color-surface: rgba(35, 28, 22, 0.9);
  --color-surface-elevated: rgba(50, 40, 32, 0.95);
  --color-border: rgba(196, 160, 106, 0.2);
  --color-error: #c9544d;
  --color-success: #5a9a6e;

  /* Typography - Updated for legibility */
  --font-family: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-title: 'Coolvetica Rg', 'Coolvetica', var(--font-family);
  --font-size-xs: 0.8rem;
  --font-size-sm: 0.95rem;
  --font-size-base: 1.15rem;
  --font-size-lg: 1.35rem;
  --font-size-xl: 1.6rem;
  --font-size-2xl: 2.2rem;
  --font-size-3xl: 2.8rem;
  --font-size-title: clamp(2.2rem, 5vw, 3.5rem);
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --line-height-tight: 1.3;
  --line-height-normal: 1.65;
  --line-height-relaxed: 1.8;
  --letter-spacing-normal: 0.01em;
  --letter-spacing-wide: 0.04em;

  /* Spacing - Tighter layout */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.875rem;
  --space-lg: 1.25rem;
  --space-xl: 1.75rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3.5rem;

  /* Sizing - Larger avatar, wider container */
  --avatar-size: clamp(180px, 25vw, 260px);
  --avatar-size-small: 70px;
  --input-height: 56px;
  --input-max-width: 560px;
  --container-max-width: 920px;

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-out: cubic-bezier(0, 0, 0.2, 1);

  /* Z-Index */
  --z-background: 0;
  --z-wave: 1;
  --z-content: 10;
  --z-avatar: 20;
  --z-input: 30;
  --z-zoom: 40;
  --z-toast: 100;

  /* Zoom Scale */
  --zoom-scale: 1;
}

/* ============================================
   Reset & Base
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-dark);
  background-color: var(--color-bg-dark);
  height: 100%;
  overflow: hidden;
  /* Lock body scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Custom Scrollbar Styling */
  scrollbar-width: thin;
  scrollbar-color: var(--color-golden-secondary) transparent;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
  /* Transparent track */
}

::-webkit-scrollbar-thumb {
  background: #1a1a1a;
  /* Dark grey thumb */
  border-radius: 4px;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: #333333;
  /* Slightly lighter grey on hover */
}

/* ============================================
   Background & Effects
   ============================================ */

.background-gradient {
  position: fixed;
  inset: 0;
  z-index: var(--z-background);
  background:
    radial-gradient(ellipse 100% 80% at 50% 30%, rgba(40, 25, 12, 0.9) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 30% 80%, rgba(30, 18, 8, 0.6) 0%, transparent 50%),
    linear-gradient(to bottom, #0a0704 0%, #1a0f08 40%, #15100a 100%);
  will-change: background-position;
}

.wave-canvas {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  z-index: var(--z-wave);
  pointer-events: none;
  opacity: 0.85;
}

/* ============================================
   Layout
   ============================================ */

.container {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  height: 100vh;
  /* Fixed height for app */
  overflow: hidden;
  padding: 0;
  /* Remove padding to handle full screen layers */
}

/* Centered content wrapper that becomes sticky */
.centered-content {
  position: sticky;
  top: 0;
  margin-top: 40vh;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  z-index: var(--z-avatar) + 10;
  transition: margin-top var(--duration-slower) var(--easing-smooth),
    transform var(--duration-slower) var(--easing-smooth),
    padding var(--duration-slower) var(--easing-smooth),
    background-color var(--duration-slower) var(--easing-smooth),
    box-shadow var(--duration-slower) var(--easing-smooth);
}

/* When chatting, move centered content to top */
.container.chatting .centered-content {
  margin-top: 0;
  transform: translateY(0);
  padding: var(--space-md) var(--space-lg);
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ============================================
   Header
   ============================================ */

.header {
  text-align: center;
  margin-bottom: var(--space-lg);
  transition: all var(--duration-slower) var(--easing-smooth);
}

.title-image {
  max-width: 650px;
  height: auto;
  transition: all var(--duration-slower) var(--easing-smooth);
}

/* Chatting state - header shrinks */
.container.chatting .header {
  padding-top: var(--space-md);
  margin-bottom: var(--space-md);
}

.container.chatting .title-image {
  max-width: 280px;
}

/* ============================================
   Avatar
   ============================================ */

.avatar-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-lg);
  transition: transform var(--duration-slower) var(--easing-spring),
    margin var(--duration-slower) var(--easing-smooth),
    opacity var(--duration-slower) var(--easing-smooth);
  z-index: var(--z-avatar);
}

.avatar {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: avatarFloat 5s ease-in-out infinite;
  transition: width var(--duration-slower) var(--easing-spring),
    height var(--duration-slower) var(--easing-spring);
}

.avatar-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.6) 30%, transparent 70%);
  opacity: 0.8;
  filter: blur(25px);
  z-index: -1;
  transition: inset var(--duration-slower) var(--easing-smooth),
    filter var(--duration-slower) var(--easing-smooth);
}

.avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.1);
  border: 4px solid rgba(50, 40, 30, 0.8);
  box-shadow:
    0 0 0 1px rgba(80, 60, 40, 0.3),
    0 8px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 30px rgba(0, 0, 0, 0.4);
  transition: all var(--duration-slow) var(--easing-smooth);
}

.avatar-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(80, 60, 40, 0.25);
  opacity: 0.6;
  transition: inset var(--duration-slower) var(--easing-smooth);
}

/* Thinking State */
.thinking-ripple {
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 2px solid var(--color-golden-primary);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.avatar.thinking .thinking-ripple {
  animation: thinkingRipple 1.5s ease-out infinite;
}

.avatar.thinking .avatar-image {
  filter: grayscale(80%) contrast(1.1) brightness(1.05);
}

.avatar.thinking .avatar-glow {
  animation: thinkingGlow 1s ease-in-out infinite;
}

/* Chatting State - Avatar shrinks and stays centered with title */
.container.chatting .avatar-container {
  margin-bottom: var(--space-sm);
}

.container.chatting .avatar {
  width: var(--avatar-size-small);
  height: var(--avatar-size-small);
  animation: none;
}

.container.chatting .avatar-image {
  box-shadow: none !important;
  border-width: 2px;
}

.container.chatting .avatar-glow {
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
}

.container.chatting .avatar-ring {
  inset: -4px;
}

/* ============================================
   Chat Area
   ============================================ */

.chat-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity var(--duration-slower) var(--easing-smooth),
    visibility var(--duration-slower) var(--easing-smooth),
    transform var(--duration-slower) var(--easing-smooth);
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.container.chatting .chat-area {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.messages {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;

  /* Padding: top for header space, bottom for input space */
  padding: 220px calc(50% - var(--container-max-width) / 2 + var(--space-lg)) 180px calc(50% - var(--container-max-width) / 2 + var(--space-lg));

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);

  /* Dual-edge fade mask */
  mask-image: linear-gradient(to bottom,
      transparent 0px,
      transparent 180px,
      black 240px,
      black calc(100% - 180px),
      transparent calc(100% - 80px),
      transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom,
      transparent 0px,
      transparent 180px,
      black 240px,
      black calc(100% - 180px),
      transparent calc(100% - 80px),
      transparent 100%);
}


.message {
  padding: var(--space-md) var(--space-lg);
  border-radius: 16px;
  animation: messageSlideIn var(--duration-normal) var(--easing-out);
  line-height: var(--line-height-normal);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.message.assistant {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-elevated) 100%);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

/* Typing Indicator - Fixed above input */
.typing-indicator {
  position: fixed;
  bottom: calc(var(--space-2xl) + 100px);
  left: 50%;
  transform: translateX(-50%) scale(var(--zoom-scale));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface-elevated);
  border-radius: 20px;
  width: fit-content;
  border: 1px solid var(--color-border);
  z-index: var(--z-input);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.typing-indicator[hidden] {
  display: none;
}

.thinking-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  letter-spacing: var(--letter-spacing-wide);
}

.thinking-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thinking-dots span {
  width: 10px;
  height: 10px;
  background: var(--color-golden-primary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ============================================
   Input Area - Matching Reference Design
   ============================================ */

.input-area {
  position: fixed;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-xl) * 2);
  max-width: var(--input-max-width);
  z-index: var(--z-input);
}

.input-form {
  width: 100%;
}

.input-pill {
  display: flex !important;
  align-items: center !important;
  gap: var(--space-sm) !important;
  background: rgba(40, 35, 30, 0.95) !important;
  border: none !important;
  border-radius: 30px !important;
  padding: var(--space-md) var(--space-lg) !important;
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(80, 70, 60, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
  transition: all var(--duration-normal) var(--easing-smooth) !important;
}

.input-pill:focus-within {
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(80, 70, 60, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 0 40px rgba(160, 120, 80, 0.1) !important;
}

.message-input {
  flex: 1 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #d4b896 !important;
  font-family: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 1.15rem !important;
  resize: none !important;
  min-height: 24px !important;
  max-height: 120px !important;
  line-height: 1.5 !important;
  box-shadow: none !important;
}

.message-input::placeholder {
  color: rgba(140, 120, 100, 0.6) !important;
  font-style: normal !important;
}

.send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  flex-shrink: 0;
  opacity: 0.6;
}

.send-button:hover {
  opacity: 1;
  color: var(--color-golden-primary);
}

.send-button:active {
  transform: scale(0.95);
}

.send-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 8px;
  font-size: var(--font-size-sm);
  animation: toastSlideIn var(--duration-normal) var(--easing-out);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.toast.success {
  border-color: var(--color-success);
  color: var(--color-success);
}

/* ============================================
   Animations
   ============================================ */

@keyframes avatarFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes glowPulse {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
}

@keyframes thinkingRipple {
  0% {
    opacity: 0.8;
    transform: scale(0.9);
  }

  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@keyframes thinkingGlow {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 0.9;
  }
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-6px);
  }
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .avatar {
    animation: none;
  }

  .avatar-glow {
    animation: none;
  }

  .wave-canvas {
    opacity: 0.2;
  }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
  }

  .container {
    padding: var(--space-lg) var(--space-md);
  }

  .header {
    padding-top: var(--space-lg);
  }

  .container.chatting .avatar-container {
    top: var(--space-md);
    right: var(--space-md);
  }

  .input-area {
    bottom: var(--space-lg);
    width: calc(100% - var(--space-lg) * 2);
  }

  .messages {
    max-height: 40vh;
  }

  .message {
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .title-image {
    max-width: 250px;
  }

  .container.chatting .title-image {
    max-width: 150px;
  }

  .input-pill {
    padding: var(--space-sm) var(--space-md);
  }

  .send-button {
    width: 32px;
    height: 32px;
  }
}

/* ============================================
   Focus Styles
   ============================================ */

:focus-visible {
  outline: none;
}

.message-input:focus {
  outline: none;
}

.send-button:focus-visible {
  outline: none;
}

/* ============================================
   Intro Text (Before Interaction)
   ============================================ */

.intro-text {
  max-width: 600px;
  text-align: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  margin-top: var(--space-lg);
  padding: 0 var(--space-lg);
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--easing-smooth),
    transform var(--duration-slow) var(--easing-smooth);
}

/* Hide intro text when chatting */
.container.chatting .intro-text {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* ============================================
   Zoom Controls
   ============================================ */

.zoom-controls {
  position: fixed !important;
  bottom: 28px !important;
  right: 28px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  z-index: 9999 !important;
}

.zoom-control {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  background: rgba(50, 40, 32, 0.95) !important;
  border: 1px solid rgba(196, 160, 106, 0.3) !important;
  color: #d4b896 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
  padding: 0 !important;
  margin: 0 !important;
}

.zoom-control svg {
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor !important;
}

.zoom-control:hover:not(:disabled) {
  background: rgba(60, 50, 42, 1) !important;
  color: #c4a06a !important;
  transform: scale(1.08) !important;
  border-color: rgba(196, 160, 106, 0.5) !important;
}

.zoom-control:active:not(:disabled) {
  transform: scale(0.95) !important;
}

.zoom-control:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
}

/* ============================================
   Dynamic Zoom Scale Application
   ============================================ */

/* Apply zoom to scalable elements using CSS custom property */
.container {
  transform-origin: top center;
}

/* Scale text and UI elements based on zoom */
.message,
.intro-text {
  font-size: calc(var(--font-size-base) * var(--zoom-scale));
}

.thinking-indicator {
  transform: translateX(-50%) scale(var(--zoom-scale));
}

/* ============================================
   Feedback Button & Modal
   ============================================ */

/* Feedback Button - Fixed Top Right */
.feedback-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;

  /* Pill shape */
  padding: 10px 22px;
  border-radius: 50px;

  /* Dark theme styling */
  background: rgba(50, 40, 32, 0.9);
  border: 1px solid rgba(196, 160, 106, 0.3);
  color: var(--color-text-primary);

  /* Typography */
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);

  /* Interaction */
  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.feedback-btn:hover {
  background: rgba(60, 50, 42, 0.95);
  border-color: rgba(196, 160, 106, 0.5);
  color: var(--color-golden-primary);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(196, 160, 106, 0.15);
  transform: translateY(-1px);
}

.feedback-btn:active {
  transform: scale(0.98) translateY(0);
}

.feedback-btn:focus-visible {
  outline: 2px solid var(--color-golden-primary);
  outline-offset: 2px;
}

/* Modal Overlay */
.feedback-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;

  /* Backdrop */
  background: rgba(10, 7, 4, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  /* Flexbox centering */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--easing-smooth),
    visibility var(--duration-normal) var(--easing-smooth);
}

.feedback-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.feedback-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  /* Dark theme styling */
  background: linear-gradient(135deg, rgba(35, 28, 22, 0.98) 0%, rgba(45, 36, 28, 0.98) 100%);
  border: 1px solid rgba(196, 160, 106, 0.25);
  border-radius: 20px;

  /* Padding */
  padding: 32px;

  /* Shadow & effects */
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(80, 60, 40, 0.1) inset;

  /* Animation */
  transform: scale(0.95) translateY(10px);
  transition: transform var(--duration-normal) var(--easing-spring);
}

.feedback-modal-overlay.active .feedback-modal {
  transform: scale(1) translateY(0);
}

/* Close Button */
.feedback-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;

  width: 36px;
  height: 36px;
  border-radius: 50%;

  background: rgba(50, 40, 32, 0.6);
  border: 1px solid rgba(196, 160, 106, 0.2);
  color: var(--color-text-muted);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: all var(--duration-fast) var(--easing-smooth);
}

.feedback-modal-close:hover {
  background: rgba(60, 50, 42, 0.8);
  color: var(--color-golden-primary);
  border-color: rgba(196, 160, 106, 0.4);
}

.feedback-modal-close:active {
  transform: scale(0.95);
}

/* Modal Header */
.feedback-modal-header {
  text-align: center;
  margin-bottom: 28px;
}

.feedback-modal-title {
  font-family: var(--font-family);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 8px 0;
}

.feedback-modal-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
}

/* Feedback Form */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Form Field */
.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-field label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

.feedback-field .required {
  color: var(--color-error);
}

.feedback-field input,
.feedback-field textarea {
  width: 100%;
  padding: 12px 16px;

  background: rgba(25, 20, 16, 0.8);
  border: 1px solid rgba(196, 160, 106, 0.2);
  border-radius: 12px;

  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);

  transition: all var(--duration-fast) var(--easing-smooth);
}

.feedback-field input::placeholder,
.feedback-field textarea::placeholder {
  color: rgba(140, 120, 100, 0.5);
}

.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: rgba(196, 160, 106, 0.5);
  box-shadow: 0 0 0 3px rgba(196, 160, 106, 0.1);
}

/* Error state */
.feedback-field input.has-error,
.feedback-field textarea.has-error {
  border-color: var(--color-error);
}

.feedback-field input.has-error:focus,
.feedback-field textarea.has-error:focus {
  box-shadow: 0 0 0 3px rgba(201, 84, 77, 0.15);
}

.feedback-field textarea {
  min-height: 100px;
  resize: vertical;
}

/* Field Error Message */
.field-error {
  font-size: 0.8rem;
  color: var(--color-error);
  min-height: 1.2em;
}

/* Submit Button */
.feedback-submit-btn {
  position: relative;
  width: 100%;
  padding: 14px 24px;
  margin-top: 8px;

  background: linear-gradient(135deg, var(--color-golden-secondary) 0%, var(--color-golden-primary) 100%);
  border: none;
  border-radius: 12px;

  color: #1a1008;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);

  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 0 4px 15px rgba(196, 160, 106, 0.2);
}

.feedback-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196, 160, 106, 0.3);
}

.feedback-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.feedback-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Button Loader */
.feedback-submit-btn .btn-loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(26, 16, 8, 0.3);
  border-top-color: #1a1008;
  border-radius: 50%;
  animation: spinLoader 0.8s linear infinite;
}

.feedback-submit-btn .btn-loader[hidden] {
  display: none;
}

@keyframes spinLoader {
  to {
    transform: rotate(360deg);
  }
}

/* Status Messages */
.feedback-status {
  text-align: center;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: var(--font-size-sm);
  margin-top: 4px;
}

.feedback-status[hidden] {
  display: none;
}

.feedback-status.success {
  background: rgba(90, 154, 110, 0.15);
  border: 1px solid rgba(90, 154, 110, 0.3);
  color: var(--color-success);
}

.feedback-status.error {
  background: rgba(201, 84, 77, 0.15);
  border: 1px solid rgba(201, 84, 77, 0.3);
  color: var(--color-error);
}

/* Responsive - Mobile */
@media (max-width: 560px) {
  .feedback-btn {
    top: 16px;
    right: 16px;
    padding: 8px 18px;
    font-size: 0.85rem;
  }

  .feedback-modal {
    padding: 24px;
    border-radius: 16px;
    max-width: calc(100% - 16px);
  }

  .feedback-modal-title {
    font-size: var(--font-size-lg);
  }

  .feedback-field input,
  .feedback-field textarea {
    padding: 10px 14px;
    font-size: 1rem;
  }

  .feedback-submit-btn {
    padding: 12px 20px;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .feedback-btn {
    padding: 7px 14px;
    font-size: 0.8rem;
  }
}

/* ============================================
   Homepage CTA Button (Boulder Bubble)
   Floating button to return to homepage
   ============================================ */

/* CSS Variables for Homepage Button */
:root {
  --homepage-button-size: 56px;
  --homepage-button-size-mobile: 48px;
  --homepage-offset-bottom: 24px;
  --homepage-offset-right: 24px;
  --homepage-offset-bottom-mobile: 80px;
  --homepage-offset-right-mobile: 16px;
  --homepage-glow-color: rgba(50, 50, 50, 0.4);
  --homepage-glow-color-strong: rgba(80, 80, 80, 0.6);
  --homepage-float-duration: 3s;
  --homepage-float-distance: 6px;
  --homepage-transition-speed: 0.3s;
}

/* Main Button */
.homepage-cta-button {
  position: fixed;
  bottom: var(--homepage-offset-bottom);
  right: var(--homepage-offset-right);
  z-index: 999997;

  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--homepage-button-size);
  height: var(--homepage-button-size);
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(200, 200, 200, 0.5);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 0 0 var(--homepage-glow-color),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  text-decoration: none;
  outline: none;
  overflow: hidden;

  /* Floating animation */
  animation: homepage-float var(--homepage-float-duration) ease-in-out infinite;
  animation-delay: 0.2s;

  /* Smooth transitions */
  transition:
    transform var(--homepage-transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow var(--homepage-transition-speed) ease,
    border-color var(--homepage-transition-speed) ease;
}

/* Floating Animation */
@keyframes homepage-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(calc(-1 * var(--homepage-float-distance)));
  }
}

/* Stop animation for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .homepage-cta-button {
    animation: none;
  }

  .homepage-cta-glow {
    animation: none !important;
  }
}

/* Glow Effect (Behind Button) */
.homepage-cta-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle,
      var(--homepage-glow-color) 0%,
      transparent 70%);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--homepage-transition-speed) ease;
  pointer-events: none;
}

/* Logo Image - 70% of button size */
.homepage-cta-logo {
  width: calc(var(--homepage-button-size) * 0.7);
  height: calc(var(--homepage-button-size) * 0.7);
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  transition: transform var(--homepage-transition-speed) ease;
  pointer-events: none;
  aspect-ratio: 1 / 1;
  margin: 0;
}

/* Tooltip */
.homepage-cta-tooltip {
  position: absolute;
  right: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: rgba(26, 26, 30, 0.95);
  color: #f5f5f7;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transition:
    opacity var(--homepage-transition-speed) ease,
    visibility var(--homepage-transition-speed) ease,
    transform var(--homepage-transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tooltip arrow */
.homepage-cta-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(26, 26, 30, 0.95);
  box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.1);
  z-index: -1;
}

/* Hover States */
.homepage-cta-button:hover {
  /* Pause float animation on hover */
  animation-play-state: paused;

  /* Scale up 8% */
  transform: translateY(calc(-1 * var(--homepage-float-distance) / 2)) scale(1.08);

  /* Enhanced glow ring - dark/neutral glow for white button */
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 4px rgba(100, 100, 100, 0.3),
    0 0 30px 8px rgba(100, 100, 100, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);

  border-color: rgba(150, 150, 150, 0.6);
}

.homepage-cta-button:hover .homepage-cta-glow {
  opacity: 0.5;
  animation: homepage-glow-pulse 2s ease-in-out infinite;
}

@keyframes homepage-glow-pulse {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

.homepage-cta-button:hover .homepage-cta-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.homepage-cta-button:hover .homepage-cta-logo {
  transform: scale(1.02);
}

/* Focus States (Accessibility) */
.homepage-cta-button:focus {
  outline: none;
}

.homepage-cta-button:focus-visible {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 0 3px rgba(100, 100, 100, 0.5),
    0 0 0 6px rgba(255, 255, 255, 0.9),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);

  animation-play-state: paused;
  transform: translateY(calc(-1 * var(--homepage-float-distance) / 2)) scale(1.08);
}

.homepage-cta-button:focus-visible .homepage-cta-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.homepage-cta-button:focus-visible .homepage-cta-glow {
  opacity: 0.5;
}

/* Active/Click State */
.homepage-cta-button:active {
  transform: translateY(0) scale(0.96);
  transition-duration: 0.1s;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .homepage-cta-button {
    bottom: 20px;
    right: 20px;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .homepage-cta-button {
    width: var(--homepage-button-size-mobile);
    height: var(--homepage-button-size-mobile);
    bottom: var(--homepage-offset-bottom-mobile);
    right: var(--homepage-offset-right-mobile);
  }

  .homepage-cta-logo {
    width: calc(var(--homepage-button-size-mobile) * 0.7);
    height: calc(var(--homepage-button-size-mobile) * 0.7);
  }

  /* Tooltip above button on mobile */
  .homepage-cta-tooltip {
    right: auto;
    left: 50%;
    top: auto;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(8px);
  }

  .homepage-cta-tooltip::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -6px;
    transform: translateX(-50%) rotate(45deg);
  }

  .homepage-cta-button:hover .homepage-cta-tooltip,
  .homepage-cta-button:focus-visible .homepage-cta-tooltip {
    transform: translateX(-50%) translateY(0);
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .homepage-cta-button {
    bottom: 90px;
    width: 44px;
    height: 44px;
  }

  .homepage-cta-logo {
    width: calc(44px * 0.7);
    height: calc(44px * 0.7);
  }

  .homepage-cta-tooltip {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .homepage-cta-button {
    bottom: 16px;
    width: 40px;
    height: 40px;
  }

  .homepage-cta-logo {
    width: calc(40px * 0.7);
    height: calc(40px * 0.7);
  }
}

/* Safe area insets for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .homepage-cta-button {
    bottom: calc(var(--homepage-offset-bottom) + env(safe-area-inset-bottom, 0px));
    right: calc(var(--homepage-offset-right) + env(safe-area-inset-right, 0px));
  }
}

/* Print - hide button */
@media print {
  .homepage-cta-button {
    display: none !important;
  }
}

/* ============================================
   Boulder Bubble CTA Button (Bottom Left)
   Floating button to return to homepage
   ============================================ */

/* CSS Variables for Boulder Bubble Button */
:root {
  --bb-button-size: 56px;
  --bb-button-size-mobile: 48px;
  --bb-offset-bottom: 24px;
  --bb-offset-left: 24px;
  --bb-offset-bottom-mobile: 80px;
  --bb-offset-left-mobile: 16px;
  --bb-glow-color: rgba(50, 50, 50, 0.4);
  --bb-float-duration: 3s;
  --bb-float-distance: 6px;
  --bb-transition-speed: 0.3s;
}

/* Main Button */
.boulder-bubble-cta-button {
  position: fixed;
  bottom: var(--bb-offset-bottom);
  left: var(--bb-offset-left);
  z-index: 999997;

  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--bb-button-size);
  height: var(--bb-button-size);
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(200, 200, 200, 0.5);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 0 0 var(--bb-glow-color),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  text-decoration: none;
  outline: none;

  /* Floating animation */
  animation: bb-float var(--bb-float-duration) ease-in-out infinite;
  animation-delay: 0.2s;

  /* Smooth transitions */
  transition:
    transform var(--bb-transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow var(--bb-transition-speed) ease,
    border-color var(--bb-transition-speed) ease;
}

/* Floating Animation */
@keyframes bb-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(calc(-1 * var(--bb-float-distance)));
  }
}

/* Stop animation for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .boulder-bubble-cta-button {
    animation: none;
  }

  .boulder-bubble-cta-glow {
    animation: none !important;
  }
}

/* Glow Effect (Behind Button) */
.boulder-bubble-cta-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle,
      var(--bb-glow-color) 0%,
      transparent 70%);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--bb-transition-speed) ease;
  pointer-events: none;
}

/* Logo Image - 70% of button size */
.boulder-bubble-cta-logo {
  width: calc(var(--bb-button-size) * 0.7);
  height: calc(var(--bb-button-size) * 0.7);
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  transition: transform var(--bb-transition-speed) ease;
  pointer-events: none;
  aspect-ratio: 1 / 1;
  margin: 0;
}

/* Tooltip - Appears on the RIGHT of button (since button is on left) */
.boulder-bubble-cta-tooltip {
  position: absolute;
  left: calc(100% + 16px);
  right: auto;
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
  z-index: 1000000;
  background: rgba(26, 26, 30, 0.95);
  color: #f5f5f7;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transition:
    opacity var(--bb-transition-speed) ease,
    visibility var(--bb-transition-speed) ease,
    transform var(--bb-transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tooltip arrow - points LEFT towards button */
.boulder-bubble-cta-tooltip::after {
  content: '';
  position: absolute;
  left: -6px;
  right: auto;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(26, 26, 30, 0.95);
  box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.1);
  z-index: -1;
}

/* Hover States */
.boulder-bubble-cta-button:hover {
  /* Pause float animation on hover */
  animation-play-state: paused;

  /* Scale up 8% */
  transform: translateY(calc(-1 * var(--bb-float-distance) / 2)) scale(1.08);

  /* Enhanced glow ring - dark/neutral glow for white button */
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 4px rgba(100, 100, 100, 0.3),
    0 0 30px 8px rgba(100, 100, 100, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);

  border-color: rgba(150, 150, 150, 0.6);
}

.boulder-bubble-cta-button:hover .boulder-bubble-cta-glow {
  opacity: 0.5;
  animation: bb-glow-pulse 2s ease-in-out infinite;
}

@keyframes bb-glow-pulse {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

.boulder-bubble-cta-button:hover .boulder-bubble-cta-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.boulder-bubble-cta-button:hover .boulder-bubble-cta-logo {
  transform: scale(1.02);
}

/* Focus States (Accessibility) */
.boulder-bubble-cta-button:focus {
  outline: none;
}

.boulder-bubble-cta-button:focus-visible {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 0 3px rgba(100, 100, 100, 0.5),
    0 0 0 6px rgba(255, 255, 255, 0.9),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);

  animation-play-state: paused;
  transform: translateY(calc(-1 * var(--bb-float-distance) / 2)) scale(1.08);
}

.boulder-bubble-cta-button:focus-visible .boulder-bubble-cta-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.boulder-bubble-cta-button:focus-visible .boulder-bubble-cta-glow {
  opacity: 0.5;
}

/* Active/Click State */
.boulder-bubble-cta-button:active {
  transform: translateY(0) scale(0.96);
  transition-duration: 0.1s;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .boulder-bubble-cta-button {
    bottom: 20px;
    left: 20px;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .boulder-bubble-cta-button {
    width: var(--bb-button-size-mobile);
    height: var(--bb-button-size-mobile);
    bottom: var(--bb-offset-bottom-mobile);
    left: var(--bb-offset-left-mobile);
  }

  .boulder-bubble-cta-logo {
    width: calc(var(--bb-button-size-mobile) * 0.7);
    height: calc(var(--bb-button-size-mobile) * 0.7);
  }

  /* Tooltip above button on mobile */
  .boulder-bubble-cta-tooltip {
    right: auto;
    left: 50%;
    top: auto;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(8px);
  }

  .boulder-bubble-cta-tooltip::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -6px;
    transform: translateX(-50%) rotate(45deg);
  }

  .boulder-bubble-cta-button:hover .boulder-bubble-cta-tooltip,
  .boulder-bubble-cta-button:focus-visible .boulder-bubble-cta-tooltip {
    transform: translateX(-50%) translateY(0);
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .boulder-bubble-cta-button {
    bottom: 90px;
    width: 44px;
    height: 44px;
  }

  .boulder-bubble-cta-logo {
    width: calc(44px * 0.7);
    height: calc(44px * 0.7);
  }

  .boulder-bubble-cta-tooltip {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .boulder-bubble-cta-button {
    bottom: 16px;
    width: 40px;
    height: 40px;
  }

  .boulder-bubble-cta-logo {
    width: calc(40px * 0.7);
    height: calc(40px * 0.7);
  }
}

/* Safe area insets for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .boulder-bubble-cta-button {
    bottom: calc(var(--bb-offset-bottom) + env(safe-area-inset-bottom, 0px));
    left: calc(var(--bb-offset-left) + env(safe-area-inset-left, 0px));
  }
}

/* Print - hide button */
@media print {
  .boulder-bubble-cta-button {
    display: none !important;
  }
}