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

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: #f5f7fa;
  color: #333;
}

/* 헤더 */
header {
  background: #1a3c6e;
  color: white;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
header h1 { font-size: 1.3rem; }
header nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.95rem;
}
header nav a:hover { text-decoration: underline; }

/* 관리자 퀵메뉴 */
.admin-quickbar {
  background: #0d1f3c;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
}
.admin-quickbar span { color: #f6a623; font-weight: 700; }
.admin-quickbar a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 3px 10px;
  border-radius: 4px;
  transition: all 0.2s;
}
.admin-quickbar a:hover { background: rgba(255,255,255,0.15); color: white; }

/* 버튼 */
.btn {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-primary { background: #1a3c6e; color: white; }
.btn-primary:hover { background: #15305a; }
.btn-success { background: #28a745; color: white; }
.btn-success:hover { background: #218838; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-outline {
  background: transparent;
  border: 2px solid #1a3c6e;
  color: #1a3c6e;
}
.btn-outline:hover { background: #1a3c6e; color: white; }

/* 카드 */
.card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 25px;
  margin-bottom: 20px;
}

/* 컨테이너 */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* 폼 */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1a3c6e;
}

/* 알림 메시지 */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* 테이블 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}
th { background: #f8f9fa; font-weight: 700; color: #555; }
tr:hover { background: #f8f9fa; }

/* 배지 */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-member { background: #d1ecf1; color: #0c5460; }
.badge-admin { background: #e2d9f3; color: #4a235a; }

/* 반응형 */
@media (max-width: 768px) {
  header { padding: 12px 16px; }
  .container { padding: 20px 15px; }
}

/* 공지사항 */
.notice-card {
  background: #fff8e1;
  border-left: 4px solid #f6a623;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.notice-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.notice-card.pinned { background: #fff3cd; border-color: #e67e00; }
.notice-card h4 { font-size: 0.95rem; color: #333; margin-bottom: 4px; }
.notice-card span { font-size: 0.8rem; color: #888; }
.pin-badge {
  background: #e67e00;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-right: 8px;
}

/* Q&A */
.qna-item {
  background: white;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.qna-item h4 { font-size: 0.95rem; color: #1a3c6e; margin-bottom: 6px; }
.qna-item .meta { font-size: 0.8rem; color: #aaa; margin-bottom: 10px; }
.qna-answer {
  background: #f0f7ff;
  border-left: 3px solid #4a90d9;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  color: #333;
  margin-top: 10px;
}
.qna-pending {
  background: #fff8e1;
  border-left: 3px solid #f6a623;
  padding: 8px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: #856404;
  margin-top: 10px;
}

/* 평가 */
.exam-question {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.exam-question h4 { font-size: 0.95rem; color: #333; margin-bottom: 14px; }
.exam-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid #eee;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.exam-option:hover { border-color: #4a90d9; background: #f0f7ff; }
.exam-option.selected { border-color: #1a3c6e; background: #e8f0fe; }
.exam-option.correct { border-color: #28a745; background: #d4edda; }
.exam-option.wrong { border-color: #dc3545; background: #f8d7da; }
.score-display {
  text-align: center;
  padding: 30px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.score-display .big-score {
  font-size: 4rem;
  font-weight: 700;
  color: #1a3c6e;
}
.score-display.passed .big-score { color: #28a745; }
.score-display.failed .big-score { color: #dc3545; }

/* 설문 */
.survey-question {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.survey-question h4 { font-size: 0.95rem; margin-bottom: 14px; color: #333; }
.rating-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.rating-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.rating-btn:hover, .rating-btn.selected {
  border-color: #1a3c6e;
  background: #1a3c6e;
  color: white;
}

/* 메시지 */
.message-item {
  background: white;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.message-item.unread { border-left: 3px solid #4a90d9; }
.message-item p { font-size: 0.9rem; color: #333; }
.message-item .meta { font-size: 0.78rem; color: #aaa; margin-top: 4px; }

/* 학습현황 테이블 */
.progress-cell { min-width: 150px; }
.mini-progress {
  background: #eee;
  border-radius: 10px;
  height: 6px;
  margin-top: 4px;
}
.mini-progress-fill {
  height: 6px;
  border-radius: 10px;
  background: linear-gradient(90deg, #1a3c6e, #4a90d9);
}

/* 탭 */
.tab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid #eee;
}
.tab-nav-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: #aaa;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab-nav-btn.active { color: #1a3c6e; border-bottom-color: #1a3c6e; }

/* 모달 공통 */
.modal-bg {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  padding: 30px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 40px;
}
.modal h3 { font-size: 1.15rem; color: #1a3c6e; margin-bottom: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ================================
   모바일 최적화
================================ */

/* 모바일 하단 네비게이션 */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid #eee;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 999;
  padding: 6px 0;
}
.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  text-decoration: none;
  color: #aaa;
  font-size: 0.7rem;
  font-weight: 600;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Noto Sans KR', sans-serif;
}
.mobile-nav-item .nav-icon { font-size: 1.3rem; }
.mobile-nav-item.active { color: #1a3c6e; }
.mobile-nav-item:hover { color: #1a3c6e; }

/* 모바일에서 하단 네비 공간 확보 */
@media (max-width: 768px) {
  .mobile-nav { display: block; }
  body { padding-bottom: 70px; }

  /* 헤더 모바일 */
  header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  header h1 { font-size: 1.1rem; }
  header nav { display: none; }

  /* 컨테이너 */
  .container { padding: 16px 14px; }

  /* 관리자 사이드바 → 모바일에서 상단 바로 변경 */
  .admin-wrap { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 12px 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
  }
  .sidebar h2 {
    width: 100%;
    padding: 8px 16px 8px;
    border-bottom: none;
    margin-bottom: 0;
    font-size: 0.95rem;
  }
  .sidebar a {
    padding: 8px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .main-content { margin-left: 0 !important; padding: 16px; }

  /* 테이블 모바일 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* 카드 그리드 */
  .courses-grid {
    grid-template-columns: 1fr !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .preview-grid {
    grid-template-columns: 1fr !important;
  }

  /* 모달 */
  .modal-bg { padding-top: 20px; padding-left: 12px; padding-right: 12px; }
  .modal { padding: 20px 16px; }

  /* 히어로 */
  .hero { padding: 36px 16px; }
  .hero h2 { font-size: 1.5rem; }

  /* 브랜드 패널 숨김 (로그인 페이지) */
  .brand-panel { display: none; }
  .form-panel {
    width: 100% !important;
    padding: 30px 20px !important;
    box-shadow: none !important;
  }

  /* 관리자 퀵바 */
  .admin-quickbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding: 6px 12px;
  }
  .admin-quickbar a { white-space: nowrap; font-size: 0.78rem; }

  /* 플레이어 */
  .player-wrap { flex-direction: column; }
  .lesson-sidebar { width: 100%; max-height: 250px; }

  /* 지원유형 선택 */
  .support-options { grid-template-columns: 1fr !important; }

  /* 커뮤니티 */
  .community-wrap { padding: 16px 14px; }
  .qna-wrap { padding: 16px 14px; }

  /* 홈페이지 섹션 */
  .vision-grid { grid-template-columns: 1fr !important; }
  .meaning-grid { grid-template-columns: 1fr !important; }
  .givers-grid { grid-template-columns: 1fr !important; }
  .hero-stats { gap: 16px; }
  .priority-box { padding: 24px 16px; }

  /* 폼 패널 */
  .form-panel { overflow-y: auto; max-height: 100vh; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .hero h1 { font-size: 1.8rem; }
  .section-title { font-size: 1rem; }
}
