/* ==========================================
   Google DeepMind MedGemma Style - CSS
   Clean, Minimal, Professional
   ========================================== */

/* 폰트 임포트 - Google Sans / Product Sans 스타일 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap');

/* 전역 변수 - MedGemma 스타일 */
:root {
  /* 주요 색상 - 모노크롬 + 미세한 블루 악센트 */
  --primary: #1a1a1a;
  --primary-light: #3a3a3a;
  --primary-dark: #000000;
  
  /* 악센트 색상 */
  --accent: #4285f4;
  --accent-hover: #357ae8;
  
  /* 중성 색상 */
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  
  /* 배경 색상 */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  
  /* 텍스트 색상 */
  --text-primary: #1a1a1a;
  --text-secondary: #5f6368;
  --text-tertiary: #9aa0a6;
  --text-white: #ffffff;
  
  /* 그림자 - 매우 미세하게 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px 0 rgba(0, 0, 0, 0.08);
}

/* 기본 스타일 */
* {
  font-family: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ==========================================
   배경 스타일 - 순수한 화이트
   ========================================== */

.gradient-bg {
  background: var(--bg-primary);
  position: relative;
  min-height: 100vh;
  padding: 80px 0;
}

.chat-gradient {
  background: var(--bg-primary);
}

/* ==========================================
   타이포그래피 - 깔끔하고 읽기 쉽게
   ========================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 {
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--text-primary);
}

h2 {
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-primary);
}

p {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* ==========================================
   카드 스타일 - 미니멀하고 깔끔하게
   ========================================== */

.card {
  background: var(--bg-primary);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--gray-300);
}

/* ==========================================
   버튼 스타일 - Google 스타일
   ========================================== */

.btn-primary {
  background: var(--primary);
  color: var(--text-white);
  padding: 12px 32px;
  border-radius: 24px;
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: var(--shadow);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  padding: 12px 32px;
  border-radius: 24px;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--gray-300);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

/* ==========================================
   아이콘 스타일 - 심플하게
   ========================================== */

.icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #4285f4 0%, #9b51e0 50%, #ec407a 100%);
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  position: relative;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25);
}

.icon-wrapper::after {
  content: '✨';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 1.25rem;
  animation: sparkle 2s ease-in-out infinite;
}

.icon-wrapper.blue {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
}

.icon-wrapper.green {
  background: linear-gradient(135deg, #34a853 0%, #fbbc04 100%);
}

.card:hover .icon-wrapper {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(66, 133, 244, 0.35);
}

.feature-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.feature-icon.blue {
  background: rgba(66, 133, 244, 0.1);
  color: var(--accent);
}

.feature-icon.green {
  background: rgba(52, 168, 83, 0.1);
  color: #34a853;
}

/* ==========================================
   채팅 인터페이스 - 깔끔한 디자인
   ========================================== */

/* 채팅 헤더 */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.header.blue {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
}

.header.green {
  background: linear-gradient(135deg, #34a853 0%, #fbbc04 100%);
}

.icon-header {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  border: 1px solid;
}

.btn-ghost {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-container {
  background: var(--bg-primary);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.chat-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--gray-200);
  padding: 20px 24px;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(52, 168, 83, 0.1);
  color: #34a853;
  font-size: 0.8125rem;
  font-weight: 500;
}

.chat-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34a853;
}

/* AI 아바타 */
.ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4 0%, #9b51e0 50%, #ec407a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  font-size: 1rem;
  font-weight: 600;
  position: relative;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.ai-avatar::before {
  content: '✨';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.75rem;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2) rotate(180deg);
  }
}

/* 메시지 버블 - 미니멀하게 */
.message-bubble {
  max-width: 85%;
  padding: 20px 24px;
  border-radius: 16px;
  line-height: 1.7;
  font-size: 0.9375rem;
}

.message-bubble.user {
  background: var(--gray-900);
  color: var(--text-white);
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.message-bubble.assistant {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

/* 입력 영역 */
.input-area {
  background: var(--bg-primary);
  border-top: 1px solid var(--gray-200);
  padding: 20px 24px;
}

.input-area input {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-300);
  border-radius: 24px;
  padding: 12px 20px;
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.input-area input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  transform: none;
}

/* ==========================================
   타이핑 인디케이터 - 미니멀
   ========================================== */

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--gray-100);
  border-radius: 18px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-500);
  animation: typing 1.4s ease-in-out infinite;
}

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

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

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

/* ==========================================
   차트 컨테이너 - 깔끔하게
   ========================================== */

.chart-container {
  background: var(--bg-primary);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 24px;
  margin: 20px 0;
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================
   로딩 스피너 - Google 스타일
   ========================================== */

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   Markdown 스타일 - 일관된 폰트 크기, 명확한 제목
   ========================================== */

.markdown h1, .markdown h2, .markdown h3 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 700;
}

.markdown h1 {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 32px;
  margin-top: 0;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--gray-200);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.markdown h2 {
  font-size: 1.375rem;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 20px;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.1) 0%, rgba(52, 168, 83, 0.1) 100%);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  letter-spacing: -0.01em;
}

.markdown h2:first-of-type {
  margin-top: 24px;
}

.markdown h3 {
  display: none;
}

.markdown p {
  margin: 12px 0;
  line-height: 1.75;
  color: var(--text-primary);
  font-size: 1rem;
}

.markdown ul, .markdown ol {
  margin: 18px 0;
  padding-left: 0;
  list-style: none;
}

.markdown ul li {
  margin: 10px 0;
  padding: 10px 14px 10px 32px;
  position: relative;
  color: var(--text-primary);
  line-height: 1.65;
  background: transparent;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.markdown ul li:hover {
  background: rgba(249, 250, 251, 0.5);
}

.markdown ul li::before {
  content: '•';
  position: absolute;
  left: 14px;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.2em;
}

.markdown ol {
  counter-reset: item;
  padding-left: 0;
}

.markdown ol li {
  margin: 10px 0;
  padding: 10px 14px 10px 38px;
  position: relative;
  color: var(--text-primary);
  line-height: 1.65;
  counter-increment: item;
  background: transparent;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.markdown ol li:hover {
  background: rgba(249, 250, 251, 0.5);
}

.markdown ol li::before {
  content: counter(item) ".";
  position: absolute;
  left: 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  min-width: 18px;
}

.markdown code {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.08) 0%, rgba(66, 133, 244, 0.12) 100%);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 1rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  color: var(--accent);
  border: 1px solid rgba(66, 133, 244, 0.15);
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
  margin: 2px;
}

.markdown pre {
  background: var(--gray-100);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.markdown strong {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.markdown blockquote {
  border-left: 3px solid var(--gray-300);
  padding-left: 14px;
  margin: 14px 0;
  color: var(--text-secondary);
  font-style: italic;
  font-size: 1rem;
}

.markdown hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 28px 0;
  opacity: 0.5;
}

/* 소제목 영역 - 명확한 구분 */
.markdown .metric-section {
  background: rgba(249, 250, 251, 0.6);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 8px;
}

.markdown .metric-section strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.markdown .metric-section p {
  margin-top: 10px;
  font-size: 1rem;
  color: var(--text-primary);
}

/* ==========================================
   애니메이션 - 부드럽고 자연스럽게
   ========================================== */

.animate-fadeIn {
  animation: fadeIn 0.4s ease-out;
}

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


.animate-slideIn {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================
   스크롤바 스타일 - 미니멀하게
   ========================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* ==========================================
   반응형 디자인
   ========================================== */

@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  p {
    font-size: 1rem;
  }
  
  .card {
    padding: 24px;
  }
  
  .message-bubble {
    max-width: 90%;
  }
}

/* ==========================================
   유틸리티 클래스
   ========================================== */

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.rounded-full {
  border-radius: 9999px;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow {
  box-shadow: var(--shadow);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

/* ==========================================
   대화 입력창 - 세련되고 모던한 디자인
   ========================================== */

.chat-input-container {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, 
    rgba(255, 255, 255, 1) 0%, 
    rgba(255, 255, 255, 1) 80%, 
    rgba(255, 255, 255, 0) 100%
  );
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(229, 231, 235, 0.8);
  z-index: 10;
  padding-top: 12px;
}

.message-input-wrapper {
  background: white;
  border-radius: 24px;
  border: 1.5px solid var(--gray-200);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04),
              0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.message-input-wrapper:hover {
  border-color: var(--gray-300);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06),
              0 2px 6px rgba(0, 0, 0, 0.03);
}

.message-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.12),
              0 2px 8px rgba(37, 99, 235, 0.08);
}

.message-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  outline: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  resize: none;
  transition: all 0.2s ease;
}

.message-input::placeholder {
  color: var(--gray-400);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.message-input:focus::placeholder {
  color: var(--gray-300);
}

.btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 6px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.24),
              0 1px 3px rgba(37, 99, 235, 0.12);
  flex-shrink: 0;
}

.btn-send:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.32),
              0 2px 6px rgba(37, 99, 235, 0.16);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-send:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.24),
              0 1px 2px rgba(37, 99, 235, 0.12);
}

.btn-send i {
  transition: transform 0.3s ease;
}

.btn-send:hover i {
  transform: translateX(1px);
}

/* 입력창 하단 정보 */
.chat-input-container .flex.items-center.justify-center {
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

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

.shadow-lg {
  box-shadow: var(--shadow-lg);
}
