* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
}

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }

/* Navbar */
.navbar {
  background: #1a1a2e;
  padding: 0.8rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-brand { color: #fff; font-size: 1.4rem; font-weight: 700; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: #ccc; text-decoration: none; font-size: 0.9rem; padding: 0.4rem 0.8rem; border-radius: 4px; transition: background 0.2s; }
.nav-links a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-logout { color: #ff6b6b !important; }
.nav-badge { background: #e63946; color: #fff; font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 10px; margin-left: 0.3rem; font-weight: 700; }
.nav-badge.wallet-badge { background: #4361ee; }

/* Auth */
.auth-container { max-width: 400px; margin: 4rem auto; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.auth-container h1 { margin-bottom: 1.5rem; text-align: center; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 0.6rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.95rem;
}
.form-group textarea { resize: vertical; }
.form-inline { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline input { padding: 0.6rem; border: 1px solid #ddd; border-radius: 4px; }

/* Buttons */
.btn { padding: 0.6rem 1.2rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; text-decoration: none; display: inline-block; transition: opacity 0.2s; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: #4361ee; color: #fff; }
.btn-success { background: #2ec4b6; color: #fff; }
.btn-danger { background: #e63946; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 1.5rem; }
.card h2 { margin-bottom: 1rem; font-size: 1.1rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.stat-card { background: #fff; padding: 1.5rem; border-radius: 8px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.stat-card h3 { font-size: 2rem; color: #4361ee; }
.stat-card p { color: #666; margin-top: 0.3rem; }
.stat-card.highlight h3 { color: #e63946; }

/* Topics */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.topic-card { background: #f8f9fa; padding: 1.2rem; border-radius: 8px; border: 1px solid #eee; }
.topic-card h3 { margin-bottom: 0.3rem; }
.topic-card p { color: #666; font-size: 0.9rem; margin-bottom: 0.8rem; }
.topic-actions { display: flex; gap: 0.5rem; }

/* Questions */
.question-item { padding: 1rem; border-bottom: 1px solid #eee; }
.question-item:last-child { border-bottom: none; }
.question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.question-header h3 { font-size: 1rem; }

.question-card { background: #fff; padding: 1rem; border-radius: 8px; border: 1px solid #eee; margin-bottom: 0.8rem; }
.question-status { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.5rem; }
.lock-icon { font-size: 1.2rem; }

/* Badges */
.badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-points { background: #e8f4fd; color: #4361ee; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-type-earned { background: #d4edda; color: #155724; }
.badge-type-claim_requested { background: #fff3cd; color: #856404; }
.badge-type-claim_approved { background: #cce5ff; color: #004085; }
.badge-type-claim_rejected { background: #f8d7da; color: #721c24; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem; border-bottom: 1px solid #eee; font-size: 0.9rem; }
th { font-weight: 600; color: #666; }

/* Code */
.code-block { background: #1a1a2e; color: #a9b7c6; padding: 1rem; border-radius: 6px; margin: 0.8rem 0; overflow-x: auto; }
.code-block pre { font-family: 'Courier New', monospace; font-size: 0.85rem; white-space: pre-wrap; word-wrap: break-word; }
.code-editor { font-family: 'Courier New', monospace; background: #1a1a2e; color: #a9b7c6; border: 1px solid #333 !important; padding: 1rem !important; font-size: 0.9rem; tab-size: 2; }

/* Wallet */
.wallet-card { text-align: center; }
.wallet-balance { color: #4361ee; font-size: 2rem; }
.wallet-card .form-inline { justify-content: center; margin-top: 1rem; }

/* Alerts */
.alert { padding: 0.8rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

.question-detail { margin-bottom: 1.5rem; }
.question-detail p { margin-top: 0.5rem; line-height: 1.6; }

/* Submission */
.submission-item { padding: 1rem; border-bottom: 1px solid #eee; }
.submission-item:last-child { border-bottom: none; }
.submission-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.submission-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }

.text-muted { color: #999; }

h1 { margin-bottom: 0.5rem; }

/* Chat */
.chat-box { max-height: 400px; overflow-y: auto; border: 1px solid #eee; border-radius: 6px; padding: 1rem; margin-bottom: 1rem; background: #f8f9fa; }
.chat-msg { padding: 0.5rem 0.8rem; margin-bottom: 0.5rem; border-radius: 6px; max-width: 80%; }
.chat-msg strong { font-size: 0.8rem; }
.chat-msg p { margin: 0.2rem 0; font-size: 0.9rem; }
.chat-msg small { font-size: 0.7rem; color: #999; }
.chat-admin { background: #e8f4fd; margin-right: auto; }
.chat-user { background: #d4edda; margin-left: auto; }
.chat-input { display: flex; gap: 0.5rem; }
.chat-input input { flex: 1; padding: 0.6rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.9rem; }
.chat-input button { white-space: nowrap; }

/* Hamburger toggle - hidden on desktop */
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0.2rem 0.5rem; }

/* Table responsive wrapper */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ====== Mobile Responsive ====== */
@media (max-width: 768px) {
  /* Navbar */
  .navbar { flex-wrap: wrap; padding: 0.6rem 1rem; }
  .nav-brand { font-size: 1.1rem; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding-top: 0.5rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 0.6rem 0.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
  }

  /* Container */
  .container { padding: 1rem 0.75rem; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .stat-card { padding: 1rem; }
  .stat-card h3 { font-size: 1.5rem; }

  /* Topics */
  .topic-grid { grid-template-columns: 1fr; }
  .topic-actions { flex-wrap: wrap; }

  /* Cards */
  .card { padding: 1rem; }

  /* Forms */
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline input { width: 100%; }
  .form-inline button { width: 100%; }

  /* Auth */
  .auth-container { margin: 1.5rem auto; padding: 1.5rem; }

  /* Questions */
  .question-header { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .question-status { flex-wrap: wrap; gap: 0.5rem; }

  /* Submissions */
  .submission-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .submission-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .submission-meta div { display: flex; flex-wrap: wrap; gap: 0.4rem; }

  /* Tables - horizontal scroll */
  table { display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 0.5rem; font-size: 0.8rem; }

  /* Code */
  .code-block { padding: 0.7rem; }
  .code-block pre { font-size: 0.75rem; }
  .code-editor { font-size: 0.8rem; }

  /* Chat */
  .chat-msg { max-width: 90%; }
  .chat-box { max-height: 300px; padding: 0.7rem; }

  /* Wallet */
  .wallet-balance { font-size: 1.5rem; }
  .wallet-card .form-inline { flex-direction: row; flex-wrap: wrap; }

  /* Buttons */
  .btn { padding: 0.5rem 1rem; font-size: 0.85rem; }
  .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

  /* Headings */
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card h3 { font-size: 1.3rem; }
  .nav-brand { font-size: 0.95rem; }
  .badge { font-size: 0.65rem; padding: 0.15rem 0.4rem; }
  h1 { font-size: 1.1rem; }
}
