/* K-Sleep Care - Dark Mode Sleep Apnea Design */
/* Keep English content, apply dark mode design with sleep goal visualization */

:root {
  /* Dark Mode Colors - Planfit Style */
  --dark-bg: #1c1c1e;
  --dark-bg-secondary: #2c2c2e;
  --dark-bg-tertiary: #3a3a3c;
  --dark-text: #ffffff;
  --dark-text-secondary: #8e8e93;
  --dark-border: #38383a;
  
  /* Accent Colors - Warm Purple Theme */
  --accent-primary: #9d8fd9;
  --accent-secondary: #8b7dd6;
  --accent-gradient: linear-gradient(135deg, #9d8fd9 0%, #8b7dd6 100%);
  
  /* Sleep Health Colors */
  --sleep-good: #9d8fd9;
  --sleep-warning: #ffd93d;
  --sleep-danger: #ff6b6b;
  
  /* Spacing - More Breathing Room */
  --space-xs: 0.5rem;
  --space-sm: 0.875rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 2.5rem;
  --space-2xl: 3.5rem;
  --space-3xl: 4rem;
  
  /* Border Radius - Minimal */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;
  
  /* Typography - Reduced Sizes */
  --font-title: 1.375rem;
  --font-subtitle: 0.9375rem;
  --font-body: 0.875rem;
  --font-small: 0.8125rem;
}

/* Apply Dark Mode to Body */
body.sleep-dark-mode {
  background: var(--dark-bg);
  color: var(--dark-text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Pretendard', sans-serif;
  font-size: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide Light Mode Nav & Footer */
body.sleep-dark-mode nav,
body.sleep-dark-mode footer {
  display: none !important;
}

/* Back Button - Fixed Top Left */
.back-button-fixed {
  position: fixed;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 200;
  background: transparent;
  border: none;
  color: var(--dark-text);
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-button-fixed:active {
  opacity: 0.6;
}

/* Dark Mode Container - No boxes, clean layout */
body.sleep-dark-mode .module-container {
  background: var(--dark-bg);
  min-height: 100vh;
  padding: 0;
  max-width: 100%;
  margin: 0;
}

/* Content Padding - More Breathing Room */
.content-wrapper {
  padding: 100px var(--space-xl) var(--space-3xl);
  max-width: 480px;
  margin: 0 auto;
}

/* Progress Header - Fixed at Top */
body.sleep-dark-mode .bg-white.shadow-sm {
  background: var(--dark-bg) !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-lg) var(--space-xl);
  box-shadow: none !important;
  border-bottom: none;
}

body.sleep-dark-mode .progress-bar {
  height: 3px;
  background: var(--dark-bg-tertiary);
  border-radius: 0;
  overflow: hidden;
}

body.sleep-dark-mode .progress-bar > div {
  background: var(--accent-primary);
  height: 100%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chat Container - Dark Mode */
body.sleep-dark-mode #interactiveSurveyChat {
  padding-top: 100px;
  padding-bottom: 200px;
  background: transparent;
}

/* Chat Bubbles - Dark Mode */
body.sleep-dark-mode .chat-bubble > div {
  background: var(--dark-bg-secondary) !important;
  color: var(--dark-text) !important;
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* User Messages - Accent Color */
body.sleep-dark-mode .justify-end > div {
  background: var(--accent-gradient) !important;
  color: var(--dark-bg) !important;
  font-weight: 500;
}

/* Bot Messages - Dark Card */
body.sleep-dark-mode .justify-start > div {
  background: var(--dark-bg-secondary) !important;
  color: var(--dark-text) !important;
}

/* Typing Indicator */
body.sleep-dark-mode .typing-indicator {
  background: var(--dark-bg-secondary) !important;
  padding: 1rem 1.25rem;
  border-radius: 1.25rem;
}

body.sleep-dark-mode .typing-indicator span {
  background: var(--accent-primary);
}

/* Fixed Bottom Options Container */
body.sleep-dark-mode .fixed.bottom-0 {
  background: rgba(26, 26, 26, 0.95) !important;
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--dark-border);
  padding: var(--space-lg);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}

/* Option Buttons - Planfit Style (Pill buttons) - Smaller Size */
body.sleep-dark-mode .option-button {
  background: var(--dark-bg-secondary) !important;
  border: 1px solid var(--dark-border) !important;
  color: var(--dark-text) !important;
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  font-weight: 400;
  font-size: 0.8125rem;
  white-space: nowrap;
}

body.sleep-dark-mode .option-button:active {
  transform: scale(0.97);
  opacity: 0.8;
}

body.sleep-dark-mode .option-button.selected {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #000000 !important;
  font-weight: 500;
}

body.sleep-dark-mode .option-button i {
  display: none;
}

/* Title Typography - Planfit Style */
.page-title {
  font-size: var(--font-title);
  font-weight: 600;
  color: var(--dark-text);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.page-subtitle {
  font-size: var(--font-small);
  font-weight: 400;
  color: var(--dark-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-2xl);
}

/* Welcome Screen - No Boxes */
body.sleep-dark-mode .bg-white {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

body.sleep-dark-mode .welcome-header {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: var(--space-xl);
}

body.sleep-dark-mode .text-gray-800,
body.sleep-dark-mode .text-gray-900,
body.sleep-dark-mode h1,
body.sleep-dark-mode h2,
body.sleep-dark-mode h3 {
  color: var(--dark-text) !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
}

body.sleep-dark-mode .text-gray-600,
body.sleep-dark-mode .text-gray-500,
body.sleep-dark-mode p {
  color: var(--dark-text-secondary) !important;
  font-weight: 400;
}

/* Primary Button - Planfit Style */
body.sleep-dark-mode .btn-primary,
body.sleep-dark-mode button.bg-blue-600,
body.sleep-dark-mode .bg-blue-600 {
  background: var(--accent-primary) !important;
  color: #000000 !important;
  border: none;
  border-radius: var(--radius-full);
  padding: 1.125rem 2rem;
  font-weight: 600;
  font-size: 1.0625rem;
  box-shadow: none;
  transition: all 0.2s ease;
  width: 100%;
  max-width: none;
}

body.sleep-dark-mode .btn-primary:active,
body.sleep-dark-mode button.bg-blue-600:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Fixed Bottom Button Container */
.fixed-bottom-button {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--dark-bg);
  padding: var(--space-lg) var(--space-xl) calc(var(--space-xl) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--dark-border);
  z-index: 150;
}

/* Feature Cards - Minimal, No Background */
body.sleep-dark-mode .flex.items-start {
  background: transparent !important;
  border-radius: 0;
  padding: var(--space-lg) 0;
  box-shadow: none;
  border-bottom: 1px solid var(--dark-border);
}

body.sleep-dark-mode .flex.items-start:last-child {
  border-bottom: none;
}

body.sleep-dark-mode .bg-blue-100,
body.sleep-dark-mode .bg-green-100,
body.sleep-dark-mode .bg-purple-100,
body.sleep-dark-mode .bg-orange-100 {
  background: transparent !important;
  border: 1px solid var(--dark-border);
}

body.sleep-dark-mode .text-blue-600,
body.sleep-dark-mode .text-green-600,
body.sleep-dark-mode .text-purple-600,
body.sleep-dark-mode .text-orange-600 {
  color: var(--accent-primary) !important;
}

/* Icons */
body.sleep-dark-mode i.fa-moon,
body.sleep-dark-mode i.fa-heart-pulse,
body.sleep-dark-mode i.fa-battery-full,
body.sleep-dark-mode i.fa-brain {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sleep Goal Visualization - No Background Box */
.sleep-goal-visualization {
  background: transparent;
  border-radius: 0;
  padding: var(--space-2xl) 0;
  margin: var(--space-3xl) 0;
  box-shadow: none;
}

.sleep-goal-title {
  font-size: var(--font-title);
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: var(--space-md);
  text-align: left;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.sleep-goal-subtitle {
  font-size: var(--font-small);
  color: var(--dark-text-secondary);
  text-align: left;
  margin-bottom: var(--space-2xl);
  line-height: 1.6;
  font-weight: 400;
}

/* Sleep Quality Chart */
.sleep-quality-chart {
  position: relative;
  height: 200px;
  margin-bottom: var(--space-xl);
}

.chart-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chart-grid-line {
  height: 1px;
  background: var(--dark-border);
  width: 100%;
}

.chart-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-md);
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.chart-label {
  font-size: 0.75rem;
  color: var(--dark-text-secondary);
  margin-top: var(--space-sm);
  text-align: center;
}

.chart-bar {
  width: 100%;
  max-width: 40px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  transition: all 0.5s ease;
}

.chart-bar.before {
  background: var(--sleep-danger);
  opacity: 0.6;
}

.chart-bar.after {
  background: var(--accent-gradient);
  box-shadow: 0 -4px 20px rgba(157, 143, 217, 0.5);
}

.chart-value {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--dark-text);
  white-space: nowrap;
}

/* Sleep Metrics Grid */
.sleep-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.sleep-metric-card {
  background: var(--dark-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.metric-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-text);
  margin-bottom: var(--space-xs);
}

.metric-label {
  font-size: 0.875rem;
  color: var(--dark-text-secondary);
}

.metric-change {
  font-size: 0.75rem;
  color: var(--sleep-good);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* Sleep Timeline */
.sleep-timeline {
  position: relative;
  padding: var(--space-xl) 0;
}

.timeline-line {
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-gradient);
}

.timeline-item {
  position: relative;
  padding-left: 50px;
  margin-bottom: var(--space-xl);
}

.timeline-dot {
  position: absolute;
  left: 11px;
  top: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 3px solid var(--dark-bg);
  box-shadow: 0 0 0 3px var(--dark-bg-secondary);
}

.timeline-content {
  background: var(--dark-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.timeline-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: var(--space-xs);
}

.timeline-description {
  font-size: 0.875rem;
  color: var(--dark-text-secondary);
  line-height: 1.6;
}

/* Health Priority Cards with Icons */
.priority-card {
  background: var(--dark-bg-secondary);
  border: 2px solid var(--dark-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.priority-card:active {
  transform: scale(0.98);
}

.priority-card.selected {
  border-color: var(--accent-primary);
  background: var(--dark-bg-tertiary);
  box-shadow: 0 4px 20px rgba(157, 143, 217, 0.3);
}

.priority-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--dark-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.priority-card.selected .priority-icon-wrapper {
  background: var(--accent-gradient);
}

.priority-icon {
  font-size: 1.5rem;
  color: var(--accent-primary);
}

.priority-card.selected .priority-icon {
  color: var(--dark-bg);
}

.priority-content {
  flex: 1;
}

.priority-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: var(--space-xs);
}

.priority-description {
  font-size: 0.875rem;
  color: var(--dark-text-secondary);
  line-height: 1.5;
}

/* Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: slideInUp 0.5s ease-out;
}

/* Scrollbar Dark Mode */
body.sleep-dark-mode ::-webkit-scrollbar {
  width: 6px;
}

body.sleep-dark-mode ::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

body.sleep-dark-mode ::-webkit-scrollbar-thumb {
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

/* Input Fields Dark Mode */
body.sleep-dark-mode input[type="text"],
body.sleep-dark-mode input[type="number"],
body.sleep-dark-mode input[type="email"],
body.sleep-dark-mode select,
body.sleep-dark-mode textarea {
  background: var(--dark-bg-secondary) !important;
  border: 2px solid var(--dark-border) !important;
  color: var(--dark-text) !important;
  border-radius: var(--radius-lg);
}

body.sleep-dark-mode input:focus,
body.sleep-dark-mode select:focus,
body.sleep-dark-mode textarea:focus {
  border-color: var(--accent-primary) !important;
  outline: none;
}

/* Alert Boxes Dark Mode */
body.sleep-dark-mode .bg-blue-50 {
  background: var(--dark-bg-tertiary) !important;
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  color: var(--dark-text) !important;
}

body.sleep-dark-mode .text-blue-700 {
  color: var(--accent-primary) !important;
}

/* Loading Spinner Dark Mode */
body.sleep-dark-mode .spinner,
body.sleep-dark-mode #app-loader > div > div {
  border-color: var(--dark-bg-secondary) !important;
  border-top-color: var(--accent-primary) !important;
}
