/**
 * Convertidor HEIC — overlay sobre rum_operations_shell.css
 */
body.rum-heic-ops .page {
  padding-top: 8px;
}

.heic-lead {
  margin: 0 0 14px;
  max-width: 72ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.heic-privacy {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: var(--r-panel);
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.22);
  color: #166534;
  font-size: 13px;
  font-weight: 600;
}

.heic-workspace {
  padding: 16px clamp(12px, 1.6vw, 22px) 18px;
}

.heic-dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 148px;
  padding: 22px 16px;
  border: 1.5px dashed rgba(42, 109, 176, 0.32);
  border-radius: var(--r-panel);
  background: var(--card-mute);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.heic-dropzone:hover,
.heic-dropzone:focus-visible {
  border-color: var(--rum);
  outline: none;
}

.heic-dropzone.is-hot {
  border-color: var(--accent-text);
  background: #fff7f1;
}

.heic-dropzone strong {
  font-family: var(--rum-font);
  font-size: 1.15rem;
  color: var(--text);
}

.heic-dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.heic-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0 10px;
}

.heic-toolbar input[type="file"] {
  display: none;
}

.heic-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.heic-opts fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.heic-opts input[type="range"] {
  width: min(200px, 100%);
  accent-color: var(--rum);
}

.heic-status {
  min-height: 1.4em;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.heic-status.err {
  color: var(--danger);
}

.heic-progress {
  height: 8px;
  border-radius: 999px;
  background: #e8eef5;
  overflow: hidden;
  margin-bottom: 14px;
}

.heic-progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--rum);
  transition: width 0.25s ease;
}

.heic-progress.is-active > span {
  background: linear-gradient(90deg, #2a6db0 0%, #4fa3ff 40%, #eebf95 70%, #2a6db0 100%);
  background-size: 220% 100%;
  animation: heic-progress-slide 1.1s linear infinite;
}

.heic-toolbar label.rum-ops-btn {
  cursor: pointer;
}

body.rum-heic-ops .rum-ops-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.heic-busy[hidden] {
  display: none !important;
}

.heic-busy {
  display: none;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-panel);
  border: 1px solid rgba(42, 109, 176, 0.18);
  background: #eef4fb;
}

body.is-converting,
body.is-zipping {
  cursor: progress;
}

body.is-converting .heic-dropzone,
body.is-zipping .heic-dropzone {
  pointer-events: none;
  opacity: 0.72;
}

body.is-converting .rum-ops-stat-card:nth-child(2) .rum-ops-sc-val {
  color: var(--ok);
}

body.is-converting .heic-busy,
body.is-zipping .heic-busy {
  display: flex;
}

.heic-busy strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.heic-busy p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.heic-spinner {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2.5px solid rgba(42, 109, 176, 0.2);
  border-top-color: var(--rum);
  border-radius: 50%;
  animation: heic-spin 0.7s linear infinite;
}

.heic-spinner--sm {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

.rum-ops-btn.is-busy {
  gap: 8px;
}

.heic-file-list {
  display: grid;
  gap: 8px;
}

.heic-file-card {
  display: grid;
  grid-template-columns: 40px 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--card);
  position: relative;
  overflow: hidden;
}

.heic-file-card.is-selected {
  border-color: var(--rum);
  background: #f4f8fc;
}

.heic-check {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  cursor: pointer;
}

.heic-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--rum);
  cursor: pointer;
}

.heic-check input:focus-visible {
  outline: 2px solid var(--rum);
  outline-offset: 2px;
}

.heic-select-bar[hidden] {
  display: none !important;
}

.heic-select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--card-mute);
}

.heic-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.heic-select-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--rum);
  cursor: pointer;
}

.heic-select-all input:focus-visible {
  outline: 2px solid var(--rum);
  outline-offset: 2px;
}

.heic-file-card.is-converting {
  border-color: rgba(42, 109, 176, 0.45);
  box-shadow: 0 0 0 1px rgba(42, 109, 176, 0.12);
  animation: heic-pulse-border 1.2s ease-in-out infinite;
}

.heic-thumb-btn {
  appearance: none;
  border: 0;
  padding: 0;
  width: 64px;
  height: 64px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r-tight);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--card-mute);
  position: relative;
  display: block;
  touch-action: manipulation;
}

.heic-thumb-btn:focus-visible {
  outline: 2px solid var(--rum);
  outline-offset: 2px;
}

.heic-thumb-btn:hover .heic-thumb,
.heic-thumb-btn:focus-visible .heic-thumb {
  transform: scale(1.06);
}

.heic-thumb-btn::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='20' y1='20' x2='16.2' y2='16.2'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
  pointer-events: none;
}

.heic-file-card.is-previewing {
  border-color: var(--rum);
  box-shadow: 0 0 0 2px rgba(42, 109, 176, 0.22);
}

.heic-thumb,
.heic-thumb-ph {
  width: 64px;
  height: 64px;
  border-radius: var(--r-tight);
  object-fit: cover;
  display: block;
  background: var(--card-mute);
  transition: transform 0.18s ease;
}

.heic-thumb-btn .heic-thumb {
  width: 100%;
  height: 100%;
}

.heic-thumb-ph {
  position: relative;
  overflow: hidden;
}

.heic-file-card.is-queued .heic-thumb-ph::after,
.heic-file-card.is-converting .heic-thumb-ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: heic-shimmer 1.15s ease-in-out infinite;
}

.heic-file-card.is-converting .heic-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--rum-2);
  animation: heic-scan 1.1s ease-in-out infinite;
  pointer-events: none;
}

.heic-file-name {
  font-weight: 700;
  font-size: 13px;
  word-break: break-word;
}

.heic-file-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.heic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--r-tight);
  font-size: 11px;
  font-weight: 700;
  background: #eef4fb;
  color: var(--rum);
}

.heic-badge.done {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}

.heic-badge.converting {
  background: rgba(42, 109, 176, 0.12);
  color: var(--rum);
}

.heic-badge.error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.heic-empty {
  padding: 22px 12px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--r-panel);
  margin: 0;
}

.heic-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: var(--r-panel);
  background: var(--card-mute);
  border: 1px solid var(--border);
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.heic-lightbox[hidden] {
  display: none !important;
}

.heic-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12040;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.heic-lightbox-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
}

.heic-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 1680px);
  height: 100%;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.heic-lightbox-close,
.heic-lightbox-nav {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: background 0.18s ease, transform 0.18s ease;
  touch-action: manipulation;
}

.heic-lightbox-close:hover,
.heic-lightbox-nav:hover {
  background: rgba(42, 109, 176, 0.9);
}

.heic-lightbox-close:focus-visible,
.heic-lightbox-nav:focus-visible,
.heic-strip-thumb:focus-visible {
  outline: 2px solid #eebf95;
  outline-offset: 2px;
}

.heic-lightbox-close:active,
.heic-lightbox-nav:active,
.heic-thumb-btn:active {
  transform: scale(0.96);
}

.heic-lightbox-close .rum-ico,
.heic-lightbox-nav .rum-ico {
  width: 20px;
  height: 20px;
}

.heic-lightbox-close {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: start;
}

.heic-lightbox-prev {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}

.heic-lightbox-next {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
}

.heic-lightbox-nav[hidden] {
  visibility: hidden;
}

.heic-lightbox-figure {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.heic-lightbox-figure img {
  max-width: 100%;
  max-height: min(72dvh, calc(100dvh - 168px));
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  background: #0f172a;
}

.heic-lightbox-figure figcaption {
  margin: 0;
  max-width: min(72ch, 92vw);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
}

.heic-lightbox-strip {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px 8px;
  scrollbar-width: thin;
}

.heic-strip-thumb {
  appearance: none;
  border: 2px solid transparent;
  padding: 0;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  touch-action: manipulation;
}

.heic-strip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.heic-strip-thumb.is-current {
  border-color: #eebf95;
  box-shadow: 0 0 0 2px rgba(238, 191, 149, 0.35);
}

body.heic-lightbox-open {
  overflow: hidden;
}

@keyframes heic-pulse-border {
  50% { box-shadow: 0 0 0 4px rgba(42, 109, 176, 0.16); }
}

@keyframes heic-spin {
  to { transform: rotate(360deg); }
}

@keyframes heic-shimmer {
  100% { transform: translateX(100%); }
}

@keyframes heic-progress-slide {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes heic-scan {
  0% { top: 8px; opacity: 0.2; }
  50% { opacity: 1; }
  100% { top: calc(100% - 10px); opacity: 0.2; }
}

@media (max-width: 720px) {
  .heic-file-card {
    grid-template-columns: 40px 56px minmax(0, 1fr);
  }
  .heic-file-card .rum-ops-btn {
    grid-column: 1 / -1;
    width: 100%;
  }
  .heic-thumb-btn,
  .heic-thumb,
  .heic-thumb-ph {
    width: 56px;
    height: 56px;
  }
  .heic-lightbox-dialog {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .heic-lightbox-close {
    grid-column: 1;
    grid-row: 1;
  }
  .heic-lightbox-figure {
    grid-column: 1;
    grid-row: 2;
    padding: 0 48px;
  }
  .heic-lightbox-figure img {
    max-height: min(68dvh, calc(100dvh - 180px));
    max-width: 100%;
  }
  .heic-lightbox-prev,
  .heic-lightbox-next {
    position: absolute;
    grid-column: 1;
    grid-row: 2;
    top: 46%;
    transform: translateY(-50%);
  }
  .heic-lightbox-prev {
    left: max(8px, env(safe-area-inset-left));
  }
  .heic-lightbox-next {
    right: max(8px, env(safe-area-inset-right));
  }
  .heic-lightbox-prev:active,
  .heic-lightbox-next:active {
    transform: translateY(-50%) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .heic-spinner,
  .heic-progress.is-active > span,
  .heic-file-card.is-queued .heic-thumb-ph::after,
  .heic-file-card.is-converting .heic-thumb-ph::after,
  .heic-file-card.is-converting .heic-scan,
  .heic-file-card.is-converting,
  .heic-thumb,
  .heic-lightbox-close,
  .heic-lightbox-nav {
    animation: none;
    transition: none;
  }
}
