/* Image Compare — standalone tool UI */

:root {
  --accent: #0d9488;
  --accent-deep: #0f766e;
  --accent-glow: rgba(13, 148, 136, 0.12);
  --surface: #fafaf9;
  --surface-raised: #ffffff;
  --ink: #1c1917;
  --ink-muted: #57534e;
  --ink-faint: #a8a29e;
  --border: rgba(28, 25, 23, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --diff-position: #ef4444;
  --diff-color: #f97316;
  --diff-size: #a855f7;
}

html {
  scroll-behavior: smooth;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 100;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 1rem;
}

.file-protocol-warn {
  border-bottom: 1px solid #fed7aa;
  background: #fff7ed;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #9a3412;
}
.file-protocol-warn code {
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
}

/* File upload dropzone */
.dropzone {
  position: relative;
  display: flex;
  min-height: 168px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 1rem;
  border: 1.5px dashed var(--border);
  background: var(--surface-raised);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.dropzone.has-image {
  border-style: solid;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}
.dropzone.has-image .dropzone-placeholder {
  display: none;
}
.dropzone-preview {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 168px;
}
.dropzone.has-image .dropzone-preview {
  display: block;
}
.dropzone-preview img {
  width: 100%;
  height: 100%;
  min-height: 168px;
  max-height: 220px;
  object-fit: contain;
  background: #f5f5f4;
}
.dropzone-clear {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: background 0.15s, color 0.15s;
}
.dropzone-clear:hover {
  background: #fff;
  color: var(--ink);
}

.upload-slot-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-slot-filename {
  font-weight: 500;
  color: var(--ink-muted);
}

/* Segmented control */
.segmented {
  display: inline-flex;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  padding: 3px;
}
.segmented button {
  min-height: 36px;
  border-radius: 9999px;
  padding: 0 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.segmented button[aria-selected='true'] {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.15);
}
.segmented button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.segmented button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Primary button */
.btn-compare {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  border-radius: 9999px;
  background: var(--accent);
  padding: 0 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.28);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
}
.btn-compare:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(13, 148, 136, 0.34);
}
.btn-compare:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-compare:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}
.btn-compare[aria-busy='true'] .btn-label {
  opacity: 0;
}
.btn-compare[aria-busy='true'] .btn-spinner {
  display: block;
}

.btn-spinner {
  display: none;
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Legend badges */
.legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
}
.legend-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
}
.legend-dot--position { background: var(--diff-position); }
.legend-dot--color { background: var(--diff-color); }
.legend-dot--size { background: var(--diff-size); }
.legend-dot--content { background: #ec4899; }
.legend-dot--color-cast { background: #dc2626; }

/* Visual stage */
.visual-stage {
  position: relative;
  min-height: min(62vh, 640px);
  border-radius: 1.25rem;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #f5f5f4 0%, #fafaf9 50%, #ffffff 100%);
  overflow: hidden;
}
.visual-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
.visual-empty,
.visual-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: min(62vh, 640px);
  padding: 2rem;
  text-align: center;
}
.visual-empty-icon {
  display: flex;
  height: 3.5rem;
  width: 3.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: var(--accent-glow);
  color: var(--accent);
}
.visual-message--warn .visual-empty-icon {
  background: rgba(249, 115, 22, 0.12);
  color: #ea580c;
}
.visual-message--ok .visual-empty-icon {
  background: rgba(13, 148, 136, 0.12);
  color: var(--accent);
}

/* Skeleton loading */
.skeleton-shimmer {
  background: linear-gradient(90deg, #e7e5e4 25%, #f5f5f4 50%, #e7e5e4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 0.75rem;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast */
.toast-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(28, 25, 23, 0.1);
  animation: toast-in 0.25s var(--ease);
}
.toast--error {
  border-color: rgba(239, 68, 68, 0.25);
  background: #fef2f2;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Side-by-side panels */
.side-panel-label {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  border-radius: 9999px;
  background: rgba(28, 25, 23, 0.72);
  backdrop-filter: blur(6px);
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

/* Stats row */
.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  background: var(--accent-glow);
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-deep);
}

.stats-pill--photo {
  background: #ecfdf5;
  color: #047857;
}

.stats-pill--color-cast {
  background: #fef2f2;
  color: #b91c1c;
}

/* Property panel — bottom, left A / right B */
.property-panel {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.property-panel__title {
  margin-bottom: 0.875rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.property-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .property-columns {
    gap: 1rem;
  }
}

.property-col {
  border-radius: 0.875rem;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  padding: 1rem 1.125rem;
}

.property-col__heading {
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.property-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin: 0;
}

.property-item {
  margin: 0;
}

.property-item dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.125rem;
}

.property-item dd {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  word-break: break-all;
}

.property-item dd.prop-value--diff {
  color: #c2410c;
  font-weight: 600;
}

.property-item dd.prop-value--same {
  color: var(--ink-muted);
}

.property-item dd.prop-value--pending {
  color: var(--ink-faint);
  font-style: italic;
}

.property-item__note {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-faint);
}

@media (max-width: 640px) {
  .dropzone {
    min-height: 140px;
  }
  .visual-stage {
    min-height: 48vh;
  }
}
