/* CSS Variables for Theme */
:root {
  --bg-gradient-1: #667eea;
  --bg-gradient-2: #764ba2;
  --container-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888a0;
  --card-bg: #f8f9fc;
  --border-color: #e8e8f0;
  --shadow-color: rgba(102, 126, 234, 0.3);
  --btn-shadow: rgba(102, 126, 234, 0.4);
}

[data-theme="dark"] {
  --bg-gradient-1: #1a1a2e;
  --bg-gradient-2: #16213e;
  --container-bg: #0f0f1a;
  --text-primary: #ffffff;
  --text-secondary: #b8b8d0;
  --text-muted: #6868a0;
  --card-bg: #1a1a2e;
  --border-color: #2a2a4e;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --btn-shadow: rgba(102, 126, 234, 0.3);
}

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

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: background 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--container-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--shadow-color);
  transition: all 0.3s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
}

.theme-icon {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

/* Main Container */
.container {
  background: var(--container-bg);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 25px 80px var(--shadow-color);
  text-align: center;
  max-width: 520px;
  width: 100%;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

/* Header */
.header {
  margin-bottom: 30px;
}

.logo {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: float 3s ease-in-out infinite;
}

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

h1 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 500;
}

/* Generate Button */
#generateBtn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px 45px;
  font-size: 1.15rem;
  border-radius: 60px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

#generateBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

#generateBtn:hover::before {
  left: 100%;
}

#generateBtn:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px var(--btn-shadow);
}

#generateBtn:active {
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 1.3rem;
}

/* Results Section */
#results {
  margin-top: 35px;
}

.lotto-set {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  padding: 20px;
  background: var(--card-bg);
  border-radius: 18px;
  flex-wrap: wrap;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
}

.lotto-set:hover {
  transform: translateX(5px);
  box-shadow: 0 8px 25px var(--shadow-color);
}

.set-label {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.85rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balls-container {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ball {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: white;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
  box-shadow:
    0 6px 15px rgba(0, 0, 0, 0.25),
    inset 0 -3px 10px rgba(0, 0, 0, 0.2),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) backwards;
  position: relative;
}

.ball::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 10px;
  width: 12px;
  height: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: rotate(-30deg);
}

@keyframes popIn {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* Ball Colors - Official Lotto Colors */
.ball-yellow {
  background: linear-gradient(145deg, #ffc107 0%, #ff9800 50%, #e65100 100%);
}

.ball-blue {
  background: linear-gradient(145deg, #42a5f5 0%, #1e88e5 50%, #0d47a1 100%);
}

.ball-red {
  background: linear-gradient(145deg, #ef5350 0%, #e53935 50%, #b71c1c 100%);
}

.ball-gray {
  background: linear-gradient(145deg, #9e9e9e 0%, #616161 50%, #212121 100%);
}

.ball-green {
  background: linear-gradient(145deg, #66bb6a 0%, #43a047 50%, #1b5e20 100%);
}

/* Info Section */
.info {
  margin-top: 35px;
  padding-top: 25px;
  border-top: 1px solid var(--border-color);
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 10px 0;
}

.info-icon {
  font-size: 1rem;
}

/* Footer */
footer {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 520px) {
  .container {
    padding: 30px 20px;
    border-radius: 20px;
  }

  .logo {
    font-size: 3rem;
  }

  h1 {
    font-size: 1.7rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  #generateBtn {
    padding: 15px 35px;
    font-size: 1rem;
  }

  .ball {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .lotto-set {
    padding: 15px 15px 15px 45px;
  }

  .set-label {
    font-size: 0.75rem;
    left: 12px;
  }

  .balls-container {
    gap: 6px;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
    top: 15px;
    right: 15px;
  }

  .theme-icon {
    font-size: 1.3rem;
  }
}

/* Smooth transitions for theme change */
.container, .lotto-set, .theme-toggle, h1, .subtitle, .info-item, footer p {
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
