/* ═══════════════════════════════════════════════
   MineSearch.ru — Main Stylesheet
   Dark theme · Emerald accents
   ═══════════════════════════════════════════════ */

/* ─── Reset & Vars ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0:       #0d1117;
  --bg-1:       #161b22;
  --bg-2:       #21262d;
  --bg-3:       #2d333b;
  --border:     #30363d;
  --text-1:     #e6edf3;
  --text-2:     #8b949e;
  --text-3:     #6e7681;
  --accent:     #2ea043;
  --accent-light:#3fb950;
  --accent-glow: #2ea04340;
  --emerald:    #10b981;
  --emerald-d:  #059669;
  --red:        #f85149;
  --yellow:     #d29922;
  --blue:       #388bfd;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body.ms-body {
  font-family:      var(--font);
  background-color: var(--bg-0);
  color:            var(--text-1);
  line-height:      1.6;
  min-height:       100vh;
  display:          flex;
  flex-direction:   column;
}

/* ─── Typography ───────────────────────────────── */
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--text-2); }
a  { color: var(--accent-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--emerald); }

/* ─── Layout ───────────────────────────────────── */
.ms-container { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }
.ms-main      { flex: 1; }

/* ─── Navbar ───────────────────────────────────── */
.ms-nav {
  position:         sticky;
  top:              0;
  z-index:          100;
  background:       rgba(13, 17, 23, .92);
  backdrop-filter:  blur(12px);
  border-bottom:    1px solid var(--border);
}
.ms-nav__inner {
  display:          flex;
  align-items:      center;
  gap:              1.5rem;
  height:           64px;
}
.ms-nav__logo {
  display:    flex;
  align-items:center;
  gap:        .5rem;
  font-size:  1.25rem;
  font-weight:800;
  color:      var(--text-1) !important;
  white-space:nowrap;
}
.ms-logo-pixel  { font-size: 1.4rem; }
.ms-logo-accent { color: var(--accent-light); }
.ms-nav__links  { display: flex; align-items: center; gap: 0; list-style: none; margin-left: auto; }
.ms-nav__link   {
  padding:     .5rem 1rem;
  color:       var(--text-2);
  font-weight: 500;
  transition:  color var(--transition);
}
.ms-nav__link:hover      { color: var(--text-1); }
.ms-nav__link--cta       {
  background:    var(--accent);
  color:         #fff !important;
  border-radius: var(--radius-sm);
  margin-left:   .5rem;
}
.ms-nav__link--cta:hover { background: var(--accent-light); }
.ms-nav__auth   { display: flex; gap: .5rem; margin-left: .5rem; }
.ms-nav__burger { display: none; flex-direction: column; gap: 5px; cursor: pointer; background: none; border: none; }
.ms-nav__burger span { display: block; width: 22px; height: 2px; background: var(--text-2); border-radius: 2px; }

/* ─── Buttons ──────────────────────────────────── */
.ms-btn {
  display:        inline-flex;
  align-items:    center;
  gap:            .4rem;
  padding:        .55rem 1.25rem;
  border-radius:  var(--radius-sm);
  font-weight:    600;
  font-size:      .875rem;
  cursor:         pointer;
  border:         1px solid transparent;
  transition:     all var(--transition);
  text-decoration:none;
}
.ms-btn--primary { background: var(--accent);  color: #fff; border-color: var(--accent); }
.ms-btn--primary:hover { background: var(--accent-light); border-color: var(--accent-light); color: #fff; }
.ms-btn--ghost   { background: transparent; color: var(--text-2); border-color: var(--border); }
.ms-btn--ghost:hover { color: var(--text-1); border-color: var(--text-2); }
.ms-btn--danger  { background: transparent; color: var(--red); border-color: var(--red); }
.ms-btn--sm      { padding: .35rem .85rem; font-size: .8rem; }
.ms-btn--lg      { padding: .75rem 1.75rem; font-size: 1rem; }
.ms-btn--block   { width: 100%; justify-content: center; }

/* ─── Cards ────────────────────────────────────── */
.ms-card {
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  transition:    border-color var(--transition), box-shadow var(--transition);
}
.ms-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }

/* ─── Status badges ────────────────────────────── */
.ms-badge {
  display:       inline-flex;
  align-items:   center;
  gap:           .3rem;
  padding:       .2rem .6rem;
  border-radius: 100px;
  font-size:     .75rem;
  font-weight:   600;
  letter-spacing:.03em;
}
.ms-badge--online  { background: #2ea04320; color: var(--accent-light); border: 1px solid var(--accent); }
.ms-badge--offline { background: #f8514920; color: var(--red);          border: 1px solid var(--red); }
.ms-badge--pending { background: #d2992220; color: var(--yellow);       border: 1px solid var(--yellow); }

.ms-badge--online::before, .ms-badge--offline::before, .ms-badge--pending::before {
  content: '';
  display: inline-block;
  width:   7px;
  height:  7px;
  border-radius: 50%;
}
.ms-badge--online::before  { background: var(--accent-light); box-shadow: 0 0 6px var(--accent); animation: pulse 2s infinite; }
.ms-badge--offline::before { background: var(--red); }
.ms-badge--pending::before { background: var(--yellow); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ─── Hero ─────────────────────────────────────── */
.ms-hero {
  padding:    5rem 0 4rem;
  text-align: center;
  position:   relative;
  overflow:   hidden;
}
.ms-hero::before {
  content:  '';
  position: absolute;
  inset:    0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, #2ea04318 0%, transparent 70%);
  pointer-events: none;
}
.ms-hero__title { margin-bottom: 1rem; }
.ms-hero__subtitle { font-size: 1.1rem; color: var(--text-2); max-width: 560px; margin: 0 auto 2rem; }
.ms-hero__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.ms-hero__stats {
  display:         flex;
  gap:             3rem;
  justify-content: center;
  margin-top:      3rem;
  flex-wrap:       wrap;
}
.ms-hero__stat-num  { font-size: 2rem; font-weight: 800; color: var(--accent-light); }
.ms-hero__stat-label{ font-size: .875rem; color: var(--text-3); }

/* ─── Section ──────────────────────────────────── */
.ms-section        { padding: 3rem 0; }
.ms-section__head  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.ms-section__title { font-size: 1.4rem; font-weight: 700; }

/* ─── Server card (catalog) ────────────────────── */
.ms-server-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap:                   1rem;
}
.ms-server-card {
  display:     flex;
  flex-direction: column;
  padding:     1.25rem;
  gap:         .75rem;
}
.ms-server-card__head {
  display:     flex;
  align-items: flex-start;
  gap:         .75rem;
}
.ms-server-card__icon {
  width:         48px;
  height:        48px;
  border-radius: var(--radius-sm);
  background:    var(--bg-2);
  object-fit:    cover;
  flex-shrink:   0;
}
.ms-server-card__title {
  font-weight:  700;
  font-size:    1rem;
  margin-bottom:.15rem;
}
.ms-server-card__host {
  font-family: var(--font-mono);
  font-size:   .8rem;
  color:       var(--text-3);
}
.ms-server-card__meta {
  display:   flex;
  gap:       .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.ms-server-card__players {
  font-size:   .875rem;
  color:       var(--text-2);
}
.ms-server-card__players strong { color: var(--text-1); }
.ms-server-card__motd {
  font-size:     .8rem;
  color:         var(--text-3);
  overflow:      hidden;
  display:       -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ms-server-card__footer {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-top:      auto;
}
.ms-server-card__votes {
  display:    flex;
  align-items:center;
  gap:        .35rem;
  font-size:  .875rem;
  color:      var(--text-3);
}

/* ─── Search bar ───────────────────────────────── */
.ms-search {
  display:  flex;
  gap:      .5rem;
  max-width:640px;
  margin:   0 auto 2rem;
}
.ms-input {
  flex:          1;
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-1);
  padding:       .65rem 1rem;
  font-size:     .9rem;
  outline:       none;
  transition:    border-color var(--transition);
}
.ms-input:focus  { border-color: var(--accent); }
.ms-input::placeholder { color: var(--text-3); }

.ms-select {
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-2);
  padding:       .65rem 1rem;
  font-size:     .9rem;
  outline:       none;
  cursor:        pointer;
}
.ms-select:focus { border-color: var(--accent); }

/* ─── Filters ──────────────────────────────────── */
.ms-filters {
  display:         flex;
  gap:             .75rem;
  flex-wrap:       wrap;
  margin-bottom:   1.5rem;
  align-items:     center;
}
.ms-filter-chip {
  padding:       .3rem .85rem;
  border-radius: 100px;
  background:    var(--bg-2);
  border:        1px solid var(--border);
  font-size:     .8rem;
  color:         var(--text-2);
  cursor:        pointer;
  transition:    all var(--transition);
}
.ms-filter-chip.active, .ms-filter-chip:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color:       var(--accent-light);
}

/* ─── Server detail page ───────────────────────── */
.ms-server-detail { padding: 2rem 0 4rem; }
.ms-server-header {
  display:       flex;
  gap:           1.5rem;
  align-items:   flex-start;
  margin-bottom: 2rem;
  flex-wrap:     wrap;
}
.ms-server-header__icon { width: 80px; height: 80px; border-radius: var(--radius-md); }
.ms-server-header__info { flex: 1; }
.ms-server-header__name { font-size: 1.75rem; margin-bottom: .5rem; }
.ms-server-header__address {
  font-family: var(--font-mono);
  font-size:   1rem;
  color:       var(--accent-light);
  background:  var(--bg-2);
  border:      1px solid var(--border);
  padding:     .4rem 1rem;
  border-radius: var(--radius-sm);
  display:     inline-block;
  margin-bottom: .75rem;
  cursor:      pointer;
}
.ms-server-stats-bar {
  display:   flex;
  gap:       2rem;
  padding:   1.25rem;
  background:var(--bg-1);
  border:    1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.ms-stat-item__label { font-size: .75rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.ms-stat-item__value { font-size: 1.5rem; font-weight: 700; color: var(--text-1); }

.ms-tabs        { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.ms-tab         { padding: .75rem 1.25rem; font-size: .875rem; font-weight: 500; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition); }
.ms-tab.active, .ms-tab:hover { color: var(--accent-light); border-bottom-color: var(--accent-light); }

/* ─── Charts ───────────────────────────────────── */
.ms-chart-wrap {
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  padding:       1.25rem;
  margin-bottom: 1.5rem;
}

/* ─── Vote/Like buttons ────────────────────────── */
.ms-vote-bar  { display: flex; gap: 1rem; margin-bottom: 2rem; }
.ms-vote-btn  {
  flex:          1;
  padding:       .75rem;
  border-radius: var(--radius-md);
  font-size:     .9rem;
  font-weight:   600;
  cursor:        pointer;
  border:        1px solid;
  transition:    all var(--transition);
  text-align:    center;
}
.ms-vote-btn--vote { background: var(--accent-glow); color: var(--accent-light); border-color: var(--accent); }
.ms-vote-btn--vote:hover { background: var(--accent); color: #fff; }
.ms-vote-btn--like { background: #f8514920; color: var(--red); border-color: var(--red); }
.ms-vote-btn--like:hover { background: var(--red); color: #fff; }

/* ─── Navbar search ────────────────────────────── */
.ms-nav__search { display: flex; align-items: center; }
.ms-nav__search-input {
  background:    var(--bg-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-1);
  font-size:     .85rem;
  padding:       .35rem .75rem;
  width:         200px;
  transition:    border-color var(--transition), width var(--transition);
  font-family:   var(--font);
}
.ms-nav__search-input:focus { outline: none; border-color: var(--accent); width: 260px; }
.ms-nav__search-input::placeholder { color: var(--text-3); }

/* ─── Footer ───────────────────────────────────── */
.ms-footer {
  background:  var(--bg-1);
  border-top:  1px solid var(--border);
  padding:     3rem 0 0;
  margin-top:  auto;
}
.ms-footer__inner {
  display:               grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap:                   2rem;
  padding-bottom:        2rem;
}
.ms-footer__tagline { color: var(--text-3); font-size: .875rem; margin-top: .5rem; }
.ms-footer__links   { display: flex; flex-direction: column; gap: .5rem; }
.ms-footer__links h4{ color: var(--text-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .25rem; }
.ms-footer__links a { color: var(--text-3); font-size: .875rem; }
.ms-footer__links a:hover { color: var(--text-2); }
.ms-footer__bottom  { border-top: 1px solid var(--border); padding: 1rem 0; font-size: .8rem; color: var(--text-3); }

/* ─── Pagination ───────────────────────────────── */
.ms-pagination { display: flex; justify-content: center; gap: .35rem; margin-top: 2rem; }
.ms-page-btn   {
  width:         36px;
  height:        36px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background:    var(--bg-2);
  border:        1px solid var(--border);
  color:         var(--text-2);
  font-size:     .875rem;
  cursor:        pointer;
  transition:    all var(--transition);
}
.ms-page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ms-page-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent-light); }

/* ─── Top-list ──────────────────────────────────── */
.ms-top-list { display: flex; flex-direction: column; gap: .5rem; }
.ms-top-item {
  display:       flex;
  align-items:   center;
  gap:           .75rem;
  padding:       .75rem 1rem;
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  transition:    border-color var(--transition);
}
.ms-top-item:hover     { border-color: var(--accent); }
.ms-top-item__num      { font-size: 1.1rem; font-weight: 800; color: var(--accent); min-width: 28px; }
.ms-top-item__name     { font-weight: 600; flex: 1; }
.ms-top-item__players  { font-size: .875rem; color: var(--text-3); }

/* ─── Toast notifications ───────────────────────── */
.ms-toast {
  position:      fixed;
  bottom:        1.5rem;
  right:         1.5rem;
  z-index:       9999;
  display:       flex;
  flex-direction:column;
  gap:           .5rem;
}
.ms-toast-item {
  background:    var(--bg-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  padding:       .75rem 1.25rem;
  box-shadow:    var(--shadow-md);
  animation:     slideIn .3s ease;
  min-width:     220px;
}
.ms-toast-item--success { border-left: 3px solid var(--accent); }
.ms-toast-item--error   { border-left: 3px solid var(--red); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Forms ────────────────────────────────────── */
.ms-form-group { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .375rem; }
.ms-label { font-size: .875rem; color: var(--text-2); font-weight: 500; }
.ms-input {
  background:    var(--bg-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-1);
  font-size:     .95rem;
  padding:       .5rem .75rem;
  width:         100%;
  transition:    border-color var(--transition), box-shadow var(--transition);
  font-family:   var(--font);
}
.ms-input:focus {
  outline:      none;
  border-color: var(--accent);
  box-shadow:   0 0 0 3px var(--accent-glow);
}
textarea.ms-input { min-height: 120px; }

/* ─── Alerts ────────────────────────────────────── */
.ms-alert {
  padding:       .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size:     .875rem;
  line-height:   1.6;
}
.ms-alert--error   { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.35); color: #f85149; }
.ms-alert--success { background: rgba(46,160,67,.12); border: 1px solid rgba(46,160,67,.35); color: var(--accent-light); }

/* ─── Rating table ──────────────────────────────── */
.ms-rating-list {
  display:       flex;
  flex-direction:column;
  gap:           .5rem;
}
.ms-rating-row {
  display:       grid;
  grid-template-columns: 48px 48px 1fr 80px 100px 90px;
  align-items:   center;
  gap:           1rem;
  padding:       .875rem 1rem;
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  transition:    border-color var(--transition), background var(--transition);
}
.ms-rating-row:hover { border-color: var(--accent); background: var(--bg-2); }
.ms-rating-row__place {
  font-size:  1rem;
  font-weight:800;
  color:      var(--text-3);
  text-align: center;
}
.ms-rating-row__place.top-0 { color: #ffd700; }
.ms-rating-row__place.top-1 { color: #c0c0c0; }
.ms-rating-row__place.top-2 { color: #cd7f32; }
.ms-rating-row__icon {
  width:        40px;
  height:       40px;
  border-radius:var(--radius-sm);
  object-fit:   cover;
}
.ms-rating-row__info { min-width: 0; }
.ms-rating-row__name {
  font-weight:  600;
  white-space:  nowrap;
  overflow:     hidden;
  text-overflow:ellipsis;
}
.ms-rating-row__meta {
  display:   flex;
  gap:       .4rem;
  flex-wrap: wrap;
  margin-top:.2rem;
}
.ms-rating-row__players,
.ms-rating-row__votes,
.ms-rating-row__rating {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  text-align:     center;
}

/* ─── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  .ms-nav__links, .ms-nav__auth { display: none; }
  .ms-nav__burger { display: flex; margin-left: auto; }
  .ms-footer__inner { grid-template-columns: 1fr; }
  .ms-server-grid   { grid-template-columns: 1fr; }
  .ms-hero__stats   { gap: 1.5rem; }
  .ms-rating-row { grid-template-columns: 36px 36px 1fr 64px; }
  .ms-rating-row__votes, .ms-rating-row__rating { display: none; }
}
