/* css/style.css */

:root {
  /* 새로운 컨셉: 미니멀 프리미엄 (White & Black) */
  --primary-color: #1a1a1a;
  --primary-light: #444444;
  --secondary-color: #f6f8fa;
  --text-dark: #222222;
  --text-light: #666666;
  --danger-color: #e74c3c;
  --success-color: #27ae60;
  --bg-color: #ffffff;
  --border-radius: 12px;
  --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --db-primary: #3498db;
  --header-height: 70px;
  --header-height-mobile: 56px;
}

.highlight-red-bold {
  color: #e74c3c;
  font-weight: 800;
}

.history-scroll-box {
  max-height: 480px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #edf2f7;
}

/* 순위별 포인트 색상 */
.rank-1 { color: #d4af37 !important; font-weight: 800 !important; } /* 진한 금색 */
.rank-2 { color: #a0a0a0 !important; font-weight: 800 !important; } /* 진한 은색 */
.rank-3 { color: #cd7f32 !important; font-weight: 800 !important; } /* 진한 구리색 */

#user-display-info {
  text-align: left !important;
  margin-bottom: 1.2rem !important;
  color: #2c3e50 !important;
  font-weight: 500 !important;
  font-size: 1.25rem !important; /* 카드 타이틀 크기와 맞춤 */
}
#user-display-info b {
  font-weight: 800;
  color: var(--primary-color);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  letter-spacing: -0.3px;
}

body {
  background-color: var(--secondary-color);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Nav */
header {
  background-color: var(--bg-color);
  color: var(--text-dark);
  padding: 1.5rem 1rem;
  height: auto;
  /* 콘텐츠에 맞춰 자동 조절 */
  display: flex;
  flex-direction: column;
  /* 세로 배치 (로고 - 메뉴) */
  align-items: center;
  /* 가로 중앙 정렬 */
  gap: 1.2rem;
  /* 요소 간 간격 */
  border-bottom: 1px solid #eaeaea;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

@media (max-width: 600px) {
  header {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }
}

header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand img {
  height: 38px;
  width: auto;
}

@media (max-width: 600px) {
  .brand img {
    height: 28px;
  }
}

.nav-links {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  /* 가로 중앙 정렬 */
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  /* 좁은 화면에서 줄바꿈 허용 */
}

.nav-links button {
  background: var(--secondary-color);
  color: var(--text-dark);
  border: 1px solid #ddd;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 강조된 '성경 쓰기' 빨간색 긴 버튼 */
.btn-bible-writing {
  background-color: var(--danger-color) !important;
  color: white !important;
  border-color: var(--danger-color) !important;
  padding: 0.7rem 2.5rem !important;
  /* 가로로 더 길게 */
  min-width: 160px;
  font-size: 1rem !important;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.25);
  transition: all 0.3s ease !important;
}

.btn-bible-writing:hover {
  background-color: #c0392b !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(231, 76, 60, 0.35) !important;
}

.nav-links button:not(.btn-bible-writing):hover {
  background: #e0e0e0;
  border-color: #ccc;
}

/* Common Container (Responsive) */
.container {
  width: 100%;
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
}

@media (max-width: 600px) {
  .container {
    margin: 1.5rem auto;
    /* 상단 여백 확대하여 헤더와 겹침 방지 */
    padding: 0 0.75rem;
  }
}

/* Card UI */
.card {
  background: var(--bg-color);
  border-radius: var(--border-radius);
  padding: 1.8rem;
  box-shadow: var(--box-shadow);
  margin-bottom: 2rem;
  border: 1px solid rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
}

/* 카드 상단 포인트 라인 (각기 다른 색상) */
.card.summary-card { border-top: 5px solid #3498db; }
.card.rank-card { border-top: 5px solid #f1c40f; }
.card.history-card { border-top: 5px solid #2ecc71; }
.card.chart-card { border-top: 5px solid #9b59b6; }

@media (max-width: 600px) {
  .card {
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    border-radius: 10px;
  }
}

.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #2c3e50;
}

@media (max-width: 600px) {
  .card-title {
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
  }
}

/* Forms */
.form-group {
  margin-bottom: 1.8rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid #e1e1e1;
  border-radius: var(--border-radius);
  font-size: 1rem;
  background-color: #fafafa;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn-primary {
  width: 100%;
  background-color: var(--primary-color);
  /* 로고 색상(블랙)에 맞춤 */
  color: white;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: transform 0.1s active, background-color 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Typing Display Area */
.verse-display {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background-color: #fcfcfc;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  line-height: 1.8;
  word-break: keep-all;
  /* 모바일에서 단어 단위 줄바꿈 선호 */
  overflow-wrap: break-word;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

@media (max-width: 600px) {
  .verse-display {
    font-size: 1.15rem;
    padding: 1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
  }
}

.verse-info {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

@media (max-width: 600px) {
  .verse-info {
    font-size: 0.9rem;
  }
}

/* 입력 중 상태 표시 (타이핑 시) */
.typing-input {
  width: 100%;
  padding: 1rem;
  font-size: 1.15rem;
  border: 2px solid #e1e1e1;
  border-radius: 8px;
  resize: none;
  min-height: 100px;
  background-color: #fdfdfd;
  transition: all 0.2s;
}

@media (max-width: 600px) {
  .typing-input {
    padding: 0.8rem;
    font-size: 1rem;
    min-height: 80px;
  }
}

.typing-input:focus {
  border-color: var(--primary-color);
  background-color: #fff;
  outline: none;
}

/* 에러(빨간색 글씨) */
.char-error {
  color: var(--danger-color);
  background-color: #fff5f5;
  border-radius: 4px;
}

.char-correct {
  color: var(--primary-color);
  font-weight: 700;
}

/* Tables for Dashboard/Admin */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid #eee;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

@media (max-width: 600px) {

  th,
  td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }
}

th {
  background-color: #fafafa;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: #fcfcfc;
}

/* Bible selection grid for admin */
.bible-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 1rem;
  background: #fdfdfd;
  border: 1px solid #eee;
  border-radius: var(--border-radius);
}

.bible-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  padding: 5px;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.2s;
}

.bible-item:hover {
  background: #f0f0f0;
}

.bible-item input[type="radio"] {
  width: auto;
  margin: 0;
}

@media (max-width: 600px) {
  header {
    padding: 0 0.75rem;
    height: var(--header-height-mobile);
    gap: 0.5rem;
  }

  header h1 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-links {
    gap: 0.35rem;
    /* 모바일에서 간격 더 축소 */
    display: flex;
    align-items: center;
  }

  .nav-links button {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 12px;
  }

  .btn-bible-writing {
    padding: 0.6rem 1.5rem !important;
    min-width: 130px;
    font-size: 0.9rem !important;
  }

  .btn-primary {
    padding: 0.8rem;
    font-size: 1rem;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  .stat-item {
    padding: 0.75rem !important;
  }

  .stat-label {
    font-size: 0.75rem !important;
  }

  .stat-value {
    font-size: 0.95rem !important;
  }
}