@tailwind base;
@tailwind components;
@tailwind utilities;

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Orbitron:wght@400;700;900&family=Crimson+Text:wght@400;600&family=Roboto:wght@300;400;500;700&display=swap');

/* 전역 CSS 변수 - 다크모드 지원 */
:root {
  --transition-theme: all 0.3s ease;
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.5s ease;
  
  /* Light mode colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --accent: #3b82f6;
}

.dark {
  /* Dark mode colors */
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --accent: #60a5fa;
}

/* 기본 스타일 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition-theme);
  overflow-x: hidden;
}

/* 반응형 디자인 개선 - 모든 컨셉트 공통 */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  .concept-container {
    padding: 1rem;
  }
  
  .concept-title {
    font-size: 1.5rem !important;
  }
  
  .concept-description {
    font-size: 0.9rem;
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
  
  .concept-container {
    padding: 0.5rem;
  }
  
  .concept-title {
    font-size: 1.25rem !important;
  }
  
  .concept-description {
    font-size: 0.8rem;
  }
}

/* 성능 최적화 - 애니메이션 감소 옵션 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .book-page,
  .gauge-needle,
  .terminal-cursor,
  .neon-text,
  .orb {
    animation: none !important;
  }
}

/* 고해상도 디스플레이 지원 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  .concept-card,
  .book-cover,
  .dashboard-panel,
  .terminal-screen,
  .neon-border,
  .orb {
    border-width: 0.5px;
  }
}

/* 터치 장치 최적화 */
@media (hover: none) and (pointer: coarse) {
  .concept-card,
  .book-cover,
  .dashboard-button,
  .terminal-input,
  .neon-button,
  .orb {
    min-height: 44px;
    min-width: 44px;
  }
  
  .concept-card:hover,
  .book-cover:hover,
  .dashboard-button:hover,
  .neon-button:hover,
  .orb:hover {
    transform: none;
  }
  
  .concept-card:active,
  .book-cover:active,
  .dashboard-button:active,
  .neon-button:active,
  .orb:active {
    transform: scale(0.95);
  }
}

/* 컨셉트 카드 스타일 */
.concept-card {
  @apply bg-white dark:bg-gray-800 rounded-2xl p-6 shadow-lg hover:shadow-2xl 
         border border-gray-100 dark:border-gray-700 cursor-pointer
         transform transition-all duration-300 hover:scale-105 hover:-translate-y-2;
}

.concept-card:focus {
  @apply outline-none ring-4 ring-blue-500 ring-opacity-50;
}

.concept-card:active {
  @apply scale-95;
}

/* 반응형 컨셉트 카드 */
@media (max-width: 768px) {
  .concept-card {
    @apply p-4;
  }
  
  .concept-preview {
    @apply h-24 text-4xl;
  }
  
  .concept-card h3 {
    @apply text-lg;
  }
  
  .concept-card p {
    @apply text-sm;
  }
}

@media (max-width: 480px) {
  .concept-card {
    @apply p-3;
  }
  
  .concept-preview {
    @apply h-20 text-3xl;
  }
  
  .concept-card h3 {
    @apply text-base;
  }
  
  .concept-card p {
    @apply text-xs leading-relaxed;
  }
  
  .concept-card .flex.flex-wrap {
    @apply gap-1;
  }
  
  .concept-card span {
    @apply text-xs px-2 py-1;
  }
}

/* 다크모드 토글 버튼 */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.theme-toggle:hover {
  background: var(--accent);
  color: white;
  transform: scale(1.1);
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* 컨셉 선택 메인 페이지 스타일 */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.concept-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  transition: var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.concept-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.dark .concept-card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Book Flip 컨셉 전용 스타일 */
.book-container {
  perspective: 1200px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.book {
  position: relative;
  width: 400px;
  height: 600px;
  transform-style: preserve-3d;
  transition: transform 0.8s;
}

.page {
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  border-radius: 8px;
  transform-origin: left center;
  transition: transform 0.8s;
  backface-visibility: hidden;
  padding: 2rem;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Car Dashboard 컨셉 전용 스타일은 car-dashboard.css에서 처리됨 */


/* Terminal 컨셉 전용 스타일 */
.terminal-container {
  background: #000;
  color: #00ff00;
  font-family: 'JetBrains Mono', monospace;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
}

.terminal {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(0,0,0,0.9);
  border: 2px solid #00ff00;
  border-radius: 8px;
  padding: 1rem;
  position: relative;
}

.terminal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent 50%, rgba(0,255,0,0.03) 50%);
  background-size: 100% 4px;
  pointer-events: none;
}

.typing-text {
  overflow: hidden;
  border-right: 2px solid #00ff00;
  white-space: nowrap;
  animation: type 3s steps(20) infinite, blink 1s infinite;
}

@keyframes blink {
  0%, 50% { border-color: #00ff00; }
  51%, 100% { border-color: transparent; }
}

/* Cyberpunk 컨셉 전용 스타일 */
.cyberpunk-container {
  background: linear-gradient(45deg, #0d0d0d, #1a0033, #0d0d0d);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.neon-text {
  color: #00ffff;
  text-shadow: 
    0 0 10px #00ffff,
    0 0 20px #00ffff,
    0 0 40px #00ffff;
  animation: neon-pulse 2s ease-in-out infinite alternate;
}

.cyber-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(0,255,255,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,0,255,0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-move 20s linear infinite;
}

@keyframes grid-move {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* Floating Orb 컨셉 전용 스타일 */
.orb-container {
  background: radial-gradient(ellipse at center, #000011 0%, #000033 100%);
  min-height: 100vh;
  position: relative;
  perspective: 2000px;
  overflow: hidden;
}

.orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: absolute;
  background: radial-gradient(circle at 30% 30%, #9370db, #4b0082);
  box-shadow: 
    0 0 30px #9370db,
    inset 0 0 30px rgba(255,255,255,0.2);
  animation: float 6s ease-in-out infinite;
  cursor: pointer;
  transition: all 0.3s;
}

.orb:hover {
  transform: scale(1.2);
  box-shadow: 
    0 0 50px #9370db,
    0 0 80px #9370db,
    inset 0 0 30px rgba(255,255,255,0.3);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .concept-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .book {
    width: 300px;
    height: 450px;
  }
  
  .dashboard {
    width: 90vw;
    height: 60vh;
    padding: 1rem;
  }
  
  .theme-toggle {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }
  
  .terminal {
    padding: 0.5rem;
    font-size: 14px;
  }
}

/* 접근성 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
  .concept-card {
    border: 3px solid var(--accent);
  }
  
  .theme-toggle {
    border-width: 3px;
  }
}

