/* =========================================================
   0TS Server List — Dark Premium UI
   Font: IRANSansX (local) · Fully offline
   ========================================================= */

@font-face {
  font-family: 'IRANSansX';
  src: url('../fonts/IRANSansX-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSansX';
  src: url('../fonts/IRANSansX-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* هماهنگ با پنل اصلی my.0ts.ir */
  --bg: #0b1220;
  --bg-elevated: #111827;
  --surface: #151c2c;
  --surface-2: #1a2336;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.35);
  --accent: #a78bfa;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gold: #fbbf24;
  --silver: #cbd5e1;
  --bronze: #fb923c;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  --header-h: 64px;
  --font: 'IRANSansX', Tahoma, system-ui, sans-serif;
  --t: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* تم روشن – هماهنگ با پنل */
body.theme-light,
html[data-theme="light"] body,
body[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #111827;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.2);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

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

html { font-size: 15.5px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  direction: rtl;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -20%, rgba(37, 99, 235, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(167, 139, 250, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(16, 185, 129, 0.04), transparent);
  background-attachment: fixed;
  transition: background-color var(--t), color var(--t);
}
body.theme-light {
  background-image: none;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
body.theme-light .site-header {
  background: rgba(255, 255, 255, 0.85);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 0 24px var(--primary-glow);
}

.nav-desktop { display: flex; align-items: center; gap: 0.25rem; }

/* دکمه تم شب/روز */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  margin-right: 0.35rem;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
body.theme-light .theme-toggle .icon-sun { display: block; }
body.theme-light .theme-toggle .icon-moon { display: none; }
.theme-toggle-mobile {
  width: auto;
  height: auto;
  padding: 0.6rem 1rem;
  margin: 0.5rem 1rem;
  font-size: 0.9rem;
}

.nav-link {
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: var(--t);
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-link.admin-link { color: var(--accent); }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.menu-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.nav-mobile {
  display: none;
  flex-direction: column;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem 1rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  padding: 0.8rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 400;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 1.2rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: wait; }

.btn-primary {
  background: linear-gradient(135deg, #4f8cff, #3b6ef5);
  color: #fff;
  box-shadow: 0 6px 20px -4px var(--primary-glow);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }

.btn-register {
  background: linear-gradient(135deg, #4f8cff, #6366f1);
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 8px 28px -6px var(--primary-glow);
}
.btn-register:hover { filter: brightness(1.08); }

.btn-search {
  background: linear-gradient(135deg, #4f8cff, #3b6ef5);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 14px;
  font-weight: 700;
}

.btn-vote {
  background: linear-gradient(135deg, #7c5cfc, #6d28d9);
  color: #fff;
  width: 100%;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  box-shadow: 0 4px 16px -4px rgba(124, 92, 252, 0.4);
}
.btn-vote:hover { filter: brightness(1.12); }

.btn-connect {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  width: 100%;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  box-shadow: 0 4px 16px -4px rgba(37, 99, 235, 0.45);
}
.btn-connect:hover { filter: brightness(1.1); }

.btn-link {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.35rem 0.8rem;
  background: rgba(79, 140, 255, 0.12);
  color: #93c5fd;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid rgba(79, 140, 255, 0.2);
}
.btn-link:hover { background: rgba(79, 140, 255, 0.2); }

.btn-danger { background: #ef4444; color: #fff; }
.btn-success { background: #10b981; color: #fff; }
.btn-vip {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #451a03;
}
.btn-pin {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
}
.btn-block { width: 100%; padding: 0.8rem; margin-top: 0.5rem; }

/* ---------- Hero ---------- */
.hero { margin-bottom: 1.6rem; }

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.hero-title-wrap {
  flex: 1;
  text-align: center;
  min-width: 220px;
}
.hero-title-wrap h1 {
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff 20%, #93c5fd 60%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
  font-weight: 400;
}

.status-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.84rem;
  font-weight: 700;
}
.legend { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); }
.legend i {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
.legend.online i {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25), 0 0 12px rgba(52, 211, 153, 0.5);
}
.legend.offline i {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

.search-bar {
  display: flex;
  gap: 0.6rem;
  background: var(--surface);
  padding: 0.55rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.1rem;
}
.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  right: 14px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-input-wrap input {
  width: 100%;
  border: none;
  background: var(--surface-2);
  padding: 0.8rem 2.7rem 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: var(--t);
}
.search-input-wrap input::placeholder { color: var(--text-dim); }
.search-input-wrap input:focus {
  background: var(--bg-elevated);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.35);
}

.list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.rank-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.servers-count strong { color: var(--primary); }

/* ---------- Server Cards ---------- */
.server-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.server-card {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--t);
  position: relative;
}
.server-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(79, 140, 255, 0.03) 100%);
  pointer-events: none;
}
.server-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.35);
}
body.theme-light .server-card:hover {
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.18);
}
.server-card.is-offline { opacity: 0.72; }

.rank-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 0.4rem;
  font-weight: 700;
  color: #0a0a0a;
  position: relative;
  gap: 3px;
}
.rank-col .rank-label {
  font-size: 0.65rem;
  opacity: 0.85;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rank-col .rank-num {
  font-size: 1.75rem;
  line-height: 1;
  font-weight: 700;
}
.rank-tag {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  margin-top: 4px;
  letter-spacing: 0.06em;
}
.vip-tag { background: rgba(0,0,0,0.3); color: #fef3c7; }
.pin-tag { background: rgba(0,0,0,0.35); color: #ede9fe; }

.rank-gold {
  background: linear-gradient(180deg, #fde68a 0%, #fbbf24 40%, #d97706 100%);
  box-shadow: inset 0 -10px 24px rgba(0,0,0,0.15);
}
.rank-silver {
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 50%, #94a3b8 100%);
  color: #1e293b;
}
.rank-bronze {
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 45%, #c2410c 100%);
}
.rank-normal {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #e2e8f0;
}

.card-body {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.banner-area {
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-elevated), var(--surface-2));
  max-height: 80px;
  border: 1px solid var(--border);
}
.server-banner {
  width: 100%;
  height: 80px;
  object-fit: contain;
  object-position: center;
  background: var(--bg-elevated);
}
.banner-placeholder {
  height: 64px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--bg-elevated), var(--surface-2));
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0 1rem;
  text-align: center;
}

.server-info { min-width: 0; }
.server-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.2em;
  font-weight: 400;
}
.server-addr {
  font-size: 0.9rem;
  font-weight: 700;
  color: #60a5fa;
  margin-top: 3px;
  letter-spacing: 0.01em;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.95rem 1rem;
  min-width: 180px;
  align-items: stretch;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
body.theme-light .card-actions {
  background: color-mix(in srgb, var(--surface-2) 90%, var(--bg));
}

.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}
.status-pill.online {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}
.status-pill.offline {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
}
.status-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.meta-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.meta-pill.votes {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}
.meta-pill .flag { font-size: 0.95rem; }
.vote-form { margin: 0; }

/* ---------- Alerts ---------- */
.alert {
  padding: 0.95rem 1.2rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  animation: slideIn 0.35s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.alert-error {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.alert-success {
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.empty-icon { font-size: 2.8rem; margin-bottom: 0.85rem; }

/* ---------- Auth ---------- */
.auth-section { max-width: 440px; margin: 2rem auto; }
.auth-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 2.1rem 1.85rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.auth-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-form label, .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.95rem;
  color: var(--text-muted);
}
.auth-form input, .form-group input, .form-group select, .form-group textarea {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 0.95rem;
  color: var(--text);
  transition: var(--t);
  outline: none;
}
.auth-form input:focus, .form-group input:focus, .form-group textarea:focus {
  border-color: rgba(79, 140, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
}
.auth-switch, .auth-footer {
  text-align: center;
  margin-top: 1.3rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.auth-switch a, .auth-footer a { color: var(--primary); font-weight: 700; }

/* ---------- Profile ---------- */
.avatar-wrap, .avatar-ring, .story-ring {
  position: relative;
  width: 100px; height: 100px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888, #833ab4, #5851db, #405de6);
  background-size: 300% 300%;
  animation: story-rotate 4s ease infinite;
  flex-shrink: 0;
  margin: 0 auto;
}
@keyframes story-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.avatar-wrap img, .avatar-ring img, .story-ring img, .avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  background: var(--surface-2);
}
.profile-section { max-width: 480px; margin: 0 auto; }
.profile-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 2rem 1.6rem;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--border);
}
.profile-card h1 { margin-top: 1.1rem; font-size: 1.35rem; font-weight: 700; }
.profile-card .username { color: var(--text-muted); font-size: 0.95rem; }
.profile-card .meta {
  font-size: 0.85rem; color: var(--text-dim); margin: 0.55rem 0 1.3rem;
}
.profile-form { text-align: right; }
.profile-form label {
  display: block; margin-bottom: 1rem;
  font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
}
.profile-form input {
  width: 100%; margin-top: 0.4rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); color: var(--text); outline: none;
}
.profile-form input:focus {
  border-color: rgba(79, 140, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
}
.profile-form .btn { width: 100%; margin-top: 0.55rem; padding: 0.8rem; }

/* ---------- Admin ---------- */
.admin-section h1 {
  font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.3rem;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-card .num {
  display: block;
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-card span:last-child {
  font-size: 0.85rem; color: var(--text-muted);
}
.admin-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}
.admin-tile {
  display: block;
  background: var(--surface);
  padding: 1.25rem;
  border-radius: 14px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--t);
  color: #93c5fd;
}
.admin-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 140, 255, 0.4);
  background: var(--surface-2);
}
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}
.admin-form {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.admin-form h2 { font-size: 1.1rem; margin-bottom: 1.1rem; font-weight: 700; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.form-grid.labeled label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.form-grid.labeled label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.form-grid input:focus, .form-grid textarea:focus {
  border-color: rgba(79, 140, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.12);
}
.form-grid textarea { min-height: 80px; resize: vertical; }

.admin-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-table th, .admin-table td {
  padding: 0.85rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
}
.vip-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  background: rgba(79, 140, 255, 0.08);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(79, 140, 255, 0.2);
}
.actions { min-width: 200px; }
.badge {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-success { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.badge-danger { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.badge-info { background: rgba(96, 165, 250, 0.15); color: #93c5fd; }

/* ---------- Server detail ---------- */
.server-detail { max-width: 720px; margin: 0 auto; }
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.detail-banner {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 1.1rem;
}
.detail-card h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.5rem; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin: 1rem 0; align-items: center;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.comments-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.comments-section h2 { font-size: 1.15rem; margin-bottom: 1rem; font-weight: 700; }
.comment-form textarea {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  margin-bottom: 0.75rem;
  resize: vertical;
  min-height: 80px;
}
.comment-item {
  display: flex; gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.story-ring-sm {
  width: 44px; height: 44px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(45deg, #f09433, #dc2743, #833ab4, #405de6);
  flex-shrink: 0;
}
.story-ring-sm img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
}
.comment-body strong { font-size: 0.9rem; }
.comment-body .time {
  font-size: 0.75rem; color: var(--text-dim); margin-right: 0.5rem;
}
.comment-body p { margin-top: 0.35rem; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }
.muted { color: var(--text-dim); font-size: 0.9rem; }
.comment-mod-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}
.comment-mod-item .meta {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem;
}
.mod-actions {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .server-card { grid-template-columns: 58px 1fr; }
  .card-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-top: 1px solid var(--border);
    min-width: 0;
  }
  .card-actions .status-pill,
  .card-actions .meta-pill,
  .card-actions .btn {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 120px;
  }
  .btn-vote, .btn-connect { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .nav-desktop { display: none; }
  .menu-toggle { display: flex; }
  .hero-top { flex-direction: column; align-items: stretch; }
  .hero-title-wrap { text-align: right; }
  .status-legend { justify-content: flex-start; }
  .search-bar { flex-direction: column; }
  .btn-search { width: 100%; }
  .rank-col { padding: 0.8rem 0.3rem; }
  .rank-col .rank-num { font-size: 1.35rem; }
  .server-card { grid-template-columns: 50px 1fr; }
}
@media (max-width: 400px) {
  .main-container { padding: 1rem 0.7rem 2.5rem; }
  .card-body { padding: 0.8rem; }
}

.banner-area { position: relative; }
.pin-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 2;
  font-size: 1.15rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.55));
  pointer-events: none;
}



/* ===== Compact professional cards + advanced search ===== */
.hero-compact { margin-bottom: 1rem; }
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.hero-compact .hero-title-wrap { text-align: right; flex: 1; }
.hero-compact .hero-title-wrap h1 {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
}
.hero-compact .hero-sub { margin-top: 0.15rem; font-size: 0.82rem; }

.search-advanced {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  background: var(--surface);
  padding: 0.45rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  direction: rtl;
}
.search-advanced .search-input-wrap {
  flex: 1 1 200px;
  min-width: 160px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-advanced .search-icon {
  position: absolute;
  right: 12px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-advanced input[type="search"] {
  width: 100%;
  border: none;
  background: var(--surface-2);
  padding: 0.65rem 2.4rem 0.65rem 0.85rem;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.search-advanced input:focus {
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.3);
}
.filter-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 130px;
  cursor: pointer;
  outline: none;
}
.filter-select:focus {
  border-color: rgba(79, 140, 255, 0.5);
}
.search-advanced .btn-search {
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.85rem;
}

.server-card.compact {
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: stretch;
  min-height: 0;
}
.server-card.compact .rank-col {
  padding: 0.65rem 0.25rem;
  gap: 4px;
}
.server-card.compact .rank-num {
  font-size: 1.35rem;
}
.rank-tags {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}
.server-card.compact .rank-tag {
  font-size: 0.52rem;
  padding: 0.12rem 0.32rem;
}

.card-main {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  min-width: 0;
}
.server-card.compact .banner-area {
  max-height: 58px;
  border-radius: 10px;
}
.server-card.compact .server-banner {
  height: 58px;
  object-fit: contain;
  background: var(--bg-elevated);
}
.server-card.compact .banner-placeholder {
  height: 48px;
  font-size: 0.78rem;
}
.info-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}
.server-card.compact .server-name {
  font-size: 0.92rem;
  margin: 0;
}
.server-addr-inline {
  font-size: 0.78rem;
  font-weight: 700;
  color: #60a5fa;
}
.server-card.compact .server-desc {
  font-size: 0.75rem;
  margin: 0;
  opacity: 0.85;
}
.server-card.compact .btn-link {
  margin-top: 0.15rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
}

.server-card.compact .card-actions {
  min-width: 148px;
  padding: 0.55rem 0.65rem;
  gap: 0.35rem;
  justify-content: center;
}
.server-card.compact .status-pill {
  padding: 0.32rem 0.55rem;
  font-size: 0.72rem;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}
.meta-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.22rem 0.45rem;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.votes-chip {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}
.action-row {
  display: flex;
  gap: 0.3rem;
}
.action-row .btn {
  flex: 1;
  padding: 0.42rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 9px;
}
.server-card.compact .btn-vote,
.server-card.compact .btn-connect {
  width: auto;
}

@media (max-width: 860px) {
  .server-card.compact {
    grid-template-columns: 48px 1fr;
  }
  .server-card.compact .card-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-top: 1px solid var(--border);
    min-width: 0;
  }
  .meta-row { flex: 1 1 100%; }
  .action-row { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .search-advanced { flex-direction: column; }
  .filter-select, .search-advanced .btn-search { width: 100%; }
}

/* Logo dual-line */
.logo-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 2px;
}
.logo-text {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-sub {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
}
.site-header { height: auto; min-height: var(--header-h); }
.header-inner { padding-top: 0.55rem; padding-bottom: 0.55rem; }

/* Search panel on the right (start in RTL = visual right) */
.hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.hero-row .search-advanced {
  flex: 1 1 320px;
  max-width: 720px;
  margin-right: auto; /* pushes toward the other side in RTL flex */
}
.hero-row .btn-register {
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .logo-sub { display: none; }
  .hero-row .search-advanced { max-width: none; width: 100%; }
  .hero-row .btn-register { width: 100%; }
}

/* ---------- Light theme: server cards (forced consistency) ---------- */
body.theme-light .server-card,
body.theme-light .server-card.compact,
body.theme-light .server-card.vip-card,
body.theme-light .server-card.pin-card,
body.theme-light .server-card.rgb-glow {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}
body.theme-light .server-card.rgb-glow::after {
  background: #ffffff !important;
}
body.theme-light .server-card.compact .card-main,
body.theme-light .card-main {
  background: transparent;
}
body.theme-light .card-actions,
body.theme-light .server-card.compact .card-actions {
  background: #f3f4f6 !important;
  border-color: rgba(0, 0, 0, 0.08);
}
body.theme-light .banner-area,
body.theme-light .banner-placeholder,
body.theme-light .server-card.compact .banner-area,
body.theme-light .server-card.compact .banner-placeholder {
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6) !important;
}
body.theme-light .server-banner,
body.theme-light .server-card.compact .server-banner {
  background: #f3f4f6 !important;
}
body.theme-light .server-name {
  color: #111827;
}
body.theme-light .server-desc {
  color: #6b7280;
}
body.theme-light .server-addr,
body.theme-light .server-addr-inline {
  color: #2563eb !important;
}
body.theme-light .meta-chip {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #4b5563;
}
body.theme-light .votes-chip {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #b45309 !important;
}
body.theme-light .meta-pill.votes {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(245, 158, 11, 0.1));
  border-color: rgba(245, 158, 11, 0.4);
  color: #b45309;
}
body.theme-light .btn-link {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}
body.theme-light .nav-link:hover {
  background: rgba(0, 0, 0, 0.05);
}
body.theme-light .rank-normal {
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
  color: #fff;
}
body.theme-light .server-card:hover {
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.14);
  border-color: rgba(0, 0, 0, 0.14);
}
