@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #131313;
  --bg-secondary: #1a1a1a;
  --bg-card: #1c1c1c;
  --bg-sidebar: #181818;
  --bg-hover: #252525;
  --accent: #e07b39;
  --accent-hover: #f08c4a;
  --accent-dim: rgba(224, 123, 57, 0.15);
  --border: #2a2a2a;
  --border-light: #333333;
  --text-primary: #ffffff;
  --text-secondary: #a8a8a8;
  --text-muted: #666666;
  --sidebar-width: 210px;
  --topbar-height: 50px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 0.2s ease;
}

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

html, body {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  line-height: 1;
}

.sidebar-logo-subtitle {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
  flex-shrink: 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
}

.sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: currentColor;
}

.sidebar-updates {
  padding: 12px 16px 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  flex: 1;
  min-height: 0;
}

.sidebar-updates-title {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.sidebar-update-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-update-item:last-child {
  border-bottom: none;
}

.sidebar-update-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-update-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* ===== MAIN TOP BAR ===== */
.main-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
}

.topbar-hamburger {
  display: none;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.topbar-hamburger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.topbar-logo-mobile {
  display: none;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 1px;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-search-area {
  flex: 1;
  min-width: 0;
  max-width: 480px;
}

.topbar-search-area .search-container {
  margin: 0;
  width: 100%;
}

.topbar-search-area .search-input {
  width: 100%;
}

.topbar-search-area .search-input input {
  width: 100%;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.topbar-search-area .search-input input:focus {
  border-color: var(--accent);
}

.topbar-search-area .search-input input::placeholder {
  color: var(--text-muted);
}

.topbar-search-area .search-results-container {
  top: calc(100% + 4px);
  left: 0;
  right: 0;
}

/* ===== SEARCH RESULTS (script.js — shared across all pages) ===== */
.search-input {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input input {
  width: 100%;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.search-input input:focus { border-color: var(--accent); }
.search-input input::placeholder { color: var(--text-muted); }

.search-results-container {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  z-index: 300;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}
.search-result-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.search-result-card:last-child { border-bottom: none; }
.search-result-card:hover { background: var(--bg-hover); }
.search-result-card img {
  width: 28px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}
.search-result-card h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}
.no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== TRANSLATE PANEL (shared across all pages) ===== */
.translate-panel {
  position: fixed;
  top: 56px;
  right: 12px;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  z-index: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  display: none;
}
.translate-panel.open { display: block; }
.translate-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.translate-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  transition: color var(--transition);
}
.translate-panel-close:hover { color: var(--text-primary); }
.translate-auto-btn {
  width: 100%;
  padding: 10px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(224,123,57,0.3);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition);
  font-family: inherit;
  margin-bottom: 10px;
}
.translate-auto-btn:hover { background: rgba(224,123,57,0.25); }
.translate-divider {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.translate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.translate-lang-btn {
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: inherit;
}
.translate-lang-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }

.topbar-auth {
  flex-shrink: 0;
  min-width: 80px;
  display: flex;
  justify-content: flex-end;
}

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ===== TOP BAR (chapter page) ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 1px;
  text-decoration: none;
}

.topbar-logo span {
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.topbar-btn:hover {
  color: var(--text-primary);
}

.topbar-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background var(--transition), transform 0.15s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
}

/* ===== AUTH MODAL ===== */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.auth-modal-overlay.open {
  display: flex;
}

.auth-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 420px;
  max-width: 90vw;
  padding: 36px 32px;
  animation: modalIn 0.25s ease;
  position: relative;
}

@keyframes modalIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition);
}

.auth-modal-close:hover {
  color: var(--text-primary);
}

.auth-modal-logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-modal-logo span {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
}

.auth-modal-logo span em {
  color: var(--accent);
  font-style: normal;
}

.auth-modal-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-modal-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition);
  border: none;
  background: none;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form.active {
  display: flex;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.auth-field input {
  padding: 11px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.auth-field input:focus {
  border-color: var(--accent);
}

.auth-field input::placeholder {
  color: var(--text-muted);
}

.auth-submit {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 4px;
}

.auth-submit:hover {
  background: var(--accent-hover);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-google-btn {
  width: 100%;
  padding: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
}

.auth-google-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.auth-google-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== NOTIFICATION BELL (sidebar) ===== */
.sidebar-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

/* ===== NOTIFICATION PANEL ===== */
.notif-panel {
  position: fixed;
  top: 60px;
  left: var(--sidebar-width);
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  z-index: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
}
.notif-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ===== NOTIFICATION PANEL OVERLAY (used by notifications.js) ===== */
#notificationPanel {
  position: fixed;
  top: 56px;
  right: 16px;
  width: 360px;
  max-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  z-index: 600;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#notificationPanel.opacity-100.visible.scale-100 {
  opacity: 1 !important;
  visibility: visible !important;
  transform: scale(1) translateY(0) !important;
  pointer-events: all;
}
.notif-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-panel-mark-btn {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}
.notif-panel-mark-btn:hover { background: var(--accent-dim); }
.notif-panel-close-btn {
  width: 24px;
  height: 24px;
  background: var(--bg-hover);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}
.notif-panel-close-btn:hover { color: var(--text-primary); background: var(--border-light); }
#notificationContent {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#notificationContent::-webkit-scrollbar { width: 4px; }
#notificationContent::-webkit-scrollbar-track { background: transparent; }
#notificationContent::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.notif-panel-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.notif-footer-btn {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.notif-footer-btn:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 900px) {
  #notificationPanel {
    right: 8px;
    left: 8px;
    width: auto;
    top: 56px;
  }
}

/* ===== NOVEL/CHAPTER MOBILE TOPBAR ACTION ICONS ===== */
.mob-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mob-topbar-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}
.mob-topbar-btn:hover { color: var(--text-primary); }
.mob-topbar-btn i { font-size: 16px; }
.mob-topbar-btn svg { width: 18px; height: 18px; fill: currentColor; }
.mob-notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--bg-primary);
  display: none;
}

/* ===== NOVEL PAGE TRANSLATE PANEL ===== */
.novel-translate-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px;
  z-index: 400;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}
.novel-translate-panel.open { display: block; }
.novel-translate-panel button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.novel-translate-panel button:hover { background: var(--bg-hover); color: var(--text-primary); }
.novel-translate-panel-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px 6px;
}

/* ===== NOVEL PAGE READING SETTINGS PANEL (mobile Tt) ===== */
.novel-tt-panel {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  z-index: 400;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  display: none;
}
.novel-tt-panel.open { display: block; }
.novel-tt-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.novel-tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.novel-tt-label { font-size: 13px; color: var(--text-secondary); }
.novel-tt-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.novel-tt-stepper button {
  width: 28px;
  height: 28px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.novel-tt-stepper span { font-size: 13px; color: var(--text-primary); min-width: 32px; text-align: center; }

/* ===== AUTH FORMS (legacy structure used by auth.js restoreDefaultForms) ===== */
.auth-modal-overlay {
  overflow-y: auto;
}

.wrapper {
  width: 100%;
}

.form {
  position: relative;
  padding: 12px 0;
}

.form header {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 16px;
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.form.login { display: none; }
.wrapper.active .form.login { display: block; }
.wrapper.active .form.signup { display: none; }

.wrapper .form form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wrapper .form form input[type="text"],
.wrapper .form form input[type="email"],
.wrapper .form form input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.wrapper .form form input[type="text"]:focus,
.wrapper .form form input[type="email"]:focus,
.wrapper .form form input[type="password"]:focus {
  border-color: var(--accent);
}

.wrapper .form form input[type="text"]::placeholder,
.wrapper .form form input[type="email"]::placeholder,
.wrapper .form form input[type="password"]::placeholder {
  color: var(--text-muted);
}

.wrapper .form form input[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}

.wrapper .form form input[type="submit"]:hover {
  background: var(--accent-hover);
}

.wrapper .form form a {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  text-decoration: none;
  transition: color var(--transition);
}

.wrapper .form form a:hover { color: var(--accent); }

.wrapper .form .checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.wrapper .form .auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 8px 0;
  position: relative;
}

.wrapper .form .auth-divider::before,
.wrapper .form .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: var(--border);
}

.wrapper .form .auth-divider::before { left: 0; }
.wrapper .form .auth-divider::after { right: 0; }

.google-btn {
  width: 100%;
  padding: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
}

.google-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.auth-error-message {
  color: #e05555;
  font-size: 12px;
  padding: 8px 12px;
  background: rgba(224, 85, 85, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224, 85, 85, 0.2);
}

/* User dropdown (after login) */
.user-dropdown { position: relative; }

.user-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}

.user-btn:hover { background: var(--bg-hover); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  min-width: 140px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  z-index: 200;
}

.dropdown-menu.hidden { display: none; }

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Login button (before login) */
.login-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.login-btn:hover { background: var(--accent-hover); }

/* ===== AUTH PLACEHOLDER in sidebar ===== */
.sidebar-auth-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ===== FOOTER ===== */
.footer {
  margin-left: var(--sidebar-width);
  padding: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-210px);
    transition: transform 0.3s ease;
    width: 210px;
    z-index: 300;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .topbar-hamburger {
    display: flex !important;
  }

  .topbar-logo-mobile {
    display: block !important;
  }

  .main-topbar {
    left: 0;
  }

  .page-wrapper {
    margin-left: 0;
  }

  .footer {
    margin-left: 0;
  }

  .sidebar-overlay {
    z-index: 299;
  }
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

.sidebar-overlay.open {
  display: block;
}

/* ===== TOPBAR RIGHT CLUSTER — globe+bell+auth grouped far right ===== */
.main-topbar .topbar-right-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.main-topbar .topbar-right-cluster .topbar-auth {
  margin-left: 0;
}

/* ===== CHAPTER PAGE DESKTOP TOPBAR (no sidebar, left:0) ===== */
.main-topbar.no-sidebar {
  left: 0 !important;
}

/* ===== DISCUSSION PAGE — TOPBAR PUSH-DOWN ===== */
@media (min-width: 769px) {
  .disc-root {
    padding-top: var(--topbar-height);
  }
}

/* ===== NOTIFICATION ITEMS ===== */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
}
.notif-empty-icon {
  width: 52px;
  height: 52px;
  background: var(--bg-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.notif-empty-svg { width: 26px; height: 26px; fill: var(--text-muted); }
.notif-empty-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0 0 4px; }
.notif-empty-text { font-size: 12px; color: var(--text-muted); margin: 0; }
.notif-item {
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border-left: 3px solid var(--accent);
  margin-bottom: 3px;
  transition: background var(--transition);
  background: var(--bg-secondary);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.notif-item-left { display: flex; align-items: center; gap: 5px; }
.notif-item-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.notif-item-emoji { font-size: 12px; line-height: 1; }
.notif-item-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.notif-type--feature { background: #22c55e; }
.notif-type--bugfix { background: #ef4444; }
.notif-type--maintenance { background: #eab308; color: #111 !important; }
.notif-type--update { background: #3b82f6; }
.notif-type--security { background: #a855f7; }
.notif-type--chapter { background: var(--accent); }
.notif-type--announcement { background: #6366f1; }
.notif-type--reply { background: #2563eb; }
.notif-type--like { background: #ec4899; }
.notif-type--mention { background: #16a34a; }
.notif-type--default { background: var(--text-muted); }
.notif-unread-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.notif-item-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.notif-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.notif-dismiss-btn:hover { color: var(--text-primary); background: var(--border-light); }
.notif-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
  line-height: 1.3;
}
.notif-item-body { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }

/* ===== TOPBAR NOTIFICATION BELL ===== */
.topbar-notif-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
  flex-shrink: 0;
}
.topbar-notif-btn:hover { color: var(--text-primary); }
.topbar-notif-btn i { font-size: 16px; }
.topbar-notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--bg-secondary);
}

/* ===== KO-FI MOBILE FIX — ABOVE BOTTOM NAV ===== */
@media (max-width: 768px) {
  #kofi-widget-overlay-iframe-container,
  .floatingchat-container-wrap,
  .kofi-button-container {
    bottom: 68px !important;
  }
}

/* ===== SHARED MOBILE BOTTOM NAV (faq, terms pages) ===== */
.page-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 200;
}
@media (max-width: 768px) {
  .page-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
  }
}
.page-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 6px 10px;
  flex: 1;
  transition: color var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.page-bottom-nav-item.active,
.page-bottom-nav-item:hover { color: var(--accent); }
.page-bottom-nav-item i { font-size: 19px; }
