/* ========================================
   KINTSUGI MIND - Wa Design System
   The Japanese Art of Resilience
   ======================================== */

/* ========================================
   CSS Variables for Theme
   ======================================== */
:root {
  /* Light mode colors */
  --bg-primary: #f5f0e8;
  --bg-secondary: #faf8f4;
  --bg-elevated: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #424242;
  --text-muted: #757575;
  --border-color: rgba(201, 162, 39, 0.3);
  --shadow-color: rgba(30, 58, 95, 0.1);
  --gold-accent: #c9a227;
  --gold-glow: rgba(201, 162, 39, 0.6);
}

.dark {
  /* Dark mode colors - Japanese night aesthetic */
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-elevated: #2d2d2d;
  --text-primary: #e8e4dc;
  --text-secondary: #a8a29e;
  --text-muted: #78716c;
  --border-color: rgba(201, 162, 39, 0.4);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --gold-accent: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.8);
}

/* ========================================
   Dark Mode Overrides
   ======================================== */

/* Scrollbar - Dark Mode */
.dark ::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.dark ::-webkit-scrollbar-thumb {
  background: #4a4a4a;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

/* Cloud Styles - Dark Mode */
.dark .cloud {
  background: linear-gradient(135deg, rgba(60, 60, 60, 0.9), rgba(40, 40, 40, 0.7));
  box-shadow: 
    inset 0 -3px 10px rgba(0, 0, 0, 0.3),
    0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Sky Section - Dark Mode */
.dark .sky-section {
  background: linear-gradient(180deg, 
    #1a1a2e 0%,
    #16213e 50%,
    #1e1e1e 100%
  );
}

/* Ground Section - Dark Mode */
.dark .ground-section {
  background: linear-gradient(180deg,
    #1e1e1e 0%,
    #2a2a2a 30%,
    #1e1e1e 100%
  );
}

/* Horizon Line - Dark Mode */
.dark .horizon-line {
  background: linear-gradient(90deg,
    transparent 0%,
    #4a4a4a 20%,
    #4a4a4a 80%,
    transparent 100%
  );
}

/* Breathing Circle - Dark Mode */
.dark .breathing-circle {
  background: radial-gradient(circle, 
    rgba(212, 175, 55, 0.3) 0%,
    rgba(212, 175, 55, 0.15) 50%,
    transparent 70%
  );
}

/* Room Card Hover - Dark Mode */
.dark .room-card::before {
  background: linear-gradient(135deg,
    rgba(212, 175, 55, 0) 0%,
    rgba(212, 175, 55, 0.15) 100%
  );
}

.dark .room-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* Vessel - Dark Mode */
.dark .vessel {
  background: linear-gradient(180deg, #3d3d3d 0%, #2a2a2a 100%);
}

.dark .vessel-crack {
  border-left-color: #333;
}

.dark .vessel-crack.repaired {
  border-left-color: #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
}

/* Gold effects - Dark Mode enhanced glow */
.dark .gold-glow {
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.9));
}

.dark .gradient-gold {
  background: linear-gradient(135deg, #d4af37 0%, #c9a227 50%, #a6851f 100%);
}

.dark .text-gradient-gold {
  background: linear-gradient(135deg, #d4af37 0%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Shadow adjustments - Dark Mode */
.dark .shadow-wabi {
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.3),
    0 10px 20px rgba(0, 0, 0, 0.2);
}

.dark .shadow-wabi-lg {
  box-shadow: 
    0 10px 15px rgba(0, 0, 0, 0.4),
    0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Chat Bubble - Dark Mode */
.dark .chat-bubble {
  background-color: #2d2d2d;
  color: #e8e4dc;
}

.dark .chat-bubble.user {
  background-color: #1e3a5f;
}

/* Form inputs - Dark Mode */
.dark input,
.dark textarea,
.dark select {
  background-color: #2d2d2d;
  border-color: #4a4a4a;
  color: #e8e4dc;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #78716c;
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
  border-color: #d4af37;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

/* Button adjustments - Dark Mode */
.dark button {
  transition: all 0.2s ease;
}

/* Mandala - Dark Mode */
.dark .mandala-ring {
  border-color: rgba(212, 175, 55, 0.4);
}

.dark .connection-dot {
  background: linear-gradient(135deg, #d4af37, #c9a227);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.7);
}

/* ========================================
   Dark Mode Toggle Button
   ======================================== */
.dark-mode-toggle {
  position: relative;
  width: 48px;
  height: 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d9e2ec 0%, #bcccdc 100%);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

.dark .dark-mode-toggle {
  background: linear-gradient(135deg, #1e3a5f 0%, #0d1f33 100%);
}

.dark-mode-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f9e49b 0%, #c9a227 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.dark .dark-mode-toggle::after {
  left: 26px;
  background: linear-gradient(135deg, #e8e4dc 0%, #a8a29e 100%);
}

/* Sun/Moon icon inside toggle */
.dark-mode-toggle .icon-sun,
.dark-mode-toggle .icon-moon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  transition: opacity 0.3s ease;
}

.dark-mode-toggle .icon-sun {
  left: 6px;
  opacity: 1;
}

.dark-mode-toggle .icon-moon {
  right: 6px;
  opacity: 0.5;
}

.dark .dark-mode-toggle .icon-sun {
  opacity: 0.5;
}

.dark .dark-mode-toggle .icon-moon {
  opacity: 1;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Typography
   ======================================== */
.text-balance {
  text-wrap: balance;
}

.writing-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* ========================================
   Zen Garden Animations
   ======================================== */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(201, 162, 39, 0.3);
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ========================================
   Cloud (Anxiety) Styles - Sky Section
   ======================================== */
.cloud {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(230, 230, 230, 0.7));
  border-radius: 50px;
  box-shadow: 
    inset 0 -3px 10px rgba(0, 0, 0, 0.1),
    0 5px 15px rgba(0, 0, 0, 0.1);
  animation: float 6s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  width: 60%;
  height: 80%;
  top: -40%;
  left: 15%;
}

.cloud::after {
  width: 40%;
  height: 60%;
  top: -30%;
  right: 15%;
}

/* ========================================
   Plant Growth - Ground Section
   ======================================== */
.plant {
  position: relative;
  transform-origin: bottom center;
}

.plant-stem {
  width: 3px;
  background: linear-gradient(to top, #4a7c59, #6b9b7a);
  border-radius: 2px;
  transform-origin: bottom center;
}

.plant-leaf {
  position: absolute;
  width: 20px;
  height: 10px;
  background: linear-gradient(135deg, #6b9b7a, #4a7c59);
  border-radius: 50% 0 50% 0;
  transform-origin: left center;
}

.plant-leaf.right {
  transform: scaleX(-1);
  transform-origin: right center;
}

/* ========================================
   Kintsugi Vessel Styles
   ======================================== */
.vessel {
  position: relative;
  background: linear-gradient(180deg, #d4c4b0 0%, #a89880 100%);
  border-radius: 0 0 50% 50% / 0 0 30% 30%;
}

.vessel-crack {
  position: absolute;
  background: transparent;
  border-left: 2px solid #1a1a1a;
}

.vessel-crack.repaired {
  border-left-color: #c9a227;
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.6);
}

/* Golden repair glow effect */
.gold-glow {
  filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.8));
}

/* ========================================
   Weather Icons
   ======================================== */
.weather-icon {
  transition: all 0.3s ease;
  cursor: pointer;
}

.weather-icon:hover {
  transform: scale(1.1);
}

.weather-icon.selected {
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(201, 162, 39, 0.5));
}

/* Sun */
.weather-sun {
  background: linear-gradient(135deg, #f9e49b 0%, #c9a227 100%);
  border-radius: 50%;
}

/* Cloudy */
.weather-cloudy {
  background: linear-gradient(135deg, #e0e0e0 0%, #9e9e9e 100%);
  border-radius: 20px;
}

/* Rain */
.weather-rain {
  position: relative;
}

.rain-drop {
  position: absolute;
  width: 3px;
  height: 10px;
  background: linear-gradient(to bottom, transparent, #627d98);
  border-radius: 0 0 50% 50%;
  animation: rain-fall 1s linear infinite;
}

@keyframes rain-fall {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(20px);
    opacity: 0;
  }
}

/* Storm */
.weather-storm {
  background: linear-gradient(135deg, #334e68 0%, #1e3a5f 100%);
  border-radius: 20px;
}

/* ========================================
   Split Screen Layout
   ======================================== */
.split-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.sky-section {
  flex: 1;
  background: linear-gradient(180deg, 
    #d9e2ec 0%,
    #f0f4f8 50%,
    #faf8f4 100%
  );
  position: relative;
  overflow: hidden;
}

.ground-section {
  flex: 1;
  background: linear-gradient(180deg,
    #f5f0e8 0%,
    #ebe3d5 30%,
    #ddd2be 100%
  );
  position: relative;
}

.horizon-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    #c9b99c 20%,
    #c9b99c 80%,
    transparent 100%
  );
}

/* ========================================
   Breathing Guide
   ======================================== */
.breathing-circle {
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle, 
    rgba(201, 162, 39, 0.2) 0%,
    rgba(201, 162, 39, 0.1) 50%,
    transparent 70%
  );
}

.breathing-circle.inhale {
  animation: breathe-in 4s ease-in-out forwards;
}

.breathing-circle.exhale {
  animation: breathe-out 4s ease-in-out forwards;
}

@keyframes breathe-in {
  0% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes breathe-out {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
}

/* ========================================
   Tea House Navigation
   ======================================== */
.room-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.room-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(201, 162, 39, 0) 0%,
    rgba(201, 162, 39, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.room-card:hover::before {
  opacity: 1;
}

.room-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(30, 58, 95, 0.15);
}

/* ========================================
   Mandala Connection Visualization
   ======================================== */
.mandala-ring {
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.3);
  animation: rotate-slow 30s linear infinite;
}

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

.connection-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #c9a227, #a6851f);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
}

/* ========================================
   Scrollbar Styling
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f0e8;
}

::-webkit-scrollbar-thumb {
  background: #c9b99c;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b09e7d;
}

/* ========================================
   Focus States
   ======================================== */
:focus-visible {
  outline: 2px solid #c9a227;
  outline-offset: 2px;
}

/* ========================================
   Utility Classes
   ======================================== */
.gradient-gold {
  background: linear-gradient(135deg, #f9e49b 0%, #c9a227 50%, #a6851f 100%);
}

.text-gradient-gold {
  background: linear-gradient(135deg, #c9a227 0%, #a6851f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.border-wabi {
  border: 1px solid rgba(201, 162, 39, 0.3);
}

.shadow-wabi {
  box-shadow: 
    0 4px 6px rgba(30, 58, 95, 0.07),
    0 10px 20px rgba(30, 58, 95, 0.05);
}

.shadow-wabi-lg {
  box-shadow: 
    0 10px 15px rgba(30, 58, 95, 0.1),
    0 20px 40px rgba(30, 58, 95, 0.08);
}

/* ========================================
   Chat Interface
   ======================================== */
.chat-bubble {
  position: relative;
  border-radius: 16px 16px 16px 4px;
}

.chat-bubble.user {
  border-radius: 16px 16px 4px 16px;
}

.chat-bubble::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: inherit;
}

/* ========================================
   Form Validation
   ======================================== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.shake-animation {
  animation: shake 0.4s ease-in-out;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 640px) {
  .split-screen {
    min-height: 100vh;
    height: auto;
  }
  
  .sky-section,
  .ground-section {
    min-height: 50vh;
  }
}

/* ========================================
   Onboarding Animations
   ======================================== */

/* Floating animation for vessel emoji */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* Draw crack animation */
@keyframes draw-crack {
  to {
    stroke-dashoffset: 0;
  }
}

.animate-draw-crack {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw-crack 2s ease-out forwards;
}

/* Step transition */
.onboarding-step {
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.onboarding-step.opacity-0 {
  transform: translateX(20px);
}

.onboarding-step.opacity-100 {
  transform: translateX(0);
}

/* Vessel selection hover effect */
.vessel-option {
  transition: all 0.3s ease;
}

.vessel-option:hover {
  transform: translateY(-4px);
}

.vessel-option.selected {
  border-color: var(--gold-accent);
  box-shadow: 0 0 20px var(--gold-glow);
}

/* Progress dots animation */
#onboarding-container [id^="dot-"] {
  transition: all 0.3s ease;
}

/* Gold text gradient */
.text-gradient-gold {
  background: linear-gradient(135deg, #c9a227 0%, #e8d479 50%, #c9a227 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dark .text-gradient-gold {
  background: linear-gradient(135deg, #d4af37 0%, #f5e6a3 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Pulse effect for selected vessel */
@keyframes vessel-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(201, 162, 39, 0);
  }
}

.vessel-option.ring-2 {
  animation: vessel-pulse 2s infinite;
}
