.sessionsPage {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  :global {
    .qwenpaw-spark-card-wrapper {
      padding: 0 !important;
    }
    .qwenpaw-table-wrapper
      .qwenpaw-table-container
      .qwenpaw-table-thead
      > tr
      > th {
      background: #f9f8f4 !important;
    }
  }
}

.pageHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding: 20px;
  border-bottom: 1px solid #eae9e7;
  flex-shrink: 0;
}

.breadcrumbHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  flex: 1;
}

.breadcrumbParent {
  color: #999;
  font-weight: 400;
}

.breadcrumbSeparator {
  color: #ccc;
  margin: 0 4px;
}

.breadcrumbCurrent {
  color: #333;
  font-weight: 600;
  font-size: 20px;
}

.headerRight {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filterBar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.description {
  color: #999;
  font-size: 14px;
  margin: 0;
  display: none;
}

.tableCard {
  :global(.ant-card-body) {
    padding: 0;
  }
  overflow-y: auto;
}

.formActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Mobile card list */
.mobileCardList {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.mobileSessionCard {
  border-radius: var(--border-radius, 8px);
  background: #ffffff;
  border: 1px solid #eae8e7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease-in-out;

  &:hover {
    border-color: #d9d9d9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
}

.mobileSessionHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.mobileSessionName {
  font-weight: 600;
  font-size: 16px;
  color: rgba(20, 20, 19, 0.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  line-height: 24px;
}

.mobileSessionChannel {
  flex-shrink: 0;
}

.mobileSessionMeta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: rgba(20, 20, 19, 0.55);
  margin-bottom: 16px;
  line-height: 20px;

  span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.mobileSessionActions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;

  .mobileActionBtn {
    font-size: 13px;
    height: 28px;
    padding: 0 10px;
    color: #666;
    background: transparent;
    border: 1px solid #d9d9d9;
    border-radius: 7px;

    &:hover:not(:disabled) {
      color: #333;
      border-color: #bfbfbf;
    }

    &:disabled {
      color: #d9d9d9;
      cursor: not-allowed;
    }

    &.danger {
      color: #ff4d4f;
      border-color: #ff4d4f;

      &:hover:not(:disabled) {
        color: #ff7875;
        border-color: #ff7875;
      }
    }
  }
}

@media (max-width: 768px) {
  .pageHeader {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
  }

  .headerRight {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .filterBar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .tableCard {
    display: none;
  }
}

/* ─── Dark mode ─────────────────────────────────────────────────────────────── */
:global(.dark-mode) {
  .sessionsPage {
    /* Override the light-mode table header background */
    :global {
      .qwenpaw-table-wrapper
        .qwenpaw-table-container
        .qwenpaw-table-thead
        > tr
        > th {
        background: #2a2a2a !important;
      }
    }
  }

  .pageHeader {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }

  .breadcrumbParent {
    color: rgba(255, 255, 255, 0.35);
  }

  .breadcrumbSeparator {
    color: rgba(255, 255, 255, 0.2);
  }

  .breadcrumbCurrent {
    color: rgba(255, 255, 255, 0.85);
  }

  .title {
    color: rgba(255, 255, 255, 0.85);
  }

  .description {
    color: rgba(255, 255, 255, 0.35);
  }

  /* Selected row styling */
  .selectedRow > td {
    background-color: rgba(97, 92, 237, 0.12) !important;
  }

  .selectedRow:hover > td {
    background-color: rgba(97, 92, 237, 0.2) !important;
  }
  :global(.sessions-filter-input) {
    :global(.qwenpaw-input),
    :global(.ant-input) {
      background: #2a2a2a !important;
      border-color: rgba(255, 255, 255, 0.15) !important;
      color: rgba(255, 255, 255, 0.85) !important;

      &::placeholder {
        color: rgba(255, 255, 255, 0.25) !important;
      }
    }
  }

  :global(.sessions-filter-select) {
    :global(.qwenpaw-select-selector),
    :global(.ant-select-selector) {
      background: #2a2a2a !important;
      border-color: rgba(255, 255, 255, 0.15) !important;
      color: rgba(255, 255, 255, 0.85) !important;
    }

    :global(.qwenpaw-select-selection-placeholder),
    :global(.ant-select-selection-placeholder) {
      color: rgba(255, 255, 255, 0.25) !important;
    }

    :global(.qwenpaw-select-arrow),
    :global(.ant-select-arrow) {
      color: rgba(255, 255, 255, 0.3) !important;
    }
  }

  .mobileSessionCard {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

    &:hover {
      border-color: rgba(255, 255, 255, 0.2);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }
  }

  .mobileSessionName {
    color: rgba(255, 255, 255, 0.85);
  }

  .mobileSessionMeta {
    color: rgba(255, 255, 255, 0.45);
  }

  .mobileSessionActions {
    border-top-color: rgba(255, 255, 255, 0.08);

    .mobileActionBtn {
      color: rgba(255, 255, 255, 0.65);
      background: transparent;
      border-color: rgba(255, 255, 255, 0.2);

      &:hover:not(:disabled) {
        color: rgba(255, 255, 255, 0.85);
        border-color: rgba(255, 255, 255, 0.35);
      }

      &:disabled {
        color: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.1);
      }

      &.danger {
        color: #ff7875;
        border-color: #ff7875;

        &:hover:not(:disabled) {
          color: #ffa39e;
          border-color: #ffa39e;
        }
      }
    }
  }
}
