/* Файл: catalog/view/theme/default/stylesheet/imlabs_buttons.css */
/*!
 * Module:  iMLabs Buttons — Priority CTA Buttons
 * CMS:     OpenCart 3 / OcStore 3 / LiveStore 3
 * Author:  iMLabs · https://imlabs.ru
 * Version: 5.1.0 (Идеальная перфорация на Flexbox)
 */

/* Обёртка */
.imlabs-buttons-wrap { margin: 15px 0; display: flex; flex-direction: column; }
.imlabs-buttons-item { margin: 0 0 12px; position: relative; }
.imlabs-buttons-item:last-child { margin-bottom: 0; }

/* Кнопка */
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%; box-sizing: border-box;
  padding: 14px 100px 14px 20px;
  margin: 0;
  font-family: inherit; font-size: 1.125rem; font-weight: 700; line-height: 1.3;
  color: #fff; text-align: center; text-decoration: none;
  background-color: var(--primary-color, #337ab7);
  border: 0; border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: background-color var(--t-fast, .15s ease),
              box-shadow var(--t-fast, .15s ease),
              transform var(--t-fast, .15s ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; user-select: none;
  overflow: hidden;
}
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn:hover,
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn:focus {
  color: #fff; text-decoration: none;
  background-color: var(--primary-hover, #286090);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.08));
}
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn:active {
  background-color: var(--primary-hover, #286090);
  transform: translateY(1px);
}
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 4px rgba(51,122,183,.2));
}

/* Контент кнопки */
.imlabs-buttons-btn__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Split-CTA (Отрывной корешок) */
.imlabs-btn-stock-wrap {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Идеально ровные белые кружки на Flexbox */
.imlabs-btn-stock-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  /* Используем Flex для равномерного распределения кружков */
  background-image: radial-gradient(circle, #fff 2px, transparent 2px);
  background-size: 4px 8px;
  background-position: center top;
  background-repeat: repeat-y;
  pointer-events: none;
  z-index: 2;
}

/* Дополнительный слой для гарантии, что нижний кружок не обрежется */
.imlabs-btn-stock-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background-image: radial-gradient(circle, #fff 2px, transparent 2px);
  background-size: 4px 8px;
  background-position: center bottom; /* Привязываем последний кружок к низу */
  background-repeat: repeat-y;
  pointer-events: none;
  z-index: 2;
  /* Оставляем видимым только последний элемент */
  mask-image: linear-gradient(to bottom, transparent, transparent 50%, black 50%, black);
  -webkit-mask-image: linear-gradient(to bottom, transparent, transparent 50%, black 50%, black);
}

/* Круглый белый фон вокруг цифры */
.imlabs-btn-stock-circle {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  padding: 0 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  line-height: 1;
  box-sizing: border-box;
}

.imlabs-btn-stock-circle strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.imlabs-btn-stock-circle span {
  font-size: 0.6rem;
  color: #6b7280;
  font-weight: 700;
  margin-top: 1px;
  text-transform: uppercase;
}

/* Disabled */
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn--disabled,
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn[disabled] {
  background-color: var(--border-color-strong, #d1d5db);
  color: var(--background-light, #f8f9fa);
  cursor: not-allowed; box-shadow: none; filter: grayscale(.3);
}
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn--disabled:hover,
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn--disabled:focus,
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn[disabled]:hover,
.imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn[disabled]:focus {
  background-color: var(--border-color-strong, #d1d5db);
  color: var(--background-light, #f8f9fa);
}

/* Иконка / текст */
.imlabs-buttons-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 24px; height: 24px; color: inherit;
}
.imlabs-buttons-icon svg { display: block; width: 24px; height: 24px; }
.imlabs-buttons-icon svg [stroke] { stroke-width: 2.5; }
.imlabs-buttons-text { display: inline-block; }

/* ─── БЕЙДЖ НАЛИЧИЯ БИЛЕТОВ (ПОД кнопкой, слева) ─── */
.imlabs-stock-under {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted, #6b7280);
  justify-content: flex-start;
}
.imlabs-stock-under__dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: imlabs-pulse-dot 2s infinite;
}
.imlabs-stock-under__num { font-weight: 800; }
.imlabs-stock-under__unit { font-size: 0.85em; opacity: 0.8; }

/* Вариант для листингов */
.imlabs-stock-badge--listing {
  position: absolute;
  bottom: 10px; left: 10px;
  z-index: 6; margin: 0;
  padding: 4px 10px;
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}
.imlabs-stock-badge--listing .imlabs-stock-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: none; box-shadow: none;
  flex-shrink: 0;
}
.imlabs-stock-badge--listing strong { font-weight: 800; }

@keyframes imlabs-pulse-dot {
  0% { box-shadow: 0 0 0 0 var(--dot-color, rgba(0,0,0,0.2)); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Подсказка */
.imlabs-buttons-hint {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 6px 0 0; padding: 0;
  float: right; clear: both;
  font-family: inherit; font-size: .8125rem; font-weight: 500; line-height: 1.3;
  color: var(--text-muted, #9ca3af);
  background: transparent; border: 0; cursor: pointer;
  text-decoration: none;
  transition: color var(--t-fast, .15s ease);
}
.imlabs-buttons-hint:hover, .imlabs-buttons-hint:focus {
  color: var(--primary-color, #337ab7); text-decoration: none;
}
.imlabs-buttons-hint:focus-visible {
  outline: none; border-radius: 3px;
  box-shadow: var(--focus-ring, 0 0 0 4px rgba(51,122,183,.2));
}
.imlabs-buttons-hint-icon { display: block; flex: 0 0 auto; opacity: .8; }

.imlabs-buttons-item::after { content: ''; display: block; clear: both; }

/* Попап с подсказкой */
.imlabs-buttons-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; box-sizing: border-box;
}
.imlabs-buttons-modal[hidden] { display: none; }
.imlabs-buttons-modal__backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity var(--t-fast, .15s ease);
}
.imlabs-buttons-modal.is-open .imlabs-buttons-modal__backdrop { opacity: 1; }
.imlabs-buttons-modal__window {
  position: relative; width: 100%; max-width: 480px;
  max-height: calc(100vh - 40px); overflow: auto; box-sizing: border-box;
  padding: 24px 24px 20px;
  background: #fff; border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.1));
  transform: translateY(10px) scale(.98); opacity: 0;
  transition: transform var(--t-base, .25s cubic-bezier(.25,1,.5,1)),
              opacity var(--t-base, .25s cubic-bezier(.25,1,.5,1));
}
.imlabs-buttons-modal.is-open .imlabs-buttons-modal__window {
  transform: translateY(0) scale(1); opacity: 1;
}
.imlabs-buttons-modal__close {
  position: absolute; top: 8px; right: 12px;
  width: 36px; height: 36px; padding: 0;
  font-size: 26px; line-height: 1; color: var(--text-muted, #9ca3af);
  background: transparent; border: 0; cursor: pointer;
  transition: color var(--t-fast, .15s ease);
}
.imlabs-buttons-modal__close:hover,
.imlabs-buttons-modal__close:focus { color: var(--text-primary, #1a1d21); }
.imlabs-buttons-modal__content {
  margin: 0 0 16px;
  font-size: 1.0625rem; line-height: 1.55; color: var(--text-primary, #1a1d21);
  text-align: left; word-wrap: break-word; overflow-wrap: break-word;
}
.imlabs-buttons-modal__ok {
  display: inline-block; padding: 12px 24px;
  font-family: inherit; font-size: 1.0625rem; font-weight: 700;
  color: #fff; background: var(--primary-color, #337ab7);
  border: 0; border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: background-color var(--t-fast, .15s ease);
}
.imlabs-buttons-modal__ok:hover,
.imlabs-buttons-modal__ok:focus { background: var(--primary-hover, #286090); }

/* Стикер статуса (soldout/past) */
.imlabs-status-overlay {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  max-width: calc(100% - 20px); box-sizing: border-box;
  pointer-events: none; z-index: 5;
  animation: imlabs-overlay-fade .25s ease;
}
.imlabs-status-overlay__label {
  display: inline-block; padding: 8px 14px;
  font-family: inherit; font-size: .8125rem; font-weight: 700; line-height: 1.2;
  color: #fff; text-align: center;
  background: var(--c-danger, #dc3545);
  border-radius: var(--radius-md, 12px);
  letter-spacing: .3px; text-transform: uppercase;
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.08));
  white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.imlabs-status-overlay--past .imlabs-status-overlay__label {
  background: var(--text-light, #6b7280);
}

.product-thumb .image,
.product-thumb .dc-card__image { position: relative; overflow: hidden; }

@keyframes imlabs-overlay-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Мобильная адаптация */
@media (max-width: 480px) {
  .imlabs-buttons-item > .imlabs-buttons-row > .imlabs-buttons-btn {
    padding: 12px 70px 12px 16px;
    font-size: 1.0625rem;
  }
  .imlabs-btn-stock-wrap { width: 64px; }
  .imlabs-btn-stock-wrap::before,
  .imlabs-btn-stock-wrap::after { 
    top: 8px; 
    bottom: 8px; 
    background-image: radial-gradient(circle, #fff 1.5px, transparent 1.5px);
    background-size: 4px 6px; 
  }
  .imlabs-btn-stock-circle {
    min-width: 38px; height: 38px; padding: 0 4px;
  }
  .imlabs-btn-stock-circle strong { font-size: 0.95rem; }
  .imlabs-btn-stock-circle span { font-size: 0.55rem; }

  .imlabs-buttons-hint { font-size: .75rem; }
  .imlabs-buttons-modal { padding: 10px; }
  .imlabs-buttons-modal__window { padding: 20px 16px 16px; max-height: calc(100vh - 20px); }
  .imlabs-buttons-modal__content { font-size: 1rem; }
  .imlabs-status-overlay { top: 6px; right: 6px; }
  .imlabs-status-overlay__label { font-size: .75rem; padding: 6px 12px; }
  
  .imlabs-stock-under { margin-top: 8px; font-size: 0.8125rem; }
  .imlabs-stock-badge--listing { bottom: 6px; left: 6px; padding: 3px 8px; font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .imlabs-buttons-btn,
  .imlabs-buttons-hint,
  .imlabs-buttons-modal__backdrop,
  .imlabs-buttons-modal__window,
  .imlabs-buttons-modal__ok,
  .imlabs-status-overlay,
  .imlabs-stock-dot,
  .imlabs-stock-under__dot {
    transition: none; animation: none;
  }
}