/* ═══════════════════════════════════════════════════════════════════════════
   PHYSICSFORUM.ORG — COMPONENT LIBRARY
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
  user-select: none;
  border: 2px solid transparent;
  line-height: 1.5;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary { background: var(--color-electric); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: #1d4ed8; box-shadow: var(--shadow-lg); transform: translateY(-1px); }

.btn-secondary { border-color: var(--color-electric); color: var(--color-electric); background: transparent; }
.btn-secondary:hover { background: var(--color-electric); color: #fff; }

.btn-ghost { color: var(--color-dark-grey); }
.btn-ghost:hover { background: var(--color-ice-blue); }

.btn-danger { background: var(--color-alert-red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-gold { background: var(--color-quantum-gold); color: var(--color-space-navy); box-shadow: var(--shadow-gold); }
.btn-gold:hover { background: #d97706; box-shadow: 0 0 30px rgba(245,158,11,0.5); }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); }
.btn-block { width: 100%; }

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Badges & Tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125em 0.625em;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-primary { background: var(--color-electric); color: #fff; }
.badge-gold    { background: var(--color-quantum-gold); color: var(--color-space-navy); }
.badge-green   { background: var(--color-fusion-green); color: #fff; }
.badge-red     { background: var(--color-alert-red); color: #fff; }
.badge-purple  { background: var(--color-soft-purple); color: #fff; }
.badge-grey    { background: rgba(148,163,184,0.2); color: var(--color-dark-grey); }
.badge-outline { background: transparent; border: 1.5px solid currentColor; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-display);
  background: var(--color-ice-blue);
  color: var(--color-electric);
  cursor: pointer;
  transition: var(--transition-fast);
}
.tag:hover { background: var(--color-electric); color: #fff; text-decoration: none; }

/* ── Cards ── */
.card {
  background: var(--color-photon-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: var(--transition-base);
  border: 1px solid rgba(148,163,184,0.15);
}
.card-header { padding: var(--space-5) var(--space-6); border-bottom: 1px solid rgba(148,163,184,0.15); display: flex; align-items: center; gap: var(--space-3); }
.card-body   { padding: var(--space-6); }
.card-footer { padding: var(--space-4) var(--space-6); background: rgba(148,163,184,0.04); border-top: 1px solid rgba(148,163,184,0.1); }
.card-dark    { background: var(--color-slate); color: var(--color-photon-white); }
.card-featured { border-left: 4px solid var(--color-quantum-gold); background: rgba(245,158,11,0.03); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-compact .card-body { padding: var(--space-4); }

/* ── Forms ── */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
  color: var(--color-dark-grey);
}
.form-label .required::after { content: ' *'; color: var(--color-alert-red); }

.form-input, .form-textarea, .form-select {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  border: 1.5px solid rgba(148,163,184,0.35);
  border-radius: var(--radius-md);
  background: var(--color-photon-white);
  color: var(--color-dark-grey);
  transition: var(--transition-fast);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-electric);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394A3B8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-checkbox, .form-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}
.form-checkbox input, .form-radio input {
  width: 18px; height: 18px;
  accent-color: var(--color-electric);
  cursor: pointer;
}

.form-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.form-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.form-toggle .track {
  width: 44px; height: 24px;
  background: var(--color-neutron-grey);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
  position: relative;
}
.form-toggle .track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.form-toggle input:checked + .track { background: var(--color-electric); }
.form-toggle input:checked + .track::after { transform: translateX(20px); }

.form-error { font-size: var(--text-xs); color: var(--color-alert-red); margin-top: var(--space-1); }
.form-hint  { font-size: var(--text-xs); color: var(--color-neutron-grey); margin-top: var(--space-1); }

.form-search {
  position: relative;
  display: flex;
  align-items: center;
}
.form-search .search-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--color-neutron-grey);
  pointer-events: none;
}
.form-search .form-input { padding-left: var(--space-10); }

/* ── Navigation ── */
.nav-item {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-neutron-grey);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { color: var(--color-photon-white); background: rgba(255,255,255,0.06); text-decoration: none; }
.nav-item.active { color: var(--color-photon-white); }

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--color-photon-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-4);
  z-index: var(--z-drawer);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: var(--transition-fast);
}
.nav-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-family: var(--font-display);
  color: var(--color-neutron-grey);
  flex-wrap: wrap;
  padding: var(--space-3) 0;
}
.breadcrumb a { color: var(--color-neutron-grey); }
.breadcrumb a:hover { color: var(--color-electric); }
.breadcrumb .separator { color: var(--color-neutron-grey); font-size: var(--text-xs); }

.tab-bar { display: flex; border-bottom: 1px solid rgba(148,163,184,0.2); gap: 0; }
.tab-item {
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-neutron-grey);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: -1px;
}
.tab-item:hover { color: var(--color-dark-grey); }
.tab-item.active { color: var(--color-electric); border-bottom-color: var(--color-electric); }

.sidebar-nav { list-style: none; }
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-dark-grey);
  cursor: pointer;
  transition: var(--transition-fast);
}
.sidebar-nav-item:hover { background: var(--color-ice-blue); text-decoration: none; }
.sidebar-nav-item.active { background: var(--color-ice-blue); color: var(--color-electric); font-weight: 600; }
.sidebar-nav-item .nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
  margin-top: var(--space-8);
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 36px;
  padding: var(--space-1) var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  color: var(--color-dark-grey);
  transition: var(--transition-fast);
}
.pagination a:hover { background: var(--color-ice-blue); color: var(--color-electric); text-decoration: none; }
.pagination .active { background: var(--color-electric); color: #fff; }

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  font-size: var(--text-sm);
}
.alert-info    { background: var(--color-ice-blue); border-color: var(--color-electric); color: var(--color-electric); }
.alert-success { background: rgba(16,185,129,0.1); border-color: var(--color-fusion-green); color: #065f46; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: var(--color-quantum-gold); color: var(--color-dark-gold); }
.alert-error   { background: rgba(239,68,68,0.08); border-color: var(--color-alert-red); color: #b91c1c; }

.callout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  border-left: 5px solid var(--color-electric);
  background: var(--color-ice-blue);
  margin: var(--space-6) 0;
}
.callout-icon { flex-shrink: 0; width: 24px; height: 24px; }

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-photon-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
  max-width: 380px;
}
.toast-success { border-left: 4px solid var(--color-fusion-green); }
.toast-error   { border-left: 4px solid var(--color-alert-red); }
.toast-info    { border-left: 4px solid var(--color-electric); }
.toast-warning { border-left: 4px solid var(--color-quantum-gold); }

@keyframes toastIn  { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100px); } }

/* ── Avatars ── */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-academic-blue);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.avatar-sm  { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md  { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-lg  { width: 56px; height: 56px; font-size: var(--text-lg); }
.avatar-xl  { width: 80px; height: 80px; font-size: var(--text-2xl); }
.avatar-2xl { width: 128px; height: 128px; font-size: var(--text-4xl); }

.avatar-initials {
  background: linear-gradient(135deg, var(--color-electric), var(--color-academic-blue));
}
.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--color-photon-white);
}
.avatar-status.online { background: var(--color-fusion-green); }
.avatar-status.offline { background: var(--color-neutron-grey); }
.avatar-status.away { background: var(--color-quantum-gold); }

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid var(--color-photon-white); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ── Loaders ── */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid rgba(148,163,184,0.3);
  border-top-color: var(--color-electric);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, rgba(148,163,184,0.1) 25%, rgba(148,163,184,0.2) 50%, rgba(148,163,184,0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin: var(--space-2) 0; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }
.skeleton-card { height: 200px; }

.progress-bar {
  height: 8px;
  background: rgba(148,163,184,0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--color-electric);
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--color-photon-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 800px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6); border-bottom: 1px solid rgba(148,163,184,0.15); }
.modal-body   { padding: var(--space-6); overflow-y: auto; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-top: 1px solid rgba(148,163,184,0.15); }

/* ── Equations & Code ── */
.equation-block {
  text-align: center;
  padding: var(--space-6);
  background: var(--color-ice-blue);
  border-radius: var(--radius-lg);
  margin: var(--space-6) 0;
  font-size: var(--text-xl);
  overflow-x: auto;
}
.equation-inline {
  font-family: var(--font-mono);
  background: rgba(15,23,42,0.04);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}
.code-block {
  position: relative;
  background: var(--color-code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: var(--space-6) 0;
}
.code-block .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: var(--text-xs);
  color: var(--color-neutron-grey);
}
.code-block .copy-btn {
  color: var(--color-neutron-grey);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: var(--transition-fast);
}
.code-block .copy-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.code-block pre { margin: 0; border-radius: 0; }
.code-inline { font-family: var(--font-mono); font-size: 0.9em; background: rgba(15,23,42,0.06); padding: 0.15em 0.4em; border-radius: 3px; color: var(--color-electric); }

/* ── Misc ── */
.divider {
  height: 1px;
  background: rgba(148,163,184,0.2);
  margin: var(--space-6) 0;
}

.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: var(--space-1) var(--space-2);
  background: var(--color-slate);
  color: #fff;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
}
.tooltip:hover::after { opacity: 1; transform: translateX(-50%) translateY(-8px); }

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--color-photon-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-drawer);
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: var(--transition-fast);
}
.dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-dark-grey);
  cursor: pointer;
  transition: var(--transition-fast);
}
.dropdown-item:hover { background: var(--color-ice-blue); color: var(--color-electric); }
.dropdown-divider { height: 1px; background: rgba(148,163,184,0.15); margin: var(--space-1) 0; }

/* ======================================================================
   MERGED FROM v41-additions.css (v4.9)
   This was loaded on EVERY page as part of the core bundle while being a
   'patch on top' file (17 !important rules, 36 hardcoded font sizes).
   Folded into components.css so component styles live in one place.
   ====================================================================== */

/* ── FORUM — action bar ── */
.forum-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 0 4px;
}
.forum-section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--color-space-navy);
  margin: 0;
}

/* ── FORUM — category-row stats ── */
.category-row .cat-tags .tag {
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.category-row .cat-tags .tag:hover {
  background: var(--color-electric);
  color: #fff;
}
.category-row .cat-last-meta {
  display: block;
  font-size: 11px;
  color: var(--color-neutron-grey);
  margin-top: 2px;
}

/* ── FORUM — sidebar widgets ── */
.sidebar-widget {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(15,23,42,0.04);
}
.sidebar-widget-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-space-navy);
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}
.sidebar-thread-list, .sidebar-contributors {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-thread-list li {
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
}
.sidebar-thread-list li:last-child { border-bottom: 0; }
.sidebar-thread-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-space-navy);
  text-decoration: none;
  line-height: 1.35;
}
.sidebar-thread-title:hover { color: var(--color-electric); }
.sidebar-thread-meta {
  display: block;
  font-size: 11px;
  color: var(--color-neutron-grey);
  margin-top: 2px;
}
.sidebar-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sidebar-tag-cloud .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--color-ice-blue);
  color: var(--color-electric);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.sidebar-tag-cloud .tag:hover {
  background: var(--color-electric);
  color: #fff;
}
.sidebar-tag-cloud .tag-count {
  font-size: 10px;
  background: rgba(255,255,255,0.6);
  color: var(--color-space-navy);
  padding: 0 5px;
  border-radius: 999px;
}
.sidebar-tag-cloud .tag:hover .tag-count { background: rgba(255,255,255,0.25); color: #fff; }
.sidebar-contributors li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #F1F5F9;
}
.sidebar-contributors li:last-child { border-bottom: 0; }
.sidebar-contributors .avatar-sm { border-radius: 50%; }
.sidebar-contributors .contrib-info { flex: 1; min-width: 0; }
.sidebar-contributors .contrib-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-space-navy);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-contributors .contrib-name:hover { color: var(--color-electric); }
.sidebar-contributors .contrib-stat {
  font-size: 11px;
  color: var(--color-neutron-grey);
}
.sidebar-cta {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-electric);
  text-align: center;
  text-decoration: none;
}
.sidebar-cta:hover { text-decoration: underline; }
.sidebar-empty {
  font-size: 12px;
  color: var(--color-neutron-grey);
  margin: 0;
}

/* ── LEARN — articles wrap + filter rows ── */
.learn-articles-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}
.learn-articles-header {
  margin-bottom: 18px;
}
.learn-articles-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--color-space-navy);
  margin: 0 0 4px;
}
.learn-articles-subtitle {
  font-size: 14px;
  color: var(--color-neutron-grey);
  margin: 0 0 16px;
}
.learn-search-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.learn-search-input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  font-size: 14px;
}
.learn-search-input:focus { outline: none; border-color: var(--color-electric); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.learn-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #F1F5F9;
}
.learn-filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-neutron-grey);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 6px;
}
.learn-filter-btn {
  padding: 6px 14px;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.learn-filter-btn:hover {
  background: var(--color-ice-blue);
  border-color: var(--color-electric);
  color: var(--color-electric);
  text-decoration: none;
}
.learn-filter-btn.active {
  background: var(--color-electric);
  color: #fff;
  border-color: var(--color-electric);
}
.learn-active-filters {
  font-size: 13px;
  color: var(--color-neutron-grey);
  margin: 12px 0;
}
.learn-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.learn-no-results {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border: 1px dashed #CBD5E1;
  border-radius: 12px;
  margin-top: 20px;
}
.learn-no-results h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
}
.learn-no-results p {
  color: var(--color-neutron-grey);
  margin: 0 0 16px;
}

/* ── LEADERBOARD v4.1 ── */
.lb-cat-row {
  margin-bottom: 18px;
}
.lb-cat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.lb-cat-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-dark-grey);
}
.lb-cat-form select {
  padding: 7px 12px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-space-navy);
  cursor: pointer;
}
.lb-cat-form select:focus {
  outline: none;
  border-color: var(--color-electric);
}

.lb-row {
  display: grid;
  grid-template-columns: 50px 1fr 110px 90px 90px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid #F1F5F9;
  transition: background-color 0.15s ease;
}
.lb-row:last-child { border-bottom: 0; }
.lb-row:hover { background: #F8FAFC; }
.lb-row.lb-top-3 { background: rgba(245,158,11,0.04); }
.lb-row.lb-top-3:hover { background: rgba(245,158,11,0.08); }
.lb-rank-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--color-neutron-grey);
  text-align: center;
}
.lb-rank-1 { color: var(--color-quantum-gold); font-size: 22px; }
.lb-rank-2 { color: #94A3B8; font-size: 20px; }
.lb-rank-3 { color: #CD7F32; font-size: 20px; }
.lb-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lb-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lb-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 14px;
}
.lb-user-info { min-width: 0; flex: 1; }
.lb-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--color-space-navy);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-name:hover { color: var(--color-electric); }
.lb-user-meta {
  display: block;
  font-size: 11px;
  color: var(--color-neutron-grey);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-stat {
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-dark-grey);
}
.lb-stat-rep {
  color: var(--color-quantum-gold);
  font-weight: 700;
}
.lb-footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--color-neutron-grey);
  margin-top: 18px;
}

@media (max-width: 768px) {
  .lb-row {
    grid-template-columns: 40px 1fr 80px;
  }
  .lb-row .lb-stat:nth-child(n+4) { display: none; }
  .lb-header .lb-stat:nth-child(n+4) { display: none; }
  .lb-header {
    display: grid;
    grid-template-columns: 40px 1fr 80px;
  }
}

/* ── COMMUNITY / POTW v4.1 ── */
.potw-difficulty-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 24px;
  justify-content: center;
}
.potw-diff-tab {
  padding: 8px 18px;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.potw-diff-tab:hover:not(.active) {
  background: var(--color-ice-blue);
  text-decoration: none;
}
.potw-diff-tab.active {
  background: var(--color-electric);
  color: #fff;
  border-color: var(--color-electric);
}
.potw-login-prompt {
  text-align: center;
  padding: 30px 20px;
  background: #F8FAFC;
  border-radius: 10px;
}
.potw-login-prompt p {
  font-size: 14px;
  color: var(--color-dark-grey);
  margin-bottom: 16px;
}
.potw-login-prompt .btn { margin: 0 4px; }
.potw-winner-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #F1F5F9;
}
.potw-winner-row:last-child { border-bottom: 0; }
.potw-winner-rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  min-width: 40px;
}
.potw-winner-avatar { width: 36px; height: 36px; border-radius: 50%; }
.potw-winner-name {
  font-weight: 600;
  color: var(--color-space-navy);
  text-decoration: none;
  flex: 1;
}
.potw-winner-name:hover { color: var(--color-electric); }
.potw-winner-time, .potw-winner-loc, .potw-winner-rep {
  font-size: 12px;
  color: var(--color-neutron-grey);
}

/* ── AUTH page — full-screen background ── */
body.page-template-page-login,
body.page-template-page-register {
  background: #1B3A6B;
}
body.page-template-page-login .pf-footer,
body.page-template-page-register .pf-footer { display: none; }

/* ── KaTeX content stylings inside auth + community paragraphs ── */
.potw-problem-body p {
  margin: 8px 0;
  line-height: 1.6;
}
.potw-problem-body p:has(> .katex) {
  text-align: center;
  margin: 14px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v4.3 — atom logo rotation everywhere (header, footer, auth pages, emails)
   ═══════════════════════════════════════════════════════════════════════════ */
.navbar-logo svg,
.footer-brand .footer-logo svg,
.pfc-auth-logo svg,
.auth-logo svg,
.atom-spin svg,
svg.atom-spin {
    animation: atomSpinGlobal 22s linear infinite;
    transform-origin: 50% 50%;
}
@keyframes atomSpinGlobal {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .navbar-logo svg, .footer-brand .footer-logo svg,
    .pfc-auth-logo svg, .auth-logo svg, .atom-spin svg, svg.atom-spin { animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v4.3 — Make sure user dropdown is properly visible on large screens
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    .user-dropdown { display: inline-flex !important; align-items: center; }
    .user-menu-btn .user-name-text { display: inline-block !important; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Forum / comment composer textareas: resizable in BOTH directions (like v4.2)
   but bounded with sane min/max so the page can't be broken. v4.5 */
.new-thread-form textarea,
.composer-textarea,
.composer-body textarea,
.quick-ask-form textarea,
#comment,
textarea[name="comment"],
textarea[name="feedback_text"] {
    resize: both;
    min-width: 240px;
    max-width: 100%;
    min-height: 140px;
    max-height: 60vh;
    overflow: auto;
}

/* Difficulty radio group — works even without :has() */
.diff-level-option { user-select: none; }
.diff-level-option.is-selected,
.diff-level-option:has(input[type="radio"]:checked) {
    background: var(--color-electric);
    color: #fff;
    border-color: var(--color-electric);
}

/* File-upload pretty styling for new thread */
.pf-file-upload {
    border: 1.5px dashed #CBD5E1;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    background: #F8FAFC;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pf-file-upload:hover { background: #F1F5F9; border-color: var(--color-electric); }
.pf-file-upload input[type="file"] { display: none; }
.pf-file-upload-label { font-size: 13px; color: var(--color-dark-grey); font-weight: 600; }
.pf-file-upload-hint { font-size: 11px; color: var(--color-neutron-grey); margin-top: 4px; }
.pf-file-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pf-file-chip { padding: 4px 10px; background: var(--color-ice-blue); color: var(--color-electric); font-size: 12px; border-radius: 999px; }

/* ═══════════════════════════════════════════════════════════════════════════
   v4.4 — CRITICAL FIX: ensure logged-in user dropdown is VISIBLE on header.
   The generic .dropdown rule in components.css sets opacity:0; visibility:hidden;
   transform: translateY(8px) which was inadvertently hiding the entire user-
   dropdown WRAPPER (including the avatar button itself) on the navbar.
   We explicitly restore visibility for .user-dropdown — only its child
   .dropdown-menu should toggle on click via the .open class.
   ═══════════════════════════════════════════════════════════════════════════ */
.pf-navbar .user-dropdown,
.navbar-actions .user-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}
.pf-navbar .user-dropdown .user-menu-btn,
.navbar-actions .user-dropdown .user-menu-btn {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-flex !important;
}
/* The actual flyout menu stays hidden until .open */
.pf-navbar .user-dropdown .dropdown-menu,
.navbar-actions .user-dropdown .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.pf-navbar .user-dropdown:not(.open) .dropdown-menu,
.navbar-actions .user-dropdown:not(.open) .dropdown-menu {
    display: none;
}
.pf-navbar .user-dropdown.open .dropdown-menu,
.navbar-actions .user-dropdown.open .dropdown-menu {
    display: block;
}

/* v4.4 — make sure the spinning atom logo animation actually applies in the
   navbar (some browsers ignored it because of cascade order). */
.pf-navbar .navbar-logo > svg {
    animation: atomSpinGlobal 22s linear infinite !important;
    transform-origin: 50% 50% !important;
    will-change: transform;
}
