/* --- VARIABLES --- */
:root {
  --ui-bg-window: #0c0c0c;
  --ui-bg-card: #181818;
  --ui-border: #2a2a2e;
  --ui-accent: #3b82f6;
  --ui-text-main: #fff;
  --ui-text-muted: #888;
}

/* --- MAIN CONTAINER --- */
.ui-window {
  background-color: var(--ui-bg-window);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.5rem;
  height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Важно: скрывает курсор, когда он паркуется за пределами */
  position: relative;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.3s ease, transform 0.3s ease;
  user-select: none; /* Чтобы текст не выделялся случайно */
}

.ui-window:hover {
  border-color: #555;
  transform: translateY(-2px);
}

/* --- BODY --- */
.ui-body {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  /* Легкий фоновый эффект */
  background: radial-gradient(circle at 50% 30%, #151515 0%, #0c0c0c 70%);
}

/* --- CARDS --- */
.ui-card {
  position: absolute;
  background: var(--ui-bg-card);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, border-color 0.2s;
  z-index: 10;
}
.ui-card:hover {
  border-color: #444;
}

/* Card 1: Stats */
.card-stats {
  /* Desktop Default */
  top: 20px;
  left: 20px;
  width: 130px;
  height: 85px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ui-label { font-size: 8px; color: var(--ui-text-muted); text-transform: uppercase; font-weight: 600; }
.ui-value { font-size: 20px; color: var(--ui-text-main); font-weight: 600; letter-spacing: -0.5px; }

.ui-progress-track { height: 4px; width: 100%; background: #333; border-radius: 2px; overflow: hidden; }
.ui-progress-fill { height: 100%; width: 0%; background: var(--ui-accent); transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Card 2: User */
.card-user {
  /* Desktop Default */
  top: 20px;
  right: 20px;
  left: 170px; /* Чтобы не наезжал на stats на ПК */
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
}
.ui-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.ui-avatar::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 8px; height: 8px; background: #27c93f;
  border: 2px solid var(--ui-bg-card); border-radius: 50%;
}
.ui-user-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ui-user-name { font-size: 11px; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-user-role { font-size: 9px; color: var(--ui-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-follow {
  padding: 5px 10px;
  background: white;
  color: black;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer; /* Для JS логики, но реальный клик перехватывается */
  transition: 0.2s;
  white-space: nowrap;
}
.btn-follow.active {
  background: #333; color: white; transform: scale(0.95);
}

/* Card 3: List */
.card-list {
  /* Desktop Default */
  bottom: 20px;
  left: 20px;
  right: 20px;
  height: 75px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.ui-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 20px;
}
.skel-bar {
  height: 6px; background: #333;
  border-radius: 3px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.skel-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%);
  animation: ui-shimmer 1.5s infinite;
}

.real-content {
  display: none; width: 100%; justify-content: space-between; align-items: center;
  font-size: 10px; color: #ccc;
}
.real-content span:last-child { color: var(--ui-text-muted); font-size: 9px; }

.ui-list-item.loaded .skel-bar { display: none; }
.ui-list-item.loaded .real-content { display: flex; animation: ui-fadeIn 0.4s ease; }

/* --- CURSOR --- */
.cursor-container {
  position: absolute;
  top: 0; left: 0;
  z-index: 999;
  pointer-events: none; /* КРИТИЧНО: чтобы реальная мышь не взаимодействовала с fake-курсором */
  will-change: transform;
}
.cursor-svg {
  width: 18px; height: 18px;
  fill: white;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  transition: transform 0.15s ease;
}
/* Анимация клика (scale down) */
.cursor-click .cursor-svg { transform: scale(0.75); }

/* --- ANIMATIONS --- */
@keyframes ui-shimmer { 100% { transform: translateX(100%); } }
@keyframes ui-fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

/* --- MOBILE ADAPTATION (Vertical Stack) --- */
@media (max-width: 520px) {
  /* Полная перестройка лейаута для телефонов. Стек: User -> Stats -> List */

  /* 1. Карточка USER теперь сверху и на всю ширину */
  .card-user {
    top: 15px;
    left: 15px;
    right: 15px;
    height: 48px;
    width: auto;
  }

  /* 2. Карточка STATS (Revenue) - РАСТЯНУТАЯ */
  .card-stats {
    top: 73px;    /* 15 + 48 + 10 (gap) */
    left: 15px;
    right: 15px;
    width: auto;
    height: 65px;
    padding: 10px;
  }

  .ui-value {
    font-size: 16px;
  }

  /* 3. Карточка LIST в самый низ */
  .card-list {
    top: auto;
    bottom: 15px;
    left: 15px;
    right: 15px;
    height: 55px;
    gap: 6px;
    padding: 8px 10px;
  }
  .ui-list-item {
    height: 16px;
  }
  .real-content {
    font-size: 9px;
  }
}