/* W2W theme */
:root {
  --bg-primary: #313338;
  --bg-secondary: #2b2d31;
  --bg-tertiary: #1e1f22;
  --text: #f2f3f5;
  --text-muted: #b5bac1;
  --text-link: #00a8fc;
  --border: #3f4147;
  --radius: 8px;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --font: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg-primary); color: var(--text); line-height: 1.5; font-size: 16px; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-primary { background: var(--blurple); color: white; }
.btn-primary:hover { background: var(--blurple-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.card { background: var(--bg-secondary); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); }

input, select, textarea { font-family: var(--font); font-size: 14px; padding: 10px 12px; border: none; border-radius: 4px; background: var(--bg-tertiary); color: var(--text); width: 100%; }
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 12px; color: var(--text-muted); }
.errorlist { color: #ed4245; font-size: 14px; list-style: none; padding: 0; margin: 0 0 12px; }

/* Header */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.top-header { height: 56px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; position: sticky; top: 0; z-index: 100; }
.top-header .header-left { display: flex; align-items: center; gap: 12px; }
.top-header .header-center { position: absolute; left: 50%; transform: translateX(-50%); }
.top-header .header-center a { font-size: 1.5rem; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: 0.05em; }
.top-header .header-center a:hover { color: var(--blurple); }
.top-header .header-right { display: flex; align-items: center; gap: 12px; }
.menu-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; font-size: 1.25rem; }
.menu-btn:hover { color: var(--text); }
.notif-wrap { position: relative; }
.notif-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; font-size: 1.25rem; text-decoration: none; }
.notif-btn:hover { color: var(--text); }
.notif-badge { position: absolute; top: 2px; right: 2px; background: #ed4245; color: white; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.profile-photo-link { width: 32px; height: 32px; border-radius: 50%; background: var(--blurple); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; text-decoration: none; overflow: hidden; }
.profile-photo-link img { width: 100%; height: 100%; object-fit: cover; }

/* Sidebar */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; }
.sidebar-overlay.open { display: block; }
.sidebar { position: fixed; top: 0; left: 0; width: 260px; max-width: 85vw; height: 100vh; background: var(--bg-secondary); border-right: 1px solid var(--border); z-index: 201; transform: translateX(-100%); transition: transform 0.2s; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar.open { transform: translateX(0); }
.sidebar-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; }
.sidebar-nav { padding: 56px 12px 24px; flex: 1; display: flex; flex-direction: column; }
.sidebar-nav a { display: block; padding: 12px 16px; border-radius: var(--radius); color: var(--text); text-decoration: none; margin-bottom: 4px; }
.sidebar-nav a:hover { background: rgba(79,84,92,0.16); }
.sidebar-nav .sidebar-bottom { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--border); }
.sidebar-nav .sidebar-bottom a { display: block; padding: 12px 16px; border-radius: var(--radius); color: var(--text-muted); text-decoration: none; }
.sidebar-nav .sidebar-bottom a:hover { background: rgba(79,84,92,0.16); color: var(--text); }

/* Main content */
.discord-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-primary); }
.main-content { flex: 1; padding: 24px; overflow: auto; }

.landing-body .landing-page a { text-decoration: none; }
.landing-body .landing-page a:hover { text-decoration: none; }

.landing-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.landing-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.landing-card-brand {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blurple);
}
.landing-card-title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.landing-card-tagline {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.landing-card-desc {
  margin: 0 0 24px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn-landing-block { width: 100%; padding: 12px 20px; border-radius: var(--radius); font-size: 15px; font-weight: 600; }

.landing-login-section {
  text-align: left;
  width: 100%;
}
.landing-login-title {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}
.landing-login-form .form-group { margin-bottom: 16px; }
.landing-login-form input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 168, 252, 0.35);
}
.landing-login-submit {
  margin-top: 4px;
  padding: 10px 24px;
  font-weight: 600;
}
.landing-register-hint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.landing-register-link {
  color: var(--text-link);
  font-weight: 500;
}
.landing-body .landing-register-link:hover {
  text-decoration: underline;
}

.landing-form-messages {
  text-align: left;
  margin: 0 0 16px;
}

/* Standalone auth pages (register) */
.auth-standalone-body .auth-footer-link { margin-top: 16px; color: var(--text-muted); text-align: center; }
.auth-standalone-body .auth-footer-link a { color: var(--text-link); }
.auth-standalone-body .auth-footer-link a:hover { text-decoration: underline; }
.auth-standalone-card { max-width: 360px; width: 100%; }
.auth-standalone-title { margin: 0 0 20px; }
.auth-back-row { margin: 0 0 16px; text-align: left; }
.auth-back-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-link);
}
.auth-back-link:hover { text-decoration: underline; }

.btn-landing-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.btn-landing-google:hover {
  background: #25262b;
  border-color: #4e5058;
  color: var(--text);
}
.landing-google-icon { display: flex; align-items: center; flex-shrink: 0; }

.landing-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  width: 100%;
}
.landing-or-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.landing-or-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Legacy landing helpers (if used elsewhere) */
.landing-hero { max-width: 480px; text-align: center; }
.landing-title { font-size: 2.5rem; margin: 0 0 12px; }
.landing-tagline { font-size: 1.25rem; color: var(--text-muted); margin: 0 0 16px; }
.landing-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

.post-card { margin-bottom: 16px; }
.post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.post-content { margin: 0 0 12px; white-space: pre-wrap; }
.post-date { font-size: 12px; color: var(--text-muted); }
.post-actions-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.user-profile-card { max-width: 560px; }
.user-profile-header { display: flex; gap: 16px; margin-bottom: 20px; align-items: flex-start; }
.user-profile-avatar { width: 64px; height: 64px; min-width: 64px; border-radius: 50%; background: var(--blurple); color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600; overflow: hidden; }
.user-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 8px 16px; border-radius: 4px; color: var(--text-muted); background: transparent; border: none; cursor: pointer; font-size: 14px; text-decoration: none; }
.tabs a:hover, .tabs button:hover { color: var(--text); background: rgba(79,84,92,0.16); }
.tabs .active { background: rgba(79,84,92,0.24); color: var(--text); }
.empty-state { color: var(--text-muted); padding: 24px; text-align: center; }

/* Chat layout */
.chat-layout { display: flex; height: calc(100vh - 56px - 48px); overflow: hidden; }
.chat-left { width: 280px; min-width: 280px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-search { padding: 12px; border-bottom: 1px solid var(--border); }
.chat-search-header { display: flex; gap: 8px; align-items: center; }
.chat-search-form { flex: 1; min-width: 0; }
.chat-new-btn { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-tertiary); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.chat-new-btn:hover { border-color: var(--blurple); color: var(--blurple); }
.chat-partner-list { flex: 1; overflow-y: auto; }
.chat-partner-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.chat-partner-item:hover { background: rgba(79,84,92,0.16); }
.chat-partner-item.selected { background: rgba(79,84,92,0.24); }
.chat-right { flex: 1; display: flex; flex-direction: column; background: var(--bg-primary); }
.chat-thread-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: 8px; }
.chat-thread-user-link { color: var(--text); font-weight: 600; text-decoration: none; }
.chat-thread-user-link:hover { text-decoration: underline; }
.chat-thread-username { color: var(--text-muted); font-size: 13px; }
.chat-thread-body { flex: 1; min-height: 0; }
.chat-messages { height: 100%; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg-row { display: flex; align-items: flex-end; gap: 10px; max-width: 78%; }
.chat-msg-row.mine { margin-left: auto; justify-content: flex-end; }
.chat-msg-row.theirs { margin-right: auto; }
.chat-msg-avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: var(--blurple); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-msg-main { display: flex; flex-direction: column; min-width: 0; }
.chat-msg-sender { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; padding-left: 4px; }
.chat-msg-bubble-wrap { position: relative; }
.chat-msg-bubble { position: relative; border-radius: 18px; padding: 10px 12px; display: inline-flex; align-items: flex-end; gap: 8px; line-height: 1.35; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text); box-shadow: 0 3px 10px rgba(0,0,0,0.18); }
.chat-msg-bubble.mine,
.chat-msg-row.mine .chat-msg-bubble { background: var(--blurple); color: #fff; border-color: transparent; border-bottom-right-radius: 6px; }
.chat-msg-bubble.theirs,
.chat-msg-row.theirs .chat-msg-bubble { background: #3a3d44; color: var(--text); border: 1px solid #5a5f69; border-bottom-left-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.22); }
.chat-msg-bubble.mine::after,
.chat-msg-row.mine .chat-msg-bubble::after { content: ''; position: absolute; right: -6px; bottom: 4px; width: 12px; height: 12px; background: var(--blurple); transform: rotate(45deg); border-bottom-right-radius: 3px; }
.chat-msg-bubble.theirs::after,
.chat-msg-row.theirs .chat-msg-bubble::after { content: ''; position: absolute; left: -7px; bottom: 4px; width: 12px; height: 12px; background: #3a3d44; transform: rotate(45deg); border-left: 1px solid #5a5f69; border-bottom: 1px solid #5a5f69; }
.chat-msg-text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.chat-msg-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-left: 4px; }
.chat-msg-row.mine .chat-msg-meta { justify-content: flex-end; padding-right: 4px; padding-left: 0; }
.chat-msg-time { margin-top: 0; font-size: 11px; color: var(--text-muted); padding-left: 0; }
.chat-translate-wrap { position: relative; }
.chat-translate-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; max-height: 220px; overflow-y: auto; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 18px rgba(0,0,0,0.3); z-index: 60; display: none; padding: 6px; }
.chat-translate-wrap.open .chat-translate-menu { display: block; }
.chat-translate-option { width: 100%; text-align: left; padding: 7px 9px; border: none; border-radius: 6px; background: transparent; color: var(--text); font-size: 12px; cursor: pointer; }
.chat-translate-option:hover { background: rgba(79,84,92,0.2); }
.chat-translate-divider { height: 1px; margin: 6px 4px; background: var(--border); }
.chat-msg-translation { margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: var(--bg-tertiary); color: var(--text-muted); font-size: 12px; border: 1px solid var(--border); max-width: 520px; }
.chat-empty-thread { color: var(--text-muted); text-align: center; padding: 28px 12px; }
.chat-form { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--bg-primary); }
.chat-composer { position: sticky; bottom: 0; z-index: 20; }
.chat-form form { display: flex; gap: 8px; }
.chat-form input,
.chat-form textarea { flex: 1; }
.chat-form textarea { resize: none; min-height: 40px; max-height: 140px; line-height: 1.35; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }

.chat-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 10010; display: none; align-items: center; justify-content: center; padding: 20px; }
.chat-modal-panel { width: min(540px, 100%); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); overflow: hidden; }
.chat-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-modal-header h3 { margin: 0; font-size: 18px; }
.chat-modal-close { padding: 4px 10px; font-size: 22px; line-height: 1; }
.chat-modal-search-wrap { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-modal-list { max-height: 360px; overflow-y: auto; }
.chat-modal-user { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.chat-modal-user:hover { background: rgba(79,84,92,0.16); text-decoration: none; }
.chat-modal-user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blurple); color: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.chat-modal-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-modal-user-meta { min-width: 0; }
.chat-modal-user-name { font-size: 14px; font-weight: 600; color: var(--text); }
.chat-modal-user-username { font-size: 12px; color: var(--text-muted); }
.chat-modal-empty { margin: 0; padding: 24px 16px; color: var(--text-muted); text-align: center; }

/* Notifications dropdown */
.notif-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; width: 320px; max-height: 400px; overflow-y: auto; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 300; }
.notif-dropdown.open { display: block; }
.notif-dropdown .notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-dropdown .notif-item.unread { background: rgba(88,101,242,0.1); }
.notif-dropdown .notif-item a { color: var(--text); text-decoration: none; display: block; }
.notif-dropdown .notif-empty { padding: 24px; color: var(--text-muted); text-align: center; }

/* Messages (Django) */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 8px 12px; margin-bottom: 4px; border-radius: 4px; }
.messages .error { background: rgba(237,66,69,0.2); color: #ed4245; }
.messages .success { background: rgba(35,165,90,0.2); color: #23a55a; }

/* Search with suggestions */
.search-wrap { position: relative; display: inline-block; }
.search-suggestions { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; max-height: 240px; overflow-y: auto; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 50; list-style: none; padding: 0; margin: 0; }
.search-suggestions li { margin: 0; }
.search-suggestions a { display: block; padding: 10px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.search-suggestions a:hover { background: rgba(79,84,92,0.16); }
.search-suggestions a:last-child { border-bottom: none; }
.search-suggestions .suggest-username { font-size: 12px; color: var(--text-muted); }

/* Settings layout */
.settings-page { max-width: 520px; }
.settings-section { margin-bottom: 28px; }
.settings-section h3 { margin: 0 0 8px; font-size: 16px; }
.settings-section p { margin: 0 0 12px; color: var(--text-muted); font-size: 14px; }
/* Notification toggles: grid + narrow wrap so global input{width:100%} cannot span the row */
.settings-checkboxes { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.settings-check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  width: 100%;
}
.settings-check-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  max-width: 2.5rem;
  flex-shrink: 0;
}
.settings-check-wrap input[type="checkbox"] {
  width: 1.125rem !important;
  height: 1.125rem !important;
  min-width: 1.125rem !important;
  max-width: 1.125rem !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none;
  accent-color: var(--blurple);
}
.settings-check-row label {
  margin: 0;
  min-width: 0;
  justify-self: start;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.settings-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.settings-account-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* Translate icon at end of text */
.translate-icon-btn { background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer; padding: 3px 8px; border-radius: 999px; font-size: 12px; line-height: 1; opacity: 0.68; transition: opacity 0.18s ease, border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease; }
.translate-icon-btn svg { width: 18px; height: 18px; display: block; }
.chat-msg-row:hover .translate-icon-btn,
.chat-msg-row:focus-within .translate-icon-btn { opacity: 0.95; }
.translate-icon-btn:hover { border-color: var(--border); background: rgba(255,255,255,0.06); color: var(--text); opacity: 1; }
