/* =============================================================
   ServerGrid Component
   Structure: desktop tabs + mobile sheet pattern
   Visual:    L2LegacyWorld .card / .card-badge / .info-item
   ============================================================= */

/* -------------------------------------------------------------
   Section wrapper
   ------------------------------------------------------------- */

.sg-section {
  padding: 90px 0;
}


/* -------------------------------------------------------------
   Desktop Tab Switcher
   Desktop tab switcher
   ------------------------------------------------------------- */

.sg-tabs {
  display: flex;
  gap: 14px;
  margin-bottom: 28px;
}

.sg-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--ease);
  color: var(--text);
  text-align: left;
  min-width: 220px;
}

.sg-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 157, 47, 0.28);
  background: var(--panel-strong);
}

/* Active tab — orange glow border, matches .btn3_server_list_active intent */
.sg-tab--active {
  border-color: var(--accent);
  background: var(--panel-strong);
  box-shadow: 0 0 0 2px rgba(255, 157, 47, 0.15),
              0 8px 28px rgba(0, 0, 0, 0.30);
}

.sg-tab--active .sg-tab-name {
  color: var(--accent-2);
}

.sg-tab-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 157, 47, 0.10);
}

.sg-tab-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sg-tab-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #f0f0f4;
  transition: var(--ease);
}

.sg-tab-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
}


/* -------------------------------------------------------------
   Desktop Detail Panels
   LegacyWorld .card glass surface + split layout
   ------------------------------------------------------------- */

.sg-panel {
  /* inherits .card base from cards.css */
  display: block;
}

.sg-panel[hidden] {
  display: none;
}

.sg-panel-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: start;
}

/* Left column: badge, title, info-list, actions */
.sg-panel-info .card-badge {
  margin-bottom: 14px;
}

.sg-panel-info h3 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
}

.sg-panel-info > p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 22px;
  line-height: 1.6;
}

/* Info rows — from LegacyWorld .info-item */
.sg-info-list {
  display: grid;
  gap: 0;
  margin-bottom: 24px;
}

.sg-info-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sg-info-row:last-child {
  border-bottom: none;
}

.sg-info-row span:first-child {
  color: #f1f1f4;
  font-weight: 700;
  font-size: 14px;
}

.sg-info-row span:last-child {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

/* Value highlights */
.sg-info-row .val--good {
  color: #46d369;
  font-weight: 700;
}

.sg-info-row .val--accent {
  color: var(--accent-2);
  font-weight: 700;
}

.sg-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Right column: feature bullet list */
.sg-panel-features {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Ghosted siege artwork behind the feature list */
.sg-panel-features::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../../img/gallery-siege.webp') center / cover no-repeat;
  opacity: 0.08;
  pointer-events: none;
}

.sg-panel-features > * {
  position: relative;
  z-index: 1;
}

.sg-feature-list {
  list-style: none;
  display: grid;
  gap: 14px;
}

.sg-feature-list li {
  color: #d0d0d8;
  font-size: 15px;
  padding-left: 22px;
  position: relative;
  line-height: 1.5;
}

.sg-feature-list li::before {
  content: '•';
  color: var(--accent);
  font-weight: 900;
  position: absolute;
  left: 0;
}

/* Panel hover glow — extends .card:hover from cards.css */
.sg-panel.card:hover {
  border-color: rgba(255, 209, 138, 0.28);
  box-shadow: var(--shadow), 0 0 40px rgba(255, 157, 47, 0.06);
}


/* -------------------------------------------------------------
   Mobile Trigger Button
   Visible only on mobile (≤768px)
   ------------------------------------------------------------- */

.sg-mob-trigger {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
}

.sg-mob-trigger-icon {
  font-size: 20px;
  color: var(--accent-2);
  line-height: 1;
}


/* -------------------------------------------------------------
   Mobile Sheet — bottom slide-up panel
   Slide-up bottom sheet with drag-to-dismiss support
   ------------------------------------------------------------- */

.sg-mob-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: #0e0e18;
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 20px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
              opacity 0.35s ease;
  opacity: 0;
  will-change: transform;
  max-height: 82vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sg-mob-sheet.open {
  transform: translateY(0);
  opacity: 1;
}

/* Drag handle */
.sg-mob-drag {
  width: 100%;
  padding: 14px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.sg-mob-drag::after {
  content: '';
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

/* Sheet header */
.sg-mob-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 22px 16px;
  border-bottom: 1px solid var(--border);
}

.sg-mob-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.sg-mob-back {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-2);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.sg-mob-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ease);
  flex-shrink: 0;
}

.sg-mob-close:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

/* Mobile server list rows */
.sg-mob-rows {
  padding: 12px 0;
}

.sg-mob-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 22px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--ease);
  text-align: left;
  color: var(--text);
}

.sg-mob-row:last-child {
  border-bottom: none;
}

.sg-mob-row:active {
  background: rgba(255, 255, 255, 0.04);
}

.sg-mob-row-icon {
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 157, 47, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sg-mob-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sg-mob-row-name {
  font-size: 15px;
  font-weight: 800;
  color: #f0f0f4;
}

.sg-mob-row-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.sg-mob-row-arrow {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

/* Mobile detail content area */
.sg-mob-detail-body {
  padding: 22px;
  display: grid;
  gap: 22px;
}

.sg-mob-detail-body .card-badge {
  margin-bottom: 10px;
}

.sg-mob-detail-body h3 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #fff;
}

.sg-mob-detail-body > p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.sg-mob-actions {
  display: grid;
  gap: 10px;
}

.sg-mob-actions .btn {
  width: 100%;
}


/* -------------------------------------------------------------
   Overlay — dims page behind open sheet
   ------------------------------------------------------------- */

.sg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: rgba(0, 0, 0, 0.60);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sg-overlay.visible {
  opacity: 1;
  pointer-events: all;
}


/* -------------------------------------------------------------
   Responsive breakpoints
   ------------------------------------------------------------- */

/* 1024px — 2-col panel inner drops to 1-col */
@media (max-width: 1024px) {
  .sg-panel-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* 768px — panel stacks to single column (tabs removed) */
@media (max-width: 768px) {
  .sg-panel-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
