/**
 * Elixar RAL Viewer — полноэкранный просмотр цвета RAL + кнопка «глаз» в ячейках каталога.
 * Подключается вместе с calculator/shop/ral-compare ассетами.
 */

/* === Ячейка каталога: основная кнопка выбора + кнопка просмотра === */

.elx-ral-cell {
  position: relative;
}

.elx-ral-cell-pick {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.elx-ral-cell-eye {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(17, 17, 17, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: .75;
  transition: opacity .15s, transform .1s, box-shadow .15s;
}

.elx-ral-cell-eye:hover {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(17, 17, 17, .25);
}

.elx-ral-cell-eye:focus-visible,
.elx-ral-cell-pick:focus-visible {
  outline: 2px solid #FF4500;
  outline-offset: 2px;
}

.elx-ral-eye-svg {
  width: 14px;
  height: 14px;
  display: block;
  color: #111;
}

@media (hover: none) and (pointer: coarse) {
  .elx-ral-cell-eye { opacity: 1; }
}

/* === Полноэкранный просмотр === */

.elx-ral-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.elx-ral-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .74);
}

.elx-ral-viewer-sheet {
  position: relative;
  width: min(980px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  background: #fff;
  border: 1px solid #111;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.elx-ral-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(17, 17, 17, .12);
}

.elx-ral-viewer-head-text {
  min-width: 0;
}

.elx-ral-viewer-code {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
}

.elx-ral-viewer-name {
  font-size: 13px;
  opacity: .75;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.elx-ral-viewer-x {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(17, 17, 17, .25);
  border-radius: 50%;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}

.elx-ral-viewer-x:hover {
  border-color: #FF4500;
  transform: scale(1.06);
}

.elx-ral-viewer-x:focus-visible,
.elx-ral-viewer-action:focus-visible,
.elx-ral-viewer-tex-btn:focus-visible {
  outline: 2px solid #FF4500;
  outline-offset: 2px;
}

.elx-ral-viewer-body {
  display: flex;
  min-height: 0;
  flex: 1;
}

/* Сцена с макетом постамента */
.elx-ral-viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 20px;
  background:
    linear-gradient(rgba(17, 17, 17, .045) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(17, 17, 17, .045) 1px, transparent 1px) 0 0 / 24px 24px,
    #f4f3f0;
  border-right: 1px solid rgba(17, 17, 17, .12);
}

.elx-ral-viewer-visual {
  position: relative;
  width: min(440px, 100%);
}

.elx-ral-viewer-podium {
  display: block;
  width: 100%;
  height: auto;
}

.elx-ral-viewer-hex {
  font-family: "Space Mono", monospace, monospace;
  font-size: 12px;
  letter-spacing: .08em;
  opacity: .65;
}

/* Боковая панель */
.elx-ral-viewer-side {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
}

.elx-ral-viewer-side-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .6;
}

.elx-ral-viewer-tex-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.elx-ral-viewer-tex-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(17, 17, 17, .18);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.elx-ral-viewer-tex-btn:hover {
  border-color: #FF4500;
}

.elx-ral-viewer-tex-btn.is-active {
  border-color: #FF4500;
  box-shadow: 0 0 0 2px rgba(255, 69, 0, .25);
}

.elx-ral-viewer-tex-mini {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid rgba(17, 17, 17, .2);
  background-color: #ccc;
  background-size: cover;
  background-position: center;
  background-blend-mode: multiply;
}

.elx-ral-viewer-tex-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.elx-ral-viewer-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  opacity: .6;
}

.elx-ral-viewer-action {
  margin-top: auto;
  padding: 13px 18px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.elx-ral-viewer-action:hover {
  background: #FF4500;
  border-color: #FF4500;
}

/* === Адаптив: мобильный полноэкранный лист === */
@media (max-width: 720px) {
  .elx-ral-viewer-sheet {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .elx-ral-viewer-body {
    flex-direction: column;
    overflow-y: auto;
  }

  .elx-ral-viewer-stage {
    border-right: 0;
    border-bottom: 1px solid rgba(17, 17, 17, .12);
    padding: 20px 16px;
  }

  .elx-ral-viewer-side {
    flex: 1 1 auto;
    padding: 16px;
  }

  .elx-ral-viewer-tex-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .elx-ral-viewer-x,
  .elx-ral-viewer-action,
  .elx-ral-cell-eye {
    transition: none;
  }
}
