/**
 * TWX Panel - Stylesheet
 * Standalone CSS for TWX Panel Runtime Library
 * 
 * Usage:
 *   <link rel="stylesheet" href="twx-panel.css">
 *   <script src="twx-panel.js"></script>
 */

/* ══════════════════════════════════════════════════════════════════════════ */
/* Fonts Import */
/* ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ══════════════════════════════════════════════════════════════════════════ */
/* Panel Wrapper */
/* ══════════════════════════════════════════════════════════════════════════ */

.twx-panel-wrapper {
  position: absolute;
  transition: transform 0.4s ease;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  line-height: 1.3;
  color: rgba(148, 163, 184, 0.6);
  box-sizing: border-box;
}

.twx-panel-wrapper *,
.twx-panel-wrapper *::before,
.twx-panel-wrapper *::after {
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* Panel Structure */
/* ══════════════════════════════════════════════════════════════════════════ */

.twx-panel-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.twx-gradient-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* Header */
/* ══════════════════════════════════════════════════════════════════════════ */

.twx-header {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.twx-header:active {
  cursor: grabbing;
}

.twx-header-dot {
  border-radius: 50%;
  flex-shrink: 0;
}

.twx-header-title {
  font-weight: 700;
  color: rgba(248, 250, 252, 0.88);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.twx-header-button {
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.twx-header-button:hover {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* Body */
/* ══════════════════════════════════════════════════════════════════════════ */

.twx-body {
  flex: 1;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.twx-resize-handle {
  position: absolute;
  bottom: 2px;
  right: 2px;
  opacity: 0.2;
  cursor: nwse-resize;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* Layout */
/* ══════════════════════════════════════════════════════════════════════════ */

.twx-dragging {
  z-index: 10000 !important;
}

.twx-rows {
  display: flex;
  flex-direction: column;
}

.twx-columns {
  display: flex;
}

.twx-column-child {
  min-width: 0;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/* Hover Effects */
/* ══════════════════════════════════════════════════════════════════════════ */

.twx-hover-glow:hover {
  filter: brightness(1.3);
  box-shadow: 0 0 8px currentColor;
}

.twx-hover-lift:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.twx-hover-brighten:hover {
  filter: brightness(1.4);
}
/* ══════════════════════════════════════════════════════════════
   TWX Panel — Scrollbar
   ══════════════════════════════════════════════════════════════ */

[data-twx-body] {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.25) transparent;
}
[data-twx-body]::-webkit-scrollbar {
  width: 5px;
}
[data-twx-body]::-webkit-scrollbar-track {
  background: transparent;
}
[data-twx-body]::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 4px;
}
[data-twx-body]::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.4);
}

/* ══════════════════════════════════════════════════════════════
   TWX Panel — Variable Explorer
   ══════════════════════════════════════════════════════════════ */

.twx-ve-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
.twx-ve-item:hover {
  background: rgba(56, 189, 248, 0.06);
}

.twx-ve-cb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(100, 116, 139, 0.35);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}
.twx-ve-cb:checked {
  background: var(--ve-color, #06d6a0);
  border-color: var(--ve-color, #06d6a0);
}
.twx-ve-cb:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 2px;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
}

.twx-ve-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.twx-ve-name {
  font-size: 13px;
  color: rgba(226, 232, 240, 0.85);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.twx-ve-path {
  font-size: 9px;
  color: rgba(148, 163, 184, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.twx-ve-search {
  width: 100%;
  padding: 5px 8px 5px 26px;
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}
.twx-ve-search:focus {
  border-color: rgba(56, 189, 248, 0.3);
}
.twx-ve-search::placeholder {
  color: rgba(148, 163, 184, 0.3);
}

.twx-ve-btn {
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.twx-ve-btn:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}
.twx-ve-btn:active {
  transform: translateY(0);
}

.twx-ve-chevron {
  transition: transform 0.25s ease;
}
.twx-ve-collapsed .twx-ve-chevron {
  transform: rotate(-90deg);
}

/* ══════════════════════════════════════════════════════════════
   TWX Panel — Trend Popup Animation
   ══════════════════════════════════════════════════════════════ */

@keyframes twx-popup-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.twx-trend-popup {
  animation: twx-popup-in 0.25s ease-out;
}
/* ══════════════════════════════════════════════════════════════
   TWX Panel Manager
   ══════════════════════════════════════════════════════════════ */

.twx-pm-list::-webkit-scrollbar {
    width: 3px;
}

.twx-pm-list::-webkit-scrollbar-track {
    background: transparent;
}

.twx-pm-list::-webkit-scrollbar-thumb {
    background: rgba(56,189,248,0.2);
    border-radius: 2px;
}

.twx-pm-row {
    transition: background .15s;
}

    .twx-pm-row:hover {
        background: rgba(56,189,248,0.06) !important;
    }

.twx-pm-tog {
    width: 28px;
    height: 15px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
}

.twx-pm-tog-knob {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    transition: left .2s;
}

@keyframes twx-pm-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(56,189,248,0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(56,189,248,0);
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Unified #listCard Sidebar  (Cards + Panels in one flat list)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── search row ─────────────────────────────────────────────────────────── */
.list-toolbar {
    padding: 6px 8px 0;
}

.list-toolbar #unifiedSearchBox {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: rgba(2,8,20,0.6);
    border: 1px solid rgba(56,189,248,0.25);
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 11px;
    padding: 5px 10px;
    outline: none;
}

.list-toolbar #unifiedSearchBox::placeholder {
    color: rgba(148,163,184,0.45);
}

.list-toolbar #unifiedSearchBox:focus {
    border-color: rgba(56,189,248,0.55);
    background: rgba(2,8,20,0.8);
}

/* ── action buttons row ─────────────────────────────────────────────────── */
.list-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px 6px;
    border-bottom: 1px solid rgba(56,189,248,0.12);
}

.list-actions button {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    width: auto;                            /* cancel cards.css #btnResetCards { width:100% } */
    margin: 0;                              /* cancel cards.css top margin */
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 4px;
    color: rgba(148, 163, 184, 0.65);
    font-size: 10px;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 5px 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.list-actions button:hover {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

/* ── the list itself ────────────────────────────────────────────────────── */
#listCard {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

/* ── each row ───────────────────────────────────────────────────────────── */
.twx-list-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 8px;
    border-bottom: 1px solid rgba(56,189,248,0.06);
    transition: background 0.12s;
}

.twx-list-item:hover {
    background: rgba(56,189,248,0.06);
}

/* coloured dot — cards get cyan, panels get a softer teal */
.twx-list-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    opacity: 0.7;
}

[data-panel-id] .twx-list-dot {
    background: #67e8f9;
}

/* label */
.twx-list-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #cbd5e1;
    letter-spacing: 0.02em;
}

/* hidden items get dimmed label */
.twx-list-item[data-status="hide"] .twx-list-label {
    opacity: 0.4;
    font-style: italic;
}

/* ── focus (◎) button ───────────────────────────────────────────────────── */
.twx-list-focus {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    align-self: center;
    background: none;
    border: none;
    color: rgba(56,189,248,0.45);
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    margin: 0;
    cursor: pointer;
    transition: color 0.15s;
}

.twx-list-focus:hover {
    color: #38bdf8;
}

/* ── toggle switch ──────────────────────────────────────────────────────── */
.twx-list-toggle {
    flex-shrink: 0;
    align-self: center;          /* force true vertical centre in flex row */
    position: relative;
    display: block;              /* block avoids inline baseline offset */
    width: 30px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

.twx-list-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.twx-list-knob {
    position: absolute;
    inset: 0;
    background: rgba(56,189,248,0.12);
    border: 1px solid rgba(56,189,248,0.25);
    border-radius: 16px;
    transition: background 0.2s, border-color 0.2s;
}

.twx-list-knob::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(148,163,184,0.5);
    transition: left 0.2s, background 0.2s;
}

.twx-list-toggle input:checked + .twx-list-knob {
    background: rgba(56,189,248,0.22);
    border-color: rgba(56,189,248,0.55);
}

.twx-list-toggle input:checked + .twx-list-knob::after {
    left: 16px;
    background: #38bdf8;
}