@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root { --accent: #ff613c; --gold: #f5c842; --blue: #4787d6; --nav-h: 70px; }

html, body {
  height: 100%;
  font-family: 'Pretendard', sans-serif;
  background: #f4f6f9;
  color: #1b2230;
  overflow-x: hidden;
}

/* ── NAV ── */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: #53A3F8; }
.nav-inner { max-width: 1400px; margin: 0 auto; padding: 0 2rem; height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; }
.nav-logo img { height: 24px; display: block; }
.nav-menu { display: flex; list-style: none; gap: 2rem; }
.nav-menu a { color: #fff; text-decoration: none; font-size: 17px; font-weight: 500; }
.nav-menu a:hover { color: var(--gold); }
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 26px; height: 2px; background: #fff; border-radius: 2px; }
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .nav-menu {
    position: fixed; top: var(--nav-h); right: 0; width: 60%; max-width: 420px;
    height: calc(100dvh - var(--nav-h)); flex-direction: column; gap: 0;
    background: rgba(255,255,255,0.97); padding: 1rem 0;
    transform: translateX(100%); opacity: 0; visibility: hidden;
    transition: transform 0.35s cubic-bezier(.4,0,.2,1); pointer-events: none; overflow-y: auto;
  }
  .nav-menu.open { transform: translateX(0); opacity: 1; visibility: visible; pointer-events: all; }
  .nav-menu li { padding: 0.75rem 1.25rem; }
  .nav-menu a { color: #1b2230; }
}

/* ── PAGE LAYOUT ── */
.qna-page { min-height: 100vh; padding-top: var(--nav-h); }
.qna-wrap { max-width: 1100px; margin: 0 auto; padding: 60px 20px 80px; }
.page-title { text-align: center; margin-bottom: 2.5rem; }
.page-title h1 { font-size: clamp(1.8rem, 4vw, 2.2rem); font-weight: 800; color: #1c3f68; letter-spacing: -0.03em; }
.page-title h1 .accent { color: #2d82e7; }
.page-title p { margin-top: 0.6rem; font-size: 1rem; color: #6d7f98; }

/* ── CARD ── */
.qna-card { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 14px; overflow: hidden; }

/* ── TOOLBAR ── */
.qna-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.qna-search { display: flex; gap: 0.5rem; }
.qna-search input { height: 40px; border: 1.5px solid #d6e1ef; border-radius: 10px; padding: 0 0.9rem; font-size: 0.9rem; font-family: inherit; color: #1b2230; background: #fff; outline: none; }
.qna-search input:focus { border-color: #53A3F8; box-shadow: 0 0 0 3px rgba(83,163,248,0.15); }

/* ── BUTTONS ── */
.qna-search button, .btn-write, .btn-list, .btn-edit, .btn-del {
  height: 40px; padding: 0 1.1rem; border: none; border-radius: 10px;
  font-size: 0.9rem; font-weight: 700; cursor: pointer; font-family: inherit;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none;
}
.qna-search button { background: #53A3F8; color: #fff; }
.qna-search button:hover { background: #3a8eea; }
.btn-write { background: #2d82e7; color: #fff; }
.btn-write:hover { background: #1c6ed0; }
.btn-list { background: #edf2f9; color: #4a5a70; }
.btn-list:hover { background: #dbe6f5; }
.btn-edit { background: #2d82e7; color: #fff; height: 40px; }
.btn-edit:hover { background: #1c6ed0; }
.btn-del { background: #ff613c; color: #fff; height: 40px; border: none; }
.btn-del:hover { background: #e04e2b; }
.btn-submit {
  height: 48px; padding: 0 2rem; background: #53A3F8; color: #fff;
  border: none; border-radius: 12px; font-size: 1rem; font-weight: 700;
  cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-submit:hover { background: #3a8eea; }
.btn-cancel-link {
  height: 48px; padding: 0 1.5rem; background: #edf2f9; color: #4a5a70;
  border: none; border-radius: 12px; font-size: 1rem; font-weight: 700;
  cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; text-decoration: none;
}
.btn-cancel-link:hover { background: #dbe6f5; }

/* ── TABLE ── */
.qna-table { width: 100%; border-collapse: collapse; }
.qna-table th { background: #f8faff; color: #4a5a70; font-size: 0.82rem; font-weight: 700; padding: 0.85rem 1rem; border-bottom: 1.5px solid #e2e8f0; text-align: center; }
.qna-table td { padding: 0.9rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: 0.92rem; color: #1b2230; vertical-align: middle; }
.qna-table tr:last-child td { border-bottom: none; }
.qna-table tr:hover td { background: #f8fbff; }
.td-no { text-align: center; width: 60px; color: #9ca3af; }
.td-title { text-align: left; }
.td-title a { color: #1b2230; text-decoration: none; font-weight: 600; }
.td-title a:hover { color: #2d82e7; }
.td-author { text-align: center; width: 150px; color: #4a5a70; }
.td-date { text-align: center; width: 150px; color: #9ca3af; font-size: 0.85rem; }
.empty-row td { text-align: center; padding: 3rem 1rem; color: #9ca3af; font-size: 0.95rem; }

/* ── PAGINATION ── */
.pagination { display: flex; justify-content: center; gap: 0.3rem; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  text-decoration: none; border: 1.5px solid #e2e8f0; color: #4a5a70; background: #fff;
}
.pagination a:hover { background: #f0f7ff; border-color: #53A3F8; color: #2d82e7; }
.pagination span.active { background: #53A3F8; color: #fff; border-color: #53A3F8; }
.pagination span.disabled { color: #c5cdd9; cursor: default; }

/* ── FORM ── */
.qna-form { padding: 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.form-row { display: flex; flex-direction: column; gap: 0.4rem; }
.form-row label { font-size: 0.88rem; font-weight: 700; color: #4a5a70; }
.form-row label .req { color: #ff613c; margin-left: 2px; }
.form-row input, .form-row textarea {
  width: 100%; border: 1.5px solid #d6e1ef; border-radius: 10px;
  padding: 0.7rem 0.9rem; font-size: 0.95rem; font-family: inherit;
  color: #1b2230; background: #f8fbff; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-row input:focus, .form-row textarea:focus { border-color: #53A3F8; background: #fff; box-shadow: 0 0 0 3px rgba(83,163,248,0.15); }
.form-row textarea { resize: vertical; min-height: 200px; line-height: 1.75; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }

/* ── ALERTS ── */
.err-box { background: #fff2f0; border: 1.5px solid #ffc5bb; border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.9rem; color: #c0392b; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.msg-box { background: #f0fff4; border: 1.5px solid #b7ebc6; border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.9rem; color: #276749; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

/* ── VIEW ── */
.view-title { padding: 1.25rem 1.5rem; border-bottom: 1px solid #e2e8f0; }
.view-title h2 { font-size: 1.25rem; font-weight: 800; color: #1b2230; line-height: 1.4; }
.view-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; padding: 0.85rem 1.5rem; border-bottom: 1px solid #e2e8f0; background: #f8faff; }
.view-meta-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.83rem; color: #6d7f98; }
.view-meta-item i { color: #53A3F8; font-size: 0.78rem; }
.view-content { padding: 1.75rem 1.5rem; min-height: 160px; line-height: 1.9; font-size: 0.96rem; color: #374151; white-space: pre-wrap; word-break: break-word; }
.view-actions { display: flex; gap: 0.6rem; align-items: center; padding: 1rem 1.5rem; border-top: 1.5px solid #e2e8f0; background: #f8faff; }
.view-actions .spacer { flex: 1; }

/* ── ANSWERS ── */
.view-answers { border-top: 1.5px solid #e2e8f0; }
.view-answers-head {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.9rem 1.5rem;
  background: #f0f7ff;
  border-bottom: 1px solid #dbeafe;
  font-size: 0.88rem; font-weight: 800; color: #1c4f9c;
}
.view-answers-head i { color: #53A3F8; font-size: 0.9rem; }
.view-answers-body { padding: 1.1rem 1.5rem; display: flex; flex-direction: column; gap: 0.9rem; }
.answer-card {
  border-left: 3px solid #53A3F8;
  background: #f8fbff;
  border-radius: 0 10px 10px 0;
  padding: 0.9rem 1.1rem;
}
.answer-card-meta {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem; font-size: 0.8rem;
}
.answer-card-author {
  font-weight: 800; color: #2d82e7;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.answer-card-author i { font-size: 0.75rem; }
.answer-card-date { color: #9ca3af; margin-left: auto; }
.answer-card-content {
  font-size: 0.94rem; color: #1b2230; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
}

/* ── PREV / NEXT ── */
.nav-posts { margin-top: 1.2rem; background: #fff; border: 1.5px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.nav-post-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.nav-post-item:last-child { border-bottom: none; }
.nav-post-label { font-size: 0.78rem; font-weight: 700; color: #53A3F8; background: #edf6ff; padding: 0.22rem 0.7rem; border-radius: 100px; white-space: nowrap; flex-shrink: 0; }
.nav-post-title { min-width: 0; }
.nav-post-title a { font-size: 0.92rem; color: #1b2230; text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.nav-post-title a:hover { color: #2d82e7; }
.nav-post-none { font-size: 0.92rem; color: #9ca3af; }

/* ── QNA AUTH MODAL ── */
.qna-modal-bg { position: fixed; inset: 0; background: rgba(16,28,44,0.58); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 3000; }
.qna-modal-bg.open { display: flex; }
.qna-modal { width: min(440px, 100%); background: #fff; border-radius: 20px; box-shadow: 0 20px 60px rgba(16,28,44,0.22); overflow: hidden; animation: qnaModalIn 0.28s cubic-bezier(.4,0,.2,1); }
@keyframes qnaModalIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.qna-modal-head { background: linear-gradient(135deg, #53A3F8 0%, #3a8eea 100%); padding: 1.2rem 1.25rem 1rem; position: relative; text-align: center; }
.qna-modal-head h3 { font-size: 1.1rem; font-weight: 800; color: #fff; }
.qna-modal-head p { font-size: 0.82rem; color: rgba(255,255,255,0.85); margin-top: 0.25rem; line-height: 1.45; }
.qna-modal-close { position: absolute; top: 0.9rem; right: 0.9rem; width: 30px; height: 30px; border: none; border-radius: 50%; background: rgba(255,255,255,0.2); color: #fff; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qna-modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.9rem; }
.qna-modal-field { display: flex; flex-direction: column; gap: 0.35rem; }
.qna-modal-field label { font-size: 0.8rem; font-weight: 700; color: #4a5a70; }
.qna-modal-field input { width: 100%; height: 46px; border: 1.5px solid #d6e1ef; border-radius: 10px; padding: 0 0.9rem; font-size: 0.95rem; font-family: inherit; color: #1b2230; background: #f8fbff; outline: none; }
.qna-modal-field input:focus { border-color: #53A3F8; background: #fff; box-shadow: 0 0 0 3px rgba(83,163,248,0.15); }
.qna-modal-err { font-size: 0.85rem; color: #c0392b; font-weight: 600; padding: 0 1.25rem 0.25rem; display: none; }
.qna-modal-err.show { display: block; }
.qna-modal-foot { display: flex; gap: 0.6rem; padding: 0 1.25rem 1.25rem; }
.qna-modal-btn { flex: 1; height: 46px; border: none; border-radius: 12px; font-size: 0.92rem; font-weight: 700; cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 0.35rem; transition: opacity 0.15s; }
.qna-modal-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.qna-modal-btn-cancel { background: #edf2f9; color: #4a5a70; }
.qna-modal-btn-cancel:hover:not(:disabled) { background: #dbe6f5; }
.qna-modal-btn-confirm { background: linear-gradient(135deg, #53A3F8 0%, #3a8eea 100%); color: #fff; }
.qna-modal-btn-del { background: linear-gradient(135deg, #ff613c 0%, #e04e2b 100%); color: #fff; }

/* ── TOAST ── */
#qnaToast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: #1b2230; color: #fff; padding: 0.7rem 1.5rem;
  border-radius: 100px; font-size: 0.9rem; font-weight: 600;
  z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s; white-space: nowrap;
}
#qnaToast.show { opacity: 1; }

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .qna-wrap { padding: 40px 12px 60px; }
  .form-grid2 { grid-template-columns: 1fr; }
  .td-author, .td-date { display: none; }
  .view-meta { gap: 0.65rem; }
  .view-actions { flex-wrap: wrap; }
}
