/* =========================================================
   Модуль — Цветовая палитра по изображению
   Стиль по modul_design.md
   ========================================================= */

.main--image-palette {
  max-width: 1320px;
}

.img-palette-app {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

.imgpal-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.imgpal-card-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.imgpal-card-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
}

/* Dropzone */
.imgpal-dropzone {
  border: 1.5px dashed rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  padding: 44px 24px;
  text-align: center;
  background: var(--tile);
  cursor: pointer;
  transition: all var(--base) var(--ease);
}

.imgpal-dropzone:hover,
.imgpal-dropzone.is-drag {
  border-color: var(--ink);
  background: rgba(0, 0, 0, 0.02);
}

.imgpal-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.imgpal-drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.imgpal-drop-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.imgpal-drop-main {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.imgpal-drop-hint {
  font-size: 12px;
  color: var(--muted);
}

.imgpal-drop-hint kbd {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 2px 5px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--ink);
}

/* Active Stage */
.imgpal-stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.imgpal-stage[hidden],
.imgpal-dropzone[hidden],
.pbpal-toast[hidden] {
  display: none !important;
}

.imgpal-stage-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}

.imgpal-img-wrap {
  position: relative;
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--tile);
}

.imgpal-preview-img {
  max-width: 220px;
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: cover;
  display: block;
}

.imgpal-preview-img:not([src]),
.imgpal-preview-img[src=""] {
  display: none;
}

.imgpal-reset-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background var(--fast) var(--ease);
}

.imgpal-reset-btn:hover {
  background: var(--ink);
}

.imgpal-stage-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.imgpal-meta-text {
  font-size: 12px;
}

/* Colors Row */
.imgpal-colors-wrapper {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
}

.imgpal-colors {
  display: flex;
  width: 100%;
}

.imgpal-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
}

.imgpal-col:last-child {
  border-right: none;
}

.imgpal-swatch {
  display: block;
  width: 100%;
  height: 160px;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.imgpal-swatch:hover {
  opacity: 0.9;
}

.imgpal-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--paper);
  border-top: 1px solid var(--hairline);
}

.imgpal-code {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.imgpal-code:hover {
  text-decoration: underline;
}

.imgpal-copy-btn {
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 2px 6px;
  border-radius: 4px;
}

.imgpal-copy-btn:hover {
  color: var(--ink);
  background: var(--tile);
}

/* Media Guides Section (Video + Image Sample in 9:16 vertical format) */
.imgpal-guides-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.imgpal-media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
}

.imgpal-media-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.imgpal-media-box {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--tile);
  position: relative;
  width: 100%;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.imgpal-media-box--video {
  background: #000;
}

.imgpal-media-box--source {
  cursor: pointer;
  background: var(--tile);
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease);
}

.imgpal-media-box--source:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
}

.imgpal-media-box--result {
  background: var(--tile);
}

.imgpal-video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.imgpal-video-player:fullscreen {
  object-fit: contain;
  background: #000;
  width: 100vw;
  height: 100vh;
}

.imgpal-video-player:-webkit-full-screen {
  object-fit: contain;
  background: #000;
  width: 100vw;
  height: 100vh;
}

.imgpal-sample-img,
.imgpal-result-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: var(--tile);
}

.imgpal-sample-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(11, 11, 11, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
}

.imgpal-media-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.imgpal-media-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.imgpal-media-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
}

/* Toast */
.pbpal-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  animation: pbpal-toast-in 0.2s var(--ease);
}

.pbpal-toast[hidden] {
  display: none;
}

@keyframes pbpal-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 960px) {
  .imgpal-media-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }
  .imgpal-media-box {
    height: 480px;
  }
  .imgpal-stage-preview {
    flex-direction: column;
    align-items: flex-start;
  }
  .imgpal-stage-meta {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .imgpal-colors {
    flex-direction: column;
  }
  .imgpal-swatch {
    height: 60px;
  }
  .imgpal-col {
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .imgpal-col:last-child {
    border-bottom: none;
  }
}
