/* ===== FORUM CSS ===== */

/* Hard reset untuk elemen form agar tidak ter-override site.css */
.forum-scope textarea,
.forum-scope input[type="text"],
.forum-scope input[type="password"],
.forum-scope input[type="email"] {
  background-color: #ffffff !important;
  color: #14213d !important;
  border: 1.5px solid #e2e8f0 !important;
  -webkit-box-shadow: none !important;
  box-shadow: none !important;
}
.forum-scope textarea:-webkit-autofill,
.forum-scope input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  -webkit-text-fill-color: #14213d !important;
}

/* Auth */
.auth-page { background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 420px; padding: 24px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 40px 36px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.auth-title { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 15px; font-family: inherit;
  background: #fff !important; color: #14213d !important; transition: border-color .2s;
  -webkit-appearance: none; appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
textarea.form-control { resize: vertical; min-height: 120px; background: #fff !important; color: #14213d !important; }

/* Override browser autofill teal/blue background */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  -webkit-text-fill-color: #14213d !important;
  background-color: #fff !important;
  caret-color: #14213d;
}
.req { color: #dc2626; }
.muted-label { color: var(--muted); font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 10px; font-size: 14px;
  font-weight: 600; font-family: inherit; cursor: pointer;
  border: none; text-decoration: none; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line); color: var(--text); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* Nav */
.nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-user { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.badge-admin {
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; letter-spacing: .03em;
}

/* User type badges */
.utype-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.badge-starter { background: #f1f5f9; color: #475569; }
.badge-premium { background: #f5f3ff; color: #7c3aed; }
.badge-gold    { background: #fffbeb; color: #d97706; }

/* Forum main */
.forum-main { padding: 40px 0 80px; }
.forum-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.forum-title { font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.forum-sub { color: var(--muted); margin: 0; font-size: 15px; }

/* Search */
.search-form { display: flex; gap: 10px; margin-bottom: 28px; flex-wrap: wrap; }
.search-form .form-control { flex: 1; min-width: 200px; }

/* Question list */
.question-list { display: flex; flex-direction: column; gap: 12px; }
.question-card {
  display: block; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 20px 24px; transition: all .2s;
  text-decoration: none; color: inherit;
}
.question-card:hover { border-color: var(--primary); box-shadow: 0 4px 20px rgba(29,78,216,.08); transform: translateY(-1px); }
.question-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; color: var(--text); }
.question-excerpt { color: var(--muted); font-size: 14px; margin: 0 0 12px; line-height: 1.5; }
.question-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.answer-badge { font-weight: 600; }
.answer-badge.answered { color: var(--success); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; margin: 0 0 20px; }

/* Pagination */
.pagination { display: flex; gap: 8px; margin-top: 32px; justify-content: center; flex-wrap: wrap; }
.page-btn {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 14px; font-weight: 600; border: 1.5px solid var(--line);
  color: var(--text); text-decoration: none; transition: all .2s;
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Question detail */
.question-detail-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 32px; margin-bottom: 24px;
}
.question-detail-header { margin-bottom: 20px; }
.question-detail-title { font-size: 24px; font-weight: 800; margin: 0 0 10px; }
.question-detail-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.question-detail-body { font-size: 16px; line-height: 1.75; color: var(--text); }
.question-detail-body p { margin: 0 0 10px; }
.question-detail-body p:last-child { margin-bottom: 0; }
/* Question images */
.question-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.question-thumb {
  width: 160px; height: 120px; object-fit: cover;
  border-radius: 10px; cursor: zoom-in;
  border: 1.5px solid var(--line);
  transition: transform .2s, box-shadow .2s;
}
.question-thumb:hover { transform: scale(1.04); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.question-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Answers / Thread */
.answers-section { margin-bottom: 24px; }
.answers-title { font-size: 18px; font-weight: 700; margin: 0 0 16px; }

/* Thread posts */
.thread-post {
  display: flex; gap: 14px; margin-bottom: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px; padding: 18px 20px;
  align-items: flex-start;
}
.thread-admin { border-color: #bfdbfe; background: #f0f7ff; }
.thread-user  { border-color: var(--line); background: var(--card); }
.thread-avatar { flex-shrink: 0; width: 36px; min-width: 36px; padding-top: 2px; }
.thread-content { flex: 1; min-width: 0; width: 0; }
.thread-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; gap: 8px; flex-wrap: wrap;
}
.thread-author { display: flex; align-items: center; gap: 8px; }
.thread-name   { font-weight: 700; font-size: 14px; }
.thread-meta-right { display: flex; align-items: center; gap: 10px; }
.thread-date   { font-size: 12px; color: var(--muted); }
.thread-delete { font-size: 14px; text-decoration: none; opacity: .45; transition: opacity .2s; }
.thread-delete:hover { opacity: 1; }

.answer-body { font-size: 15px; line-height: 1.75; }
.answer-body p { margin: 0 0 10px; }
.answer-body p:last-child { margin-bottom: 0; }

/* Reply form */
.reply-form-wrap {
  display: flex; gap: 14px; margin-top: 8px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 18px 20px;
  align-items: flex-start;
}
.reply-form-avatar { flex-shrink: 0; width: 36px; min-width: 36px; padding-top: 2px; }
.reply-form-body   { flex: 1; min-width: 0; width: 0; }
.reply-form-label  { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text); }

/* Answer form (admin panel compat) */
.answer-form-section {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 28px;
}
.answer-form-section h3 { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.waiting-notice {
  background: #fffbeb; border: 1.5px solid #fde68a;
  border-radius: 12px; padding: 16px 20px; color: #92400e;
  font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}

/* Avatar */
.avatar {
  width: 36px !important; height: 36px !important; border-radius: 50% !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  color: #fff !important; font-weight: 800; font-size: 14px;
  flex-shrink: 0 !important; user-select: none;
  min-width: 36px !important; max-width: 36px !important;
  box-sizing: border-box !important;
}

/* Ask form */
.ask-form { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 32px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* Upload */
.multi-upload-area {
  border: 2px dashed var(--line); border-radius: 12px;
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color .2s; position: relative; min-height: 120px;
}
.multi-upload-area:hover { border-color: var(--primary); }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-placeholder .upload-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.upload-placeholder p { margin: 0 0 4px; font-weight: 600; }
.upload-placeholder small { color: var(--muted); }
.preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 8px; }
.preview-item { border-radius: 10px; overflow: hidden; position: relative; background: var(--bg); border: 1px solid var(--line); }
.preview-item img { width: 100%; height: 160px; object-fit: cover; display: block; }
.preview-size { position: absolute; bottom: 6px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.preview-error { padding: 20px; color: #dc2626; font-size: 13px; font-weight: 600; text-align: center; }
.upload-info { margin-top: 8px; font-size: 13px; }
.text-warn { color: #d97706; font-weight: 600; }

/* Lightbox */
.lightbox {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
  z-index: 1000; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 12px; }

/* Admin */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 20px; text-align: center; }
.stat-card.stat-warn { border-color: #fde68a; background: #fffbeb; }
.stat-num { font-size: 36px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-card.stat-warn .stat-num { color: #d97706; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 600; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .admin-grid { grid-template-columns: 1fr; } }

.admin-panel { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 28px; }
.panel-title { font-size: 17px; font-weight: 700; margin: 0 0 20px; }

.pending-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.pending-list li { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.pending-list li:last-child { border-bottom: none; padding-bottom: 0; }
.pending-link { font-weight: 600; font-size: 14px; color: var(--primary); text-decoration: none; display: block; margin-bottom: 2px; }
.pending-link:hover { text-decoration: underline; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 10px 14px; background: var(--bg); font-weight: 700; border-bottom: 2px solid var(--line); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 8px; align-items: center; }

.reset-row td { background: #f8faff; padding: 12px 14px; }
.reset-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Footer */
.forum-footer { border-top: 1px solid var(--line); padding: 24px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* Responsive */
@media (max-width: 600px) {
  .forum-header-row { flex-direction: column; }
  .question-detail-card, .ask-form, .answer-form-section, .admin-panel { padding: 20px; }
  .auth-card { padding: 28px 20px; }
  .nav-right { gap: 6px; }
}
