/* Base reset & shared component styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg0-hard);
  color: var(--fg1);
  min-height: 100vh;
  padding: 0;
  line-height: 1.4;
}

a {
  color: var(--fg3);
  text-decoration: none;
}
a:hover {
  color: var(--yellow);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg0);
}
::-webkit-scrollbar-thumb {
  background: var(--bg2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg3);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--bg3);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--fg3);
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
}
.theme-toggle-btn:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

/* Auth UI */
.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-btn {
  background: transparent;
  border: 1px solid var(--bg3);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--fg3);
  transition: all 0.2s ease;
  text-decoration: none;
}
.auth-btn:hover {
  border-color: var(--green);
  color: var(--green);
}
.auth-user {
  font-size: 0.85rem;
  color: var(--fg2);
}
.auth-logout {
  background: transparent;
  border: none;
  color: var(--fg3);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
}
.auth-logout:hover {
  color: var(--red);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--bg3);
  font-size: 0.7em;
  color: var(--fg3);
  letter-spacing: 0.04em;
}
.theme-op1 .badge {
  border-radius: 20px;
  border-color: var(--yellow);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  color: var(--fg0);
  font-size: 0.85rem;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  background: var(--green);
  color: #1d2021;
}
.toast-error {
  background: var(--red);
  color: #1d2021;
}
.toast-info {
  background: var(--blue);
  color: #1d2021;
}

/* Unified Nav Header */
.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg0);
  border-bottom: 1px solid var(--bg2);
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-logo {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--fg1);
  text-decoration: none;
  letter-spacing: 0.03em;
}
.nav-logo:hover {
  color: var(--yellow);
}
.nav-subtitle {
  font-size: 0.8em;
  color: var(--fg3);
  letter-spacing: 0.02em;
}
.nav-back {
  font-size: 0.82em;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav-back:hover {
  color: var(--yellow);
}
.nav-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nav-stat-value {
  font-size: 1.6em;
  font-weight: 300;
  color: var(--yellow);
}
.nav-stat-label {
  font-size: 0.7em;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-links {
  display: flex;
  gap: 16px;
}
.nav-links a {
  font-size: 0.85em;
  color: var(--fg3);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover {
  color: var(--yellow);
}
.nav-links a.active {
  color: var(--yellow);
}

.theme-op1 .nav-header {
  border-radius: 0;
}
.theme-op1 .nav-logo {
  font-weight: 500;
}

/* Xaman Ek — Bestiary Navigator */
.xaman-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg1);
  border: 1px solid var(--bg3);
  color: var(--yellow);
  font-size: 1.4em;
  cursor: pointer;
  z-index: 9000;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.xaman-fab:hover {
  border-color: var(--yellow);
  transform: scale(1.08);
}
.theme-op1 .xaman-fab {
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.xaman-panel {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 380px;
  max-height: 60vh;
  background: var(--bg0);
  border: 1px solid var(--bg2);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s ease;
}
.xaman-panel.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.theme-op1 .xaman-panel {
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.xaman-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg2);
}
.xaman-title {
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--yellow);
}
.xaman-close {
  background: none;
  border: none;
  color: var(--fg3);
  cursor: pointer;
  font-size: 1.2em;
  padding: 0 4px;
}
.xaman-close:hover {
  color: var(--fg1);
}

.xaman-search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg1);
}
.xaman-input {
  width: 100%;
  background: var(--bg1);
  border: 1px solid var(--bg2);
  color: var(--fg1);
  padding: 8px 12px;
  font-size: 0.88em;
  font-family: inherit;
  outline: none;
}
.xaman-input:focus {
  border-color: var(--yellow);
}
.theme-op1 .xaman-input {
  border-radius: 8px;
}

.xaman-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.xaman-result {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--bg1);
  transition: background 0.15s;
}
.xaman-result:hover {
  background: var(--bg1);
}
.xaman-result-name {
  font-size: 0.9em;
  color: var(--fg1);
  margin-bottom: 2px;
}
.xaman-result-desc {
  font-size: 0.78em;
  color: var(--fg3);
  line-height: 1.3;
}
.xaman-result-tags {
  margin-top: 4px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.xaman-tag {
  font-size: 0.68em;
  color: var(--aqua);
  padding: 1px 6px;
  border: 1px solid var(--bg3);
  letter-spacing: 0.02em;
}
.theme-op1 .xaman-tag {
  border-radius: 10px;
}

.xaman-hint {
  padding: 12px 16px;
  font-size: 0.82em;
  color: var(--fg3);
}
.xaman-recent-label {
  padding: 4px 16px;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg3);
}
.xaman-recent-item {
  padding: 6px 16px;
  font-size: 0.84em;
  color: var(--fg2);
  cursor: pointer;
}
.xaman-recent-item:hover {
  background: var(--bg1);
  color: var(--fg1);
}

/* ── Tag Pills ── */
.tag-pills {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag-pill {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.72em;
  border: 1px solid var(--bg3);
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.theme-op1 .tag-pill {
  border-radius: 0;
}

/* ── Xaman Ek: Context + Execute + Help ── */
.xaman-context-label {
  padding: 6px 16px;
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
}
.xaman-context-item {
  display: block;
  padding: 6px 16px;
  font-size: 0.84em;
  color: var(--aqua);
  text-decoration: none;
  transition: background 0.15s;
}
.xaman-context-item:hover {
  background: var(--bg1);
}
.xaman-exec-result {
  padding: 12px 16px;
  font-size: 0.85em;
  line-height: 1.5;
}
.xaman-exec-agent {
  color: var(--yellow);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.xaman-exec-answer {
  color: var(--fg1);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.xaman-exec-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--aqua);
  font-size: 0.8em;
  text-decoration: none;
}
.xaman-exec-link:hover {
  text-decoration: underline;
}
.xaman-help {
  padding: 12px 16px;
}
.xaman-help-title {
  color: var(--yellow);
  font-size: 0.9em;
  margin-bottom: 8px;
}
.xaman-help-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--fg2);
  font-size: 0.84em;
  line-height: 1.6;
}
.xaman-help-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--aqua);
  font-size: 0.8em;
  text-decoration: none;
}
.xaman-help-link:hover {
  text-decoration: underline;
}

/* ── Notification Bell ── */
.nav-bell {
  position: relative;
}
.nav-bell-btn {
  background: none;
  border: none;
  color: var(--fg3);
  font-size: 1.1em;
  cursor: pointer;
  position: relative;
  padding: 4px 8px;
  font-family: inherit;
}
.nav-bell-btn:hover {
  color: var(--yellow);
}
.nav-bell-badge {
  position: absolute;
  top: 0;
  right: 2px;
  background: var(--red);
  color: #fff;
  font-size: 0.6em;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 14px;
  text-align: center;
  line-height: 1.3;
}
.nav-bell-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 300px;
  background: var(--bg0-hard, var(--bg0));
  border: 1px solid var(--bg2);
  z-index: 8000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.nav-bell-dropdown.visible {
  display: block;
}
.nav-bell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bg2);
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg3);
}
.theme-op1 .nav-bell-dropdown {
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── User Menu Dropdown ── */
.nav-user-menu {
  position: relative;
}
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--bg3);
  color: var(--fg2);
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  transition: all 0.15s;
}
.nav-user-btn:hover {
  border-color: var(--yellow);
  color: var(--fg1);
}
.nav-user-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--yellow);
  color: var(--bg0);
  font-size: 0.75em;
  font-weight: 700;
  border-radius: 50%;
}
.nav-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-caret {
  font-size: 0.7em;
  color: var(--fg3);
}
.nav-signin-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--bg3);
  color: var(--fg2);
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  transition: all 0.15s;
}
.nav-signin-btn:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}
.nav-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg0-hard, var(--bg0));
  border: 1px solid var(--bg2);
  z-index: 8000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  padding: 4px 0;
}
.nav-user-dropdown.visible {
  display: block;
}
.nav-dropdown-label {
  padding: 8px 14px 6px;
  font-size: 0.75em;
  color: var(--fg3);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  color: var(--fg1);
  font-size: 0.85em;
  font-family: inherit;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
}
.nav-dropdown-item:hover {
  background: var(--bg1);
  color: var(--yellow);
}
.nav-dropdown-sep {
  height: 1px;
  background: var(--bg2);
  margin: 4px 0;
}
.nav-dropdown-signout {
  color: var(--fg3);
}
.nav-dropdown-signout:hover {
  color: var(--red);
}
.theme-op1 .nav-user-btn {
  border-radius: 20px;
}
.theme-op1 .nav-signin-btn {
  border-radius: 20px;
}
.theme-op1 .nav-user-dropdown {
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.theme-op1 .nav-user-initial {
  background: var(--yellow);
}

/* Mobile: stack nav */
@media (max-width: 640px) {
  .nav-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .nav-links {
    gap: 10px;
  }
  .nav-user-name {
    display: none;
  }
}
