/* 솥 봇 커뮤니티 플랫폼 - 메인 CSS */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #e8f0fe;
  --secondary: #4b5563;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f3f4f6;
  --bg-card: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ========== 레이아웃 ========== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.layout { display: flex; gap: 24px; padding: 24px 0; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 300px; flex-shrink: 0; }
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .hide-mobile { display: none !important; }
}

/* ========== 헤더 ========== */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  height: 60px; max-width: 1200px; margin: 0 auto; padding: 0 16px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; font-weight: 700; color: var(--primary);
  text-decoration: none; white-space: nowrap;
}
.logo-icon { font-size: 24px; }
.header-search {
  flex: 1; max-width: 400px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
}
.header-search input {
  border: none; background: transparent; outline: none; width: 100%; font-size: 14px;
}
.header-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-nav a, .header-nav button {
  padding: 6px 12px; border-radius: var(--radius); font-size: 14px;
  color: var(--secondary); border: none; background: transparent;
  white-space: nowrap; display: flex; align-items: center; gap: 4px;
}
.header-nav a:hover, .header-nav button:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.btn-primary-sm {
  background: var(--primary) !important; color: white !important;
  padding: 6px 14px !important; border-radius: 20px !important;
}
.btn-primary-sm:hover { background: var(--primary-dark) !important; }
.notification-btn { position: relative; }
.notification-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: white;
  font-size: 10px; padding: 1px 4px; border-radius: 10px; min-width: 16px; text-align: center;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--primary); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ========== 버튼 ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  border: none; cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.95); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 카드 ========== */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  overflow: hidden;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }
.card-title { font-size: 16px; font-weight: 600; }

/* ========== 포스트 카드 ========== */
.post-card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.post-card-thumb {
  width: 100%; height: 180px; background: var(--primary-light);
  object-fit: cover; display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 40px;
}
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 16px; }
.post-card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500;
  background: var(--primary-light); color: var(--primary);
}
.tag-category { background: #dbeafe; color: #1e40af; }
.tag-difficulty-초급 { background: #d1fae5; color: #065f46; }
.tag-difficulty-중급 { background: #fef3c7; color: #92400e; }
.tag-difficulty-고급 { background: #fee2e2; color: #991b1b; }
.post-card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text);
}
.post-card-title:hover { color: var(--primary); }
.post-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border); margin-top: 12px;
  font-size: 12px; color: var(--text-muted);
}
.post-stats { display: flex; gap: 12px; }
.post-stat { display: flex; align-items: center; gap: 3px; }

/* ========== 폼 ========== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--secondary); }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
  display: block; width: 100%;
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px;
  background: white; color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ========== 알림 메시지 ========== */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px; font-size: 14px;
}
.alert-success { background: #d1fae5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info { background: #dbeafe; border: 1px solid #93c5fd; color: #1e3a8a; }
.alert-warning { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }

/* ========== 별점 ========== */
.stars { display: flex; gap: 2px; }
.star { color: #d1d5db; font-size: 16px; cursor: pointer; }
.star.filled, .star.active { color: var(--accent); }

/* ========== 페이지네이션 ========== */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 20px 0; flex-wrap: wrap; }
.page-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius); background: white;
  font-size: 14px; cursor: pointer; color: var(--text);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ========== 프로필 ========== */
.profile-header {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 24px;
  display: flex; gap: 20px; align-items: flex-start;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--primary-light); display: flex; align-items: center;
  justify-content: center; font-size: 28px; font-weight: 700; color: var(--primary);
  flex-shrink: 0; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-school { color: var(--text-muted); font-size: 14px; }
.profile-stats { display: flex; gap: 20px; margin-top: 12px; }
.profile-stat { text-align: center; }
.profile-stat-num { font-size: 18px; font-weight: 700; color: var(--primary); }
.profile-stat-label { font-size: 12px; color: var(--text-muted); }

/* ========== 댓글 ========== */
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-reply { margin-left: 40px; background: var(--bg); border-radius: var(--radius); padding: 10px; }
.comment-content { flex: 1; }
.comment-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 12px; color: var(--text-muted); }
.comment-author { font-weight: 600; color: var(--text); font-size: 13px; }

/* ========== 에디터 ========== */
.rich-editor {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.editor-toolbar {
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 8px; display: flex; gap: 4px; flex-wrap: wrap;
}
.editor-toolbar button {
  width: 30px; height: 30px; border: none; background: transparent;
  border-radius: 4px; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.editor-toolbar button:hover { background: var(--primary-light); color: var(--primary); }
.editor-body { min-height: 300px; padding: 12px; outline: none; font-size: 14px; line-height: 1.8; }
.editor-body:empty::before { content: attr(data-placeholder); color: var(--text-muted); }

/* ========== 파일 업로드 ========== */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-icon { font-size: 32px; color: var(--primary); margin-bottom: 8px; }
.upload-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.upload-thumb {
  width: 80px; height: 80px; border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb .remove-btn {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; background: var(--danger); color: white;
  border: none; border-radius: 50%; font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ========== 모달 ========== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; }
.modal-close:hover { color: var(--text); }

/* ========== 탭 ========== */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; }
.tab-btn {
  padding: 10px 16px; border: none; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ========== 스켈레톤 로딩 ========== */
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ========== 홈 히어로 ========== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white; padding: 48px 16px; text-align: center; margin-bottom: 0;
}
.hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.hero p { font-size: 16px; opacity: 0.9; margin-bottom: 24px; }
.hero-search {
  max-width: 480px; margin: 0 auto;
  display: flex; background: white; border-radius: 24px;
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.hero-search input { flex: 1; padding: 12px 20px; border: none; outline: none; font-size: 15px; }
.hero-search button { padding: 12px 20px; background: var(--accent); border: none; color: white; font-size: 15px; cursor: pointer; }
.hero-search button:hover { background: #d97706; }

/* ========== 섹션 ========== */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title h2 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title a { font-size: 13px; color: var(--primary); }

/* ========== 카테고리 그리드 ========== */
/* 1열(3개) + 2열(6개) 고정 레이아웃 */
.category-grid { display: flex; flex-direction: column; gap: 10px; }
.category-row-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.category-row-bottom { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.category-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 8px; text-align: center; cursor: pointer;
  transition: all 0.2s; text-decoration: none; color: var(--text);
}
.category-card:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.category-icon { font-size: 22px; margin-bottom: 5px; }
.category-name { font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  .category-row-top { grid-template-columns: repeat(3, 1fr); }
  .category-row-bottom { grid-template-columns: repeat(3, 1fr); }
}

/* ========== 포스트 그리드 ========== */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-list-item {
  background: white; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; display: flex; gap: 16px; transition: box-shadow 0.2s;
}
.post-list-item:hover { box-shadow: var(--shadow-md); }
.post-list-thumb {
  width: 80px; height: 80px; border-radius: var(--radius);
  background: var(--primary-light); flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--primary);
}
.post-list-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ========== 뱃지 ========== */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* ========== 유저 카드 ========== */
.user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: white;
}
.user-info { flex: 1; }
.user-name { font-weight: 600; font-size: 14px; }
.user-school { font-size: 12px; color: var(--text-muted); }

/* ========== 필터 바 ========== */
.filter-bar {
  background: white; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 16px; margin-bottom: 16px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.filter-bar select, .filter-bar input { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }

/* ========== 빈 상태 ========== */
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-desc { font-size: 14px; margin-bottom: 20px; }

/* ========== 드롭다운 ========== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 180px; z-index: 150; overflow: hidden;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-size: 14px; color: var(--text);
  cursor: pointer; border: none; background: transparent; width: 100%;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ========== 반응형 ========== */
@media (max-width: 640px) {
  .hero h1 { font-size: 22px; }
  .post-grid { grid-template-columns: 1fr; }
  .category-row:first-child { grid-template-columns: repeat(3, 1fr) !important; }
  .category-row:last-child { grid-template-columns: repeat(3, 1fr) !important; }
  .category-name { font-size: 10px; }
  .header-search { display: none; }
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
}

/* ========== 스크롤바 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== 관리자 ========== */
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.admin-stat-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.admin-stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.admin-stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--bg); padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--bg); }
.data-table input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* ========== 토스트 알림 ========== */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2937; color: white;
  padding: 12px 20px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.info { background: #1e3a8a; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== 로딩 스피너 ========== */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-dark { border-color: rgba(0,0,0,0.1); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 48px; }
