/* Korean Fortune - Global Styles */

/* Dark Theme (Default) */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0b0;
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-pink: #ec4899;
  --border: #2a2a4a;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;

  /* 오행 색상 */
  --wood: #22c55e;
  --fire: #ef4444;
  --earth: #eab308;
  --metal: #a1a1aa;
  --water: #3b82f6;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --accent: #7c3aed;
  --accent-light: #8b5cf6;
  --accent-pink: #db2777;
  --border: #e5e7eb;
}

[data-theme="light"] body::before {
  background:
    linear-gradient(to bottom, rgba(248, 249, 250, 0.85), rgba(248, 249, 250, 0.95)),
    url('backgroundimage.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(to bottom, rgba(10, 10, 15, 0.7), rgba(10, 10, 15, 0.9)),
    url('backgroundimage.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  pointer-events: none;
  z-index: -1;
}

/* Header */
header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

nav {
  display: flex;
  gap: 2rem;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s;
}

nav a:hover {
  color: var(--text-primary);
}

/* Main */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 0;
}

.badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 50px;
  color: var(--accent-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-pink), var(--water));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
}

.form-section {
  max-width: 500px;
  margin: 2rem auto;
}

.form-section h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

/* Form */
.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--accent-light);
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group small {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

select, input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a78bfa'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.2rem;
  padding-right: 2.5rem;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Gender Buttons */
.gender-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.gender-btn {
  padding: 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.gender-btn .icon {
  font-size: 1.5rem;
}

.gender-btn:hover {
  border-color: var(--accent);
}

.gender-btn.selected[data-gender="male"] {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.2);
}

.gender-btn.selected[data-gender="female"] {
  border-color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.2);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-pink));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 1rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  padding: 0.875rem 1.5rem;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 4rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.disclaimer {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

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

/* Result Page Styles */
.result-header {
  text-align: center;
  margin-bottom: 2rem;
}

.pillars-chart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.pillar {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  text-align: center;
}

.pillar-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.pillar-hanja {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
}

.pillar-korean {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.pillar-animal {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Element Balance */
.element-bar-container {
  margin-bottom: 1rem;
}

.element-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.element-bar {
  height: 10px;
  background: var(--bg-secondary);
  border-radius: 5px;
  overflow: hidden;
}

.element-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s ease;
}

/* Section Cards */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-card h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-card p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.section-card ul {
  list-style: none;
  padding: 0;
}

.section-card li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.section-card li::before {
  content: '•';
  color: var(--accent);
}

/* Two Column Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Compatibility Score */
.score-circle {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 2rem;
}

.score-circle svg {
  transform: rotate(-90deg);
}

.score-circle-bg {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 10;
}

.score-circle-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-value .emoji {
  font-size: 2.5rem;
  display: block;
}

.score-value .number {
  font-size: 2rem;
  font-weight: 700;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .pillars-chart {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  nav {
    gap: 1rem;
  }

  .hero-with-character {
    padding: 1.5rem 0;
    gap: 1.5rem;
  }

  .hero-with-character .subtitle {
    max-width: 100%;
  }

  .hero-with-character h1 {
    font-size: 2rem;
  }

  .hero-tagline {
    font-size: 1.2rem;
  }

  .character-image {
    max-width: 220px;
  }

  .character-container::before {
    width: 160px;
    height: 160px;
  }
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 20px;
  height: 20px;
  transition: opacity 0.3s;
}

/* Show/hide icons based on theme */
.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

/* Language Selector */
.lang-selector {
  position: relative;
}

.lang-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.lang-btn:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.lang-arrow {
  font-size: 0.7rem;
  opacity: 0.7;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  min-width: 150px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.lang-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.lang-dropdown button:hover {
  background: var(--bg-secondary);
}

/* Character Image */
.character-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-container::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, rgba(236, 72, 153, 0.25) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(30px);
  z-index: -1;
}

.character-image {
  max-width: 320px;
  height: auto;
  filter: drop-shadow(0 15px 40px rgba(139, 92, 246, 0.5));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.hero-with-character {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2rem;
  padding: 2rem 0;
  max-width: 900px;
  margin: 0 auto;
}

.hero-with-character .hero-content {
  text-align: center;
}

.hero-with-character .badge {
  margin-bottom: 1rem;
  display: inline-block;
}

.hero-with-character h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  font-size: 1.5rem;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 1rem;
}

.hero-with-character .subtitle {
  margin: 0 auto;
  text-align: center;
  font-size: 1rem;
  max-width: 600px;
}

.hero-with-character .character-container {
  flex-shrink: 0;
}

/* Light theme card shadow */
[data-theme="light"] .card,
[data-theme="light"] .section-card,
[data-theme="light"] .feature-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .character-image {
  filter: drop-shadow(0 5px 15px rgba(124, 58, 237, 0.15));
}

[data-theme="light"] .character-container::before {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.2) 0%, rgba(219, 39, 119, 0.15) 50%, transparent 70%);
}
