/* ============================================================
   loader-limits.css — Стили панели лимитов загрузки (v2)
   Профессиональный сайдбар с карточками лимитов
   ============================================================ */

/* ---- КОНТЕЙНЕР ПАНЕЛИ ---- */
.limits-panel {
  background: linear-gradient(180deg, #10181e 0%, #0d151b 100%);
  border: 1px solid #293b44;
  border-radius: 12px;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  animation: fadeSlide 0.4s ease;
  flex-shrink: 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* ---- СЕТКА КАРТОЧЕК ---- */
.limits-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #2f404a transparent;
}

/* ---- ЗАГОЛОВОК ПАНЕЛИ ---- */
.limits-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #26343d;
}

.limits-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: #d4e6f2;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  letter-spacing: 0.2px;
}

.limits-panel-header h3 i {
  color: #40a0d0;
  font-size: 14px;
}

/* ---- БЕЙДЖ СТАТУСА (PRO / FREE / DEV) ---- */
.limits-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 16px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
}

.limits-badge.free {
  background: #1a2632;
  border: 1px solid #2a4050;
  color: #80a0b8;
}

.limits-badge.pro {
  background: linear-gradient(135deg, #2a2010, #1a1408);
  border: 1px solid #5a4a20;
  color: #f0c060;
}

.limits-badge.dev {
  background: #1a2a1a;
  border: 1px solid #2a5a2a;
  color: #6ad06a;
}

/* ---- СЕТКА КАРТОЧЕК ---- */
.limits-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #2f404a transparent;
}

.limits-grid::-webkit-scrollbar {
  width: 4px;
}
.limits-grid::-webkit-scrollbar-track {
  background: transparent;
}
.limits-grid::-webkit-scrollbar-thumb {
  background: #2f404a;
  border-radius: 2px;
}

/* ---- КАРТОЧКА ЛИМИТА ---- */
.limit-card {
  background: #0d171e;
  border: 1px solid #1e2c35;
  border-radius: 10px;
  padding: 10px 12px 10px 14px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Внутренний контейнер для transform — чтобы масштабирование не вызывало скролл */
.limit-card-inner {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-radius: 10px;
}

/* Когда карточка подсвечивается — scale на внутреннем элементе, overflow: hidden на карточке обрезает лишнее */
.limit-card.will-consume .limit-card-inner {
  transform: scale(1.02);
}

/* Левая цветная полоска-акцент */
.limit-card::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  transition: all 0.35s ease;
}

/* Цветовые состояния */
.limit-card.green::before  { background: linear-gradient(180deg, #3a8a5a, #2a6a4a); }
.limit-card.yellow::before { background: linear-gradient(180deg, #c0a040, #8a7a20); }
.limit-card.red::before    { background: linear-gradient(180deg, #c05050, #8a2a2a); }
.limit-card.dev::before    { background: linear-gradient(180deg, #5ab05a, #2a5a2a); }

.limit-card.red {
  border-color: #3a2020;
}

/* Hover эффект */
.limit-card:hover {
  border-color: #2f4a55;
  background: #0f1a23;
}

/* ---- ИКОНКА И НАЗВАНИЕ КАРТОЧКИ ---- */
.limit-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.limit-card-icon {
  font-size: 12px;
  width: 18px;
  text-align: center;
}

.limit-card.green  .limit-card-icon { color: #4a9a6a; }
.limit-card.yellow .limit-card-icon { color: #c0a040; }
.limit-card.red    .limit-card-icon { color: #c06060; }
.limit-card.dev    .limit-card-icon { color: #6ad06a; }

.limit-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #c0d6e4;
  flex: 1;
}

.limit-card-range {
  font-size: 10px;
  color: #506e80;
  margin-bottom: 6px;
  margin-left: 24px;
}

/* ---- ПРОГРЕСС-БАР ---- */
.limit-bar {
  height: 4px;
  background: #1a2832;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
}

.limit-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.limit-card.green  .limit-bar-fill { background: linear-gradient(90deg, #2a6a4a, #5ab07a); }
.limit-card.yellow .limit-bar-fill { background: linear-gradient(90deg, #6a5a20, #c0a040); }
.limit-card.red    .limit-bar-fill { background: linear-gradient(90deg, #6a2a2a, #c05050); }
.limit-card.dev    .limit-bar-fill { background: linear-gradient(90deg, #2a5a2a, #5ab05a); width: 100%; }

/* ---- СЧЁТЧИК ---- */
.limit-card-count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 11px;
  color: #6d8fa0;
}

.limit-card-count .used {
  font-size: 16px;
  font-weight: 700;
  color: #dcecf5;
  line-height: 1;
}

.limit-card-count .total {
  font-size: 12px;
  color: #506e80;
}

.limit-card-count .remaining {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.limit-card.green  .limit-card-count .remaining { color: #5ab07a; background: rgba(90, 176, 122, 0.1); }
.limit-card.yellow .limit-card-count .remaining { color: #c0a040; background: rgba(192, 160, 64, 0.1); }
.limit-card.red    .limit-card-count .remaining { color: #c06060; background: rgba(192, 96, 96, 0.1); }

/* ---- DEV БЕЗЛИМИТ ---- */
.limit-card.dev .limit-card-count {
  justify-content: center;
  margin-top: 0;
}

.limit-card.dev .infinity {
  font-size: 20px;
  font-weight: 700;
  color: #6ad06a;
  line-height: 1;
}

/* ---- КНОПКА PRO ---- */
.limits-pro-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(135deg, #3a2a10, #2a1a08);
  border: 1px solid #5a4a20;
  color: #f0c060;
  transition: 0.25s;
  cursor: pointer;
  flex-shrink: 0;
}

.limits-pro-link:hover {
  background: linear-gradient(135deg, #4a3a18, #3a2a10);
  border-color: #7a6a30;
  box-shadow: 0 4px 16px rgba(200, 160, 40, 0.15);
  transform: translateY(-1px);
}

.limits-pro-link i {
  font-size: 12px;
}

/* ============================================================
   ПОДСВЕТКА ЛИМИТА, КОТОРЫЙ БУДЕТ ИЗРАСХОДОВАН
   ============================================================ */

/* Затемнение всех карточек при активной подсветке */
.limits-grid.has-highlight .limit-card:not(.will-consume) {
  opacity: 0.45;
  filter: saturate(0.5);
}

.limits-grid.has-highlight .limit-card:not(.will-consume) .limit-card-inner {
  transform: scale(0.97);
}

/* Активная карточка */
.limit-card.will-consume {
  border-color: rgba(64, 160, 208, 0.6);
  background: linear-gradient(135deg, #0f1e28, #0d1820);
  box-shadow:
    0 0 0 1px rgba(64, 160, 208, 0.4),
    0 0 24px rgba(64, 160, 208, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* Усиленная левая полоска */
.limit-card.will-consume::before {
  width: 4px;
  background: linear-gradient(180deg, #60c0e8, #40a0d0) !important;
  box-shadow: 0 0 12px rgba(64, 160, 208, 0.6);
}

/* "Призрак" на прогресс-баре — показывает, где будет лимит после загрузки */
.limit-bar-preview {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 6px;
  background: rgba(64, 160, 208, 0.25);
  border-right: 2px solid rgba(64, 160, 208, 0.7);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
  z-index: 1;
}

/* Индикатор-бейдж "Будет использован" — выезжает сверху */
.limit-consume-badge {
  position: absolute;
  top: -1px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #1a3a4a, #0f2838);
  border: 1px solid rgba(64, 160, 208, 0.5);
  border-top: none;
  color: #80d0f0;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px 3px 8px;
  border-radius: 0 0 10px 10px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  z-index: 3;
  animation: badgeSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(64, 160, 208, 0.2);
}

.limit-consume-badge i {
  font-size: 9px;
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgeSlideDown {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Пульсирующая рамка активной карточки */
.limit-card.will-consume::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(64, 160, 208, 0.3), transparent, rgba(64, 160, 208, 0.15)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: borderShimmer 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes borderShimmer {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* Текст-подсказка под прогресс-баром активной карточки */
.limit-consume-info {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #60a0c0;
  margin-top: 6px;
  animation: infoFadeIn 0.4s ease 0.3s both;
}

.limit-consume-info i {
  font-size: 10px;
}

@keyframes infoFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- АДАПТИВНОСТЬ ---- */
@media (max-width: 960px) {
  .limits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    overflow-y: visible;
  }

  .limits-grid.has-highlight .limit-card:not(.will-consume) .limit-card-inner {
    transform: scale(0.95);
  }
}

@media (max-width: 700px) {
  .limits-grid {
    grid-template-columns: 1fr;
  }

  .limits-panel {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .limits-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
  }
}

@media (max-width: 480px) {
  .limit-card {
    padding: 8px 10px 8px 12px;
  }
}
