/* ============================================================================
   Statistika › Kanalai page — page-scoped styles
   ----------------------------------------------------------------------------
   File layout:
     1. Page shell
     2. Breadcrumb
     3. Filters row (Rodyti: + dropdown + Priverstinai atnaujinti)
     4. Channel cards grid (7 per row on desktop)
     5. Single channel card — 2-row coloured block (header + body)
     6. TOP prasčiausi bar cards + tooltip
     7. Responsive — all @media queries consolidated at the end
   ============================================================================ */


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

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

.schan-scroll {
  min-height: 0;
  padding: 16px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.2);
  scrollbar-width: none;
}

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


/* ============================ 2. Breadcrumb ============================ */
.schan-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;
  margin-bottom: -2px;
}

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

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


/* ============================ 3. Filters row ============================ */
.schan-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-height: 38px;
}

.schan-filter-text {
  font-size: 14px;
  color: var(--dark4txt);
  white-space: nowrap;
}

.schan-dropdown {
  position: relative;
  display: inline-flex;
  width: 200px;
}

.schan-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--white);
  border-radius: 8px;
  background: var(--white);
  color: var(--dark4txt);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.schan-dropdown-toggle:hover {
  background: rgba(0, 0, 0, 0.03);
}

.schan-dropdown-toggle strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.schan-dropdown-toggle img {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

.schan-dropdown.is-open .schan-dropdown-toggle img {
  transform: rotate(180deg);
}

.schan-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.schan-dropdown-menu[hidden] {
  display: none;
}

.schan-dropdown-menu button {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dark4txt);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.schan-dropdown-menu button:hover {
  background: rgba(123, 85, 203, 0.08);
}

/* "Priverstinai atnaujinti" refresh button */
.schan-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--white);
  border-radius: 8px;
  background: var(--button-bg-color);
  color: var(--dark4txt);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.schan-refresh-btn:hover {
  background: var(--white);
}


/* ============================ 4. Channel cards grid ============================ */
.schan-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  padding-bottom: 8px;
}


/* ============================ 5. Single channel card ======= */
.schan-card {
  gap: 2px;
  display: flex;
  flex-direction: column;
  min-height: 83px;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
  line-height: 18px;
  color: var(--dark4txt);
}

.schan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  font-weight: 600;
}

.schan-card-head strong {
  font-weight: 400;
}

.schan-card-head span {
  font-weight: 500;
  font-size: 14px;
  color: var(--dark4txt);
}

.schan-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 45px;
  padding: 4px 10px 7px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.schan-card-server {
  font-weight: 500;
  font-size: 12px;
  color: #173a8d;
}

.schan-card-status {
  font-size: 12px;
  color: var(--dark4txt);
}

.schan-card-body.is-red    { background: #f4b5bb; }
.schan-card-body.is-red    .schan-card-status { color: #ed0061; }
.schan-card:has(.schan-card-body.is-red)   .schan-card-head { background: #f4b5bb; }

.schan-card-body.is-amber  { background: #fff3cd; }
.schan-card-body.is-amber  .schan-card-status { color: #ed0061; }
.schan-card:has(.schan-card-body.is-amber) .schan-card-head { background: #fff5d8; }

.schan-card-body.is-green  { background: #e8ffe9; }
.schan-card:has(.schan-card-body.is-green) .schan-card-head { background: #e8ffe9; }


/* ============================ 5b. TOP prasčiausi card ========================*/
.schan-tcard {
  display: flex;
  flex-direction: column;
  min-height: 93px;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
  line-height: 16px;
  color: var(--dark4txt);
  background: var(--white);
  cursor: default;
}

.schan-tcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 34px;
  padding: 6px 16px;
  font-weight: 600;
  color: var(--dark4txt);
  background: rgba(255, 255, 255, 0.8);
}

.schan-tcard-head strong {
  font-size: 14px;
  font-weight: 400;
}

.schan-tcard-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 59px;
  padding: 0 16px 6px;
  font-size: 12px;
}

.schan-tcard-server {
  text-align: center;
  font-weight: 600;
  color: var(--dark4txt);
  color: #173a8d;
}

.schan-tcard-bar {
  display: block;
  width: 100%;
  height: 25px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.35);
  background-image: linear-gradient(
    to right,
    var(--bar-fill, #78c6b9) 0%,
    var(--bar-fill, #78c6b9) var(--bar-before, 66%),
    var(--bar-line, #ffe66a) var(--bar-before, 66%),
    var(--bar-line, #ffe66a) calc(var(--bar-before, 66%) + 2px),
    var(--bar-fill, #78c6b9) calc(var(--bar-before, 66%) + 2px),
    var(--bar-fill, #78c6b9) 100%
  );
}

.schan-tcard-status {
  text-align: center;
  color: var(--dark4txt);
}

/* Colour variants — body bg + bar accent */
.schan-tcard.is-green {
  background: #e8ffe9;
  --bar-fill: #78c6b9;
  --bar-line: #ffe86a;
  --bar-before: 66%;
}
.schan-tcard.is-amber {
  background: #fff3cd;
  --bar-fill: #ffe273;
  --bar-line: #ffe273;
  --bar-before: 0%;
}
.schan-tcard.is-red {
  background: #ffc4c8;
  --bar-fill: #df645f;
  --bar-line: #df645f;
  --bar-before: 0%;
}
.schan-tcard.is-grey {
  background: #e8e8ea;
  --bar-fill: #6a6a6a;
  --bar-line: #6a6a6a;
  --bar-before: 9%;
}

/* First grey card — 47% grey + 3% amber stripe + 50% green */
.schan-tcard.is-grey-1 .schan-tcard-bar {
  background-image: linear-gradient(
    to right,
    #6a6a6a 0%,
    #6a6a6a 47%,
    #ffe273 47%,
    #ffe273 50%,
    #78c6b9 50%,
    #78c6b9 100%
  );
}

/* Second grey card — 20% grey + 80% green */
.schan-tcard.is-grey-2 .schan-tcard-bar {
  background-image: linear-gradient(
    to right,
    #6a6a6a 0%,
    #6a6a6a 20%,
    #78c6b9 20%,
    #78c6b9 100%
  );
}

.schan-tcard.is-green .schan-tcard-head { background: #e8ffe9; }
.schan-tcard.is-amber .schan-tcard-head { background: #fff3cd; }
.schan-tcard.is-red   .schan-tcard-head { background: #ffc4c8; }
.schan-tcard.is-grey  .schan-tcard-head { background: #e8e8ea; }

/* ============================ 6. TOP card tooltip ============================ */
.schan-tooltip {
  position: fixed;
  z-index: 70;
  display: none;
  min-width: 178px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  color: var(--dark4txt);
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
}

.schan-tooltip.is-open {
  display: block;
}

.schan-tooltip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
  font-weight: 600;
}

.schan-tooltip-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schan-tooltip-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schan-tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.schan-tooltip-label {
  flex: 1 1 auto;
  color: var(--grey4txt);
}

.schan-tooltip-value {
  font-weight: 600;
}


/* ============================ View switching ======================   is shown — the other one is hidden. */
.schan-page .schan-grid--all,
.schan-page .schan-grid--top {
  display: none;
}

.schan-page.is-view-all .schan-grid--all {
  display: grid;
}

.schan-page.is-view-top .schan-grid--top {
  display: grid;
}


/* ============================================================================
   7. Responsive — all @media queries consolidated at the end
   Breakpoints:
     1280px → 6 cards / row
     1024px → 5 cards / row
      900px → 4 cards / row
      720px → 3 cards / row
      520px → 2 cards / row
      360px → 1 card / row + filters wrap
   ============================================================================ */
@media (max-width: 1280px) {
  .schan-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .schan-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .schan-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .schan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .schan-filters {
    justify-content: flex-start;
    gap: 8px 12px;
  }
  .schan-dropdown {
    flex: 1 1 100%;
    width: 100%;
  }
  .schan-refresh-btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .schan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schan-card-head { padding: 7px 8px; }
  .schan-card-body { padding: 7px 8px; }
}

@media (max-width: 360px) {
  .schan-grid { grid-template-columns: minmax(0, 1fr); }
}
