/* style.css - 로또 추천기 스타일 */

:root {
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --sub-bg: #f1f5f9;
  --sub-border: #e2e8f0;
  --btn-secondary-bg: #f1f5f9;
  --btn-secondary-hover: #e2e8f0;
  --btn-secondary-text: #334155;
  --accent: #f59e0b;
  --accent-hover: #d97706;
}

[data-theme="dark"] {
  --bg-color: #020617;
  --card-bg: #0f172a;
  --card-border: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --sub-bg: #020617;
  --sub-border: #1e293b;
  --btn-secondary-bg: #1e293b;
  --btn-secondary-hover: #334155;
  --btn-secondary-text: #e2e8f0;
  --accent: #f59e0b;
  --accent-hover: #d97706;
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

.container {
  width: 100%;
  max-width: 580px;
}

/* Header & Theme button */
header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background-color: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--btn-secondary-hover);
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d97706;
  margin-bottom: 6px;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Tab Switcher */
.tab-switcher {
  display: flex;
  background-color: var(--btn-secondary-bg);
  padding: 4px;
  border-radius: 12px;
  margin: 18px auto 0;
  max-width: 280px;
  border: 1px solid var(--sub-border);
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background-color: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Card Common */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  margin-bottom: 16px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Lotto 3D Ball */
.lotto-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 900;
  color: #ffffff;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 
    inset -4px -4px 8px rgba(0, 0, 0, 0.35),
    inset 3px 3px 6px rgba(255, 255, 255, 0.6),
    0 4px 10px rgba(0, 0, 0, 0.18);
  user-select: none;
  transition: transform 0.2s ease;
}

.lotto-ball:hover {
  transform: translateY(-2px) scale(1.05);
}

.lotto-ball::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 18%;
  width: 32%;
  height: 24%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 75%);
  border-radius: 50%;
  pointer-events: none;
  transform: rotate(-25deg);
}

/* 색상 규칙: 1~10 노랑, 11~20 파랑, 21~30 빨강, 31~40 회색, 41~45 초록 */
.ball-yellow {
  background: radial-gradient(circle at 35% 35%, #fbbf24, #d97706);
  color: #451a03;
  text-shadow: none;
}
.ball-blue {
  background: radial-gradient(circle at 35% 35%, #38bdf8, #0284c7);
}
.ball-red {
  background: radial-gradient(circle at 35% 35%, #f87171, #dc2626);
}
.ball-gray {
  background: radial-gradient(circle at 35% 35%, #94a3b8, #475569);
}
.ball-green {
  background: radial-gradient(circle at 35% 35%, #4ade80, #16a34a);
}

/* Single Mode Display */
.balls-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.balls-display .lotto-ball {
  width: 58px;
  height: 58px;
  font-size: 22px;
}

@media (max-width: 480px) {
  .balls-display .lotto-ball {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.btn-primary {
  flex: 1;
  max-width: 220px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

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

.btn-secondary {
  padding: 12px 16px;
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--sub-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:hover {
  background-color: var(--btn-secondary-hover);
}

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

.hint-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

kbd {
  background-color: var(--sub-bg);
  border: 1px solid var(--sub-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-main);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--sub-border);
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-item {
  background-color: var(--sub-bg);
  border: 1px solid var(--sub-border);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
}

.stat-title {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.stat-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: block;
  margin: 2px 0;
}

.stat-sub {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

/* Bundle 5-Game Mode */
.slip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--sub-border);
}

.slip-title h3 {
  font-size: 16px;
  font-weight: 800;
}

.slip-title span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.slip-actions {
  display: flex;
  gap: 6px;
}

.slip-actions .btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.bundle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bundle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--sub-bg);
  border: 1px solid var(--sub-border);
  padding: 10px 14px;
  border-radius: 12px;
  gap: 8px;
}

@media (max-width: 480px) {
  .bundle-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.game-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-letter {
  width: 26px;
  height: 26px;
  background-color: var(--text-main);
  color: var(--card-bg);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.game-type {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.bundle-balls {
  display: flex;
  gap: 6px;
}

.bundle-balls .lotto-ball {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.row-actions {
  display: flex;
  gap: 4px;
  align-self: flex-end;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background-color: var(--card-bg);
  color: var(--text-main);
}

.barcode-wrapper {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--sub-border);
  text-align: center;
}

.barcode {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
}

.barcode-line {
  background-color: var(--text-muted);
  height: 100%;
}

.barcode-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Accordion filter */
.accordion-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  padding: 16px 20px;
  cursor: pointer;
}

.accordion-body {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--sub-border);
  background-color: var(--sub-bg);
}

.filter-boxes {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

@media (max-width: 480px) {
  .filter-boxes {
    flex-direction: column;
  }
}

.filter-box {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
}

.include-box {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.exclude-box {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.box-title {
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

.include-box .box-title {
  color: #10b981;
}

.exclude-box .box-title {
  color: #ef4444;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 24px;
  align-items: center;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  color: white;
  cursor: pointer;
}

.include-tag {
  background-color: #10b981;
}

.exclude-tag {
  background-color: #ef4444;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-top: 10px;
  background-color: var(--card-bg);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--sub-border);
}

.grid-num-btn {
  height: 34px;
  border: none;
  background-color: var(--sub-bg);
  color: var(--text-main);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grid-num-btn:hover {
  filter: brightness(0.92);
}

.grid-num-btn.included {
  background-color: #10b981;
  color: #ffffff;
}

.grid-num-btn.excluded {
  background-color: #ef4444;
  color: #ffffff;
  text-decoration: line-through;
  opacity: 0.75;
}

/* History */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h4 {
  font-size: 14px;
  font-weight: 700;
}

.history-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--sub-bg);
  border: 1px solid var(--sub-border);
  border-radius: 8px;
  font-size: 12px;
}

.history-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-time {
  font-family: monospace;
  color: var(--text-muted);
  font-size: 11px;
}

.history-balls {
  display: flex;
  gap: 4px;
}

.history-balls .lotto-ball {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  background-color: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 8px;
  animation: fadeInDown 0.3s ease forwards;
}

[data-theme="dark"] .toast {
  background-color: rgba(30, 41, 59, 0.98);
  border: 1px solid #334155;
}

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

/* Footer & info */
.info-card {
  font-size: 12px;
  color: var(--text-muted);
  padding: 16px;
  border-radius: 12px;
  background-color: var(--sub-bg);
  border: 1px solid var(--sub-border);
  line-height: 1.6;
}

.color-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.guide-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.guide-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }
  .no-print {
    display: none !important;
  }
}
