/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
  --primary: #00C471;
  --primary-hover: #00A760;
  --primary-light: #E8F8F0;
  --danger: #fa5252;
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #868e96;
  --bg-white: #ffffff;
  --bg-gray: #f8f9fa;
  --bg-dark: #1B1C1D;
  --border: #e9ecef;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: var(--bg-gray);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ===== Header / Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  height: 64px;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.nav-logo span { color: var(--text-primary); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-menu a {
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-search {
  flex: 1;
  max-width: 340px;
  position: relative;
}

.nav-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  background: var(--bg-gray);
  transition: all 0.2s;
  outline: none;
}

.nav-search input:focus {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(0,196,113,0.12);
}

.nav-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover { color: var(--primary); }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover { background: #e03e3e; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* ===== Hero Banner ===== */
.hero {
  background: linear-gradient(135deg, #1B1C1D 0%, #2d3436 100%);
  padding: 52px 0;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0,196,113,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
}

.hero h1 .highlight { color: var(--primary); }

.hero p {
  font-size: 16px;
  color: #adb5bd;
  margin-bottom: 28px;
  max-width: 520px;
}

.hero-search {
  max-width: 480px;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  color: white;
  outline: none;
  transition: all 0.2s;
}

.hero-search input::placeholder { color: #868e96; }
.hero-search input:focus { background: rgba(255,255,255,0.18); }

.hero-search .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #868e96;
}

/* ===== Container ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Section ===== */
.section {
  padding: 48px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.section-header a {
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}

/* ===== Course Cards Grid ===== */
.course-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) { .course-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .course-grid { grid-template-columns: repeat(2, 1fr); } }

.course-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.course-card .thumb {
  position: relative;
  padding-bottom: 56.25%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow: hidden;
}

.course-card .thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: rgba(255,255,255,0.3);
}

.course-card .card-body {
  padding: 16px;
}

.course-card .card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
}

.course-card .card-instructor {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.course-card .card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  margin-bottom: 8px;
}

.course-card .card-rating .stars { color: #fcc419; }
.course-card .card-rating .count { color: var(--text-muted); }

.course-card .card-price {
  display: flex;
  align-items: center;
  gap: 8px;
}

.course-card .card-price .price {
  font-size: 16px;
  font-weight: 700;
}

.course-card .card-price .original-price {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.course-card .card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.course-card .badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
}

.course-card .badge.hot {
  background: #fff0f0;
  color: var(--danger);
}

.course-card .students {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Category Tags ===== */
.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.category-tag {
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-white);
  transition: all 0.15s;
  cursor: pointer;
}

.category-tag:hover,
.category-tag.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ===== Board / Community ===== */
.board-table {
  width: 100%;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.board-table thead {
  background: var(--bg-gray);
}

.board-table th {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.board-table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.board-table tr:hover td { background: var(--bg-gray); }

.board-title-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.board-title-cell .category-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  white-space: nowrap;
}

.board-title-cell .category-badge.qna {
  background: #e8f4fd;
  color: #1c7ed6;
}

.board-title-cell .category-badge.study {
  background: #fff3e0;
  color: #e8590c;
}

.board-title-cell a {
  font-weight: 500;
  transition: color 0.15s;
}

.board-title-cell a:hover { color: var(--primary); }

.comment-count {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

/* ===== Auth Pages ===== */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--bg-gray);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: var(--bg-white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,196,113,0.12);
}

.form-group textarea {
  min-height: 160px;
  resize: vertical;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

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

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Alert Messages ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: #fff0f0;
  color: var(--danger);
  border: 1px solid #ffc9c9;
}

.alert-success {
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid #b2f2d0;
}

.alert-warning {
  background: #fff8e1;
  color: #e8590c;
  border: 1px solid #ffe0b2;
}

/* ===== Post Detail ===== */
.post-detail {
  max-width: 800px;
  margin: 0 auto;
}

.post-header {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.post-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.4;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.post-meta .author {
  font-weight: 600;
  color: var(--text-primary);
}

.post-content {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

/* ===== Comments ===== */
.comments-section {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  border: 1px solid var(--border);
}

.comments-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

.comment-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child { border-bottom: none; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.comment-author {
  font-size: 14px;
  font-weight: 600;
}

.comment-date {
  font-size: 12px;
  color: var(--text-muted);
}

.comment-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.comment-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  min-height: 80px;
  resize: vertical;
  outline: none;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.comment-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,196,113,0.12);
}

/* ===== Course Detail ===== */
.course-detail-header {
  background: linear-gradient(135deg, #1B1C1D 0%, #2d3436 100%);
  padding: 48px 0;
  color: white;
}

.course-detail-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 48px;
  align-items: start;
}

.course-detail-info h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
}

.course-detail-info .instructor-name {
  font-size: 15px;
  color: #adb5bd;
  margin-bottom: 16px;
}

.course-detail-info .rating-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #adb5bd;
}

.course-detail-info .rating-info .stars { color: #fcc419; font-size: 16px; }

.course-sidebar {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
}

.course-sidebar .price-display {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}

.course-sidebar .original-price {
  font-size: 15px;
  color: #868e96;
  text-decoration: line-through;
  margin-bottom: 20px;
}

.course-sidebar .btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.course-detail-body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

/* ===== Write Page ===== */
.write-page {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 24px;
}

.write-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 36px;
  border: 1px solid var(--border);
}

.write-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
}

.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.pagination a:hover { background: var(--primary-light); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; }

/* ===== Footer ===== */
.footer {
  background: var(--bg-dark);
  color: #868e96;
  padding: 48px 0;
  margin-top: 60px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #343a40;
}

.footer-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a { font-size: 14px; transition: color 0.15s; }
.footer-links a:hover { color: white; }

.footer-bottom {
  font-size: 13px;
  line-height: 1.8;
}

/* ===== Search Results ===== */
.search-results {
  padding: 32px 0;
}

.search-results h2 {
  font-size: 20px;
  margin-bottom: 24px;
}

.search-results .keyword { color: var(--primary); }

.result-item {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: all 0.15s;
}

.result-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.result-item .result-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.result-item h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.result-item p { font-size: 14px; color: var(--text-muted); }

/* ===== Thumb gradients for course cards ===== */
.thumb-1 { background: linear-gradient(135deg, #667eea, #764ba2) !important; }
.thumb-2 { background: linear-gradient(135deg, #f093fb, #f5576c) !important; }
.thumb-3 { background: linear-gradient(135deg, #4facfe, #00f2fe) !important; }
.thumb-4 { background: linear-gradient(135deg, #43e97b, #38f9d7) !important; }
.thumb-5 { background: linear-gradient(135deg, #fa709a, #fee140) !important; }
.thumb-6 { background: linear-gradient(135deg, #a18cd1, #fbc2eb) !important; }
.thumb-7 { background: linear-gradient(135deg, #fccb90, #d57eeb) !important; }
.thumb-8 { background: linear-gradient(135deg, #e0c3fc, #8ec5fc) !important; }

/* ===== Profile Page ===== */
.profile-page {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 24px;
}

.profile-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 36px;
  border: 1px solid var(--border);
}

.profile-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
}

.profile-name { font-size: 20px; font-weight: 700; }
.profile-role { font-size: 14px; color: var(--text-muted); }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ===== Vulnerability Warning Banner ===== */
.vuln-banner {
  background: linear-gradient(90deg, #fa5252, #e03e3e);
  color: white;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
}

.vuln-banner code {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
