/* ============================================================================
   Statistika › Kontroleris page — page-scoped styles
   ----------------------------------------------------------------------------
   File layout:
     1. Page shell
     2. Breadcrumb
     3. Card / section heading
     4. Tables (Serveriai + Atjungtos sesijos)
     5. Status pieces (dot, label, toggle)
     6. Responsive — accordion mode + mobile tweaks
   ============================================================================ */


/* ============================ 1. Page shell ============================ */
.app-shell[data-page="statistics-controller"] .content-shell {
  overflow: hidden;
}

.sctrl-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}


/* ============================ 2. Breadcrumb ============================ */
.sctrl-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 26px;
  color: var(--dark4txt);
  font-weight: 500;
}

.sctrl-breadcrumb a {
  text-decoration: none;
  color: inherit;
}

.sctrl-breadcrumb-sep {
  color: var(--grey4txt);
}


/* ============================ 3. Card / section heading ============================ */
.sctrl-scroll {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  gap: 22px;
}

.sctrl-scroll::-webkit-scrollbar {
  display: none;
}

.sctrl-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sctrl-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: 13px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--grey4txt);
}

.sctrl-card-title-text {
  flex: 1;
  min-width: 0;
}

/* Chevron is only visible in accordion mode (≤1300px) */
.sctrl-card-title>img,
.sctrl-card-title>svg {
  display: none;
}


/* ============================ 4. Tables ============================ */
.sctrl-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 13px;
  line-height: 16px;
  color: var(--dark4txt);
  table-layout: fixed;
}

.sctrl-table thead th {
  padding: 0 16px 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--grey4txt);
  text-align: left;
  white-space: nowrap;
}

.sctrl-table tbody tr {
  height: 44px;
  background: rgba(255, 255, 255, 0.56);
}

.sctrl-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.34);
}

.sctrl-table tbody td {
  padding: 4px 16px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sctrl-table tbody tr td:first-child {
  border-radius: 8px 0 0 8px;
}

.sctrl-table tbody tr td:last-child {
  border-radius: 0 8px 8px 0;
}

/* Servers table column widths */
.sctrl-servers th:nth-child(1),
.sctrl-servers td:nth-child(1) {
  width: 22%;
}

.sctrl-servers th:nth-child(2),
.sctrl-servers td:nth-child(2) {
  width: 14%;
  text-align: center;
}

.sctrl-servers th:nth-child(3),
.sctrl-servers td:nth-child(3) {
  width: 14%;
  text-align: center;
}

.sctrl-servers th:nth-child(4),
.sctrl-servers td:nth-child(4) {
  width: 14%;
  text-align: center;
}

.sctrl-servers th:nth-child(5),
.sctrl-servers td:nth-child(5) {
  width: 18%;
  text-align: center;
}

.sctrl-servers th:nth-child(6),
.sctrl-servers td:nth-child(6) {
  width: 17%;
  text-align: right;
  border-radius: 6px;
}

/* Sessions table column widths */
.sctrl-sessions th:nth-child(1),
.sctrl-sessions td:nth-child(1) {
  width: 22%;
}

.sctrl-sessions th:nth-child(2),
.sctrl-sessions td:nth-child(2) {
  width: 24%;
}

.sctrl-sessions th:nth-child(3),
.sctrl-sessions td:nth-child(3) {
  width: 38%;
}

.sctrl-sessions th:nth-child(4),
.sctrl-sessions td:nth-child(4) {
  width: 16%;
  text-align: right;
}


/* ============================ 5. Status pieces ============================ */
.sctrl-status-online {
  color: var(--dark4txt);
}

.sctrl-status-offline,
.sctrl-no {
  color: var(--accent-pink);
  font-weight: 500;
}

.sctrl-yes {
  color: var(--dark4txt);
}

.sctrl-dim {
  color: var(--grey4txt);
}

.sctrl-meta,
.sctrl-mobile-head,
.sctrl-mobile-sub {
  display: none;
}


/* ============================================================================
   6. Responsive — accordion at ≤1300px, finer tweaks ≤600px
   ============================================================================ */

/* ---- ≤ 1300px : single-column accordion ---- */
@media (max-width: 1300px) {
  .app-shell[data-page="statistics-controller"] .content-shell {
    overflow: auto;
  }

  .sctrl-page {
    height: auto;
    grid-template-rows: auto auto;
  }

  .sctrl-scroll {
    padding: 12px;
    background: rgba(255, 255, 255, 0.36);
    border-radius: 16px;
    gap: 0;
    overflow: visible;
  }

  .sctrl-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
  }

  .sctrl-card-title {
    margin: 0;
    padding: 12px 0 10px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
  }

  .sctrl-card+.sctrl-card {
    border-top: 1px solid rgba(3, 5, 34, 0.12);
    margin-top: 6px;
  }

  .sctrl-card-title>img,
  .sctrl-card-title>svg {
    display: inline-block;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    margin-left: auto;
    transition: transform 0.2s ease;
  }

  .sctrl-card.is-open .sctrl-card-title>img,
  .sctrl-card.is-open .sctrl-card-title>svg {
    transform: rotate(180deg);
  }

  /* Hide column headers in accordion mode — labels move into each row */
  .sctrl-table thead {
    display: none;
  }

  /* Tables turn into stacked cards: each tr is a self-contained block */
  .sctrl-table,
  .sctrl-table tbody,
  .sctrl-table tr,
  .sctrl-table td {
    display: block;
    width: 100%;
  }

  .sctrl-table {
    margin-top: 6px;
    border-spacing: 0;
  }

  .sctrl-card:not(.is-open) .sctrl-table {
    display: none;
  }

  .sctrl-table tbody tr {
    height: auto;
    background: rgba(255, 255, 255, 0.72);
    margin-bottom: 10px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(20, 12, 45, 0.08);
  }

  .sctrl-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.34);
  }

  .sctrl-table tbody td {
    padding: 0px;
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
  }

  /* --------- Servers section mobile layout --------- */
  .sctrl-servers tbody tr {
    padding: 0;
  }

  /* Hide standalone cells — info is rendered via .sctrl-meta */
  .sctrl-servers td:not(.sctrl-mobile-head):not(.sctrl-meta) {
    display: none;
  }

  td.sctrl-mobile-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px 8px;
    font-size: 16px;
    line-height: 20px;
    font-weight: 500;
    color: var(--dark4txt);
  }

  .sctrl-mobile-head .sctrl-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
  }

  .sctrl-mobile-head.is-offline .sctrl-dot {
    background: var(--accent-pink);
  }

  .sctrl-mobile-head .sctrl-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sctrl-mobile-head .sctrl-switch {
    width: 36px;
    height: 20px;
    background: var(--accent-green);
    border-radius: 20px;
    position: relative;
    flex: 0 0 36px;
  }

  .sctrl-mobile-head .sctrl-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
  }

  .sctrl-mobile-head.is-offline .sctrl-switch {
    background: var(--grey4txt);
  }

  .sctrl-mobile-head.is-offline .sctrl-switch::after {
    right: auto;
    left: 2px;
  }

  /* Meta strip — 3 column grid with labels above values */
  td.sctrl-meta {
    display: grid;
    grid-template-columns: 2fr 2fr max-content;
    gap: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 2px solid rgba(3, 5, 34, 0.08);
  }

  .sctrl-meta-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 7px 12px 8px;
  }

  .sctrl-meta-item+.sctrl-meta-item {
    border-left: 2px solid rgba(3, 5, 34, 0.08);
  }

  .sctrl-meta-label {
    font-size: 11px;
    color: var(--grey4txt);
    line-height: 14px;
  }

  .sctrl-meta-value {
    font-size: 13px;
    color: var(--dark4txt);
    line-height: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* --------- Sessions section mobile layout --------- */
  .sctrl-sessions tbody tr {
    background: rgba(255, 255, 255, 0.72);
    padding: 0;
  }

  .sctrl-sessions td:not(.sctrl-mobile-head):not(.sctrl-meta):not(.sctrl-mobile-sub) {
    display: none;
  }

  .sctrl-sessions .sctrl-mobile-head {
    padding: 10px 12px 8px;
    font-size: 16px;
    line-height: 20px;
    font-weight: 400;
  }

  .sctrl-mobile-head {
    padding: 12px !important;
  }

  td.sctrl-mobile-sub {
    display: flex;
    flex-direction: column;
    padding: 0 12px 8px;
    font-size: 12px;
    color: var(--grey4txt);
  }

  .sctrl-sessions .sctrl-mobile-sub-label {
    font-size: 11px;
    color: var(--grey4txt);
    line-height: 14px;
  }

  .sctrl-sessions .sctrl-mobile-sub-value {
    font-size: 13px;
    color: var(--dark4txt);
    line-height: 16px;
  }

  .sctrl-sessions .sctrl-meta {
    margin: 0;
    padding: 0;
    border-top: 2px solid rgba(3, 5, 34, 0.08);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sctrl-mobile-sub {
    border-top: 2px solid rgba(3, 5, 34, 0.08);
    padding: 12px !important;
  }

  .sctrl-table tbody tr td:last-child {
    border-radius: 0;
  }
}

/* ---- ≤ 600px : tighter type ---- */
@media (max-width: 600px) {
  .sctrl-scroll {
    padding: 10px;
    border-radius: 14px;
  }

  .sctrl-card-title {
    padding: 10px 0 9px;
  }

  .sctrl-mobile-head {
    font-size: 16px;
  }

  .sctrl-meta-value,
  .sctrl-sessions .sctrl-mobile-sub-value {
    font-size: 12px;
  }

  .sctrl-meta-item {
    padding: 7px 10px 8px;
  }
}