/* board.css - AI 뉴스 공통 스타일 */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --border: rgba(0,0,0,.08);
  --accent: #2d8659;
  --accent-light: #e8f5ef;
  --danger: #d9534f;
  --danger-hover: #c9302c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Noto Sans KR", sans-serif;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* 헤더 - 메인과 통일 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.site-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.site-logo span { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.site-nav a {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text);
  transition: background .2s;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  opacity: 1;
}

/* 레이아웃 */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.content-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

/* 버튼 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #248c4e;
  color: #fff;
  opacity: 1;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--accent-light);
  opacity: 1;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-hover);
  color: #fff;
  opacity: 1;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* 검색/필터 바 */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input[type="text"],
.toolbar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.toolbar input[type="text"]:focus,
.toolbar select:focus {
  border-color: var(--accent);
}

.toolbar input[type="text"] {
  flex: 1;
  min-width: 200px;
}

/* 테이블 */
.board-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

.board-table th,
.board-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.board-table th {
  background: #f8f9fa;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.board-table td {
  font-size: 14px;
}

.board-table tr:last-child td {
  border-bottom: none;
}

.board-table tr:hover td {
  background: #f8fafb;
}

.board-table .title-cell a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.board-table .title-cell a:hover {
  color: var(--accent);
}

.board-table .category-badge,
.category-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
}

/* 페이지네이션 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}

.pagination button:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* 기사 상세 */
.article-detail {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  margin-top: 24px;
}

.article-detail h1 {
  font-size: clamp(22px, 4vw, 36px);
  margin: 0 0 16px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-body {
  font-size: 16px;
  line-height: 1.8;
}

.article-body img {
  max-width: 100%;
  border-radius: 12px;
  margin: 16px 0;
}

.article-body h2, .article-body h3 {
  margin-top: 28px;
  margin-bottom: 12px;
}

.article-body p {
  margin-bottom: 16px;
}

.article-body blockquote {
  border-left: 4px solid var(--accent);
  margin: 16px 0;
  padding: 12px 20px;
  background: var(--accent-light);
  border-radius: 0 10px 10px 0;
}

.article-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* 로그인 폼 */
.login-box {
  max-width: 400px;
  margin: 60px auto;
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}

.login-box h2 {
  margin: 0 0 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

/* 관리자 대시보드 */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  text-align: center;
}

.stat-card .stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* 에디터 영역 */
.editor-wrap {
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  margin-top: 24px;
}

.editor-wrap h2 {
  margin: 0 0 24px;
}

#editor-container {
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  font-size: 15px;
}

.editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* 알림 메시지 */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: #fde8e8;
  color: #c9302c;
  border: 1px solid #f5c6c6;
}

.alert-success {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #b8e6d5;
}

/* 로딩 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

/* 푸터 */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 40px 0 60px;
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* 반응형 */
@media (max-width: 720px) {
  .content-wrap { padding: 16px; }

  .article-detail { padding: 24px; }

  .board-table th:nth-child(3),
  .board-table td:nth-child(3),
  .board-table th:nth-child(4),
  .board-table td:nth-child(4) {
    display: none;
  }

  .toolbar { flex-direction: column; }
  .toolbar input[type="text"] { min-width: 0; width: 100%; }

  .site-header .wrap { flex-direction: column; align-items: flex-start; }
}

/* 토글 스위치 (공개/비공개) */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: .3s;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .3s;
}

.toggle input:checked + .slider {
  background: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
}
