/* ============================================================
   HEX to Pantone Converter — Scoped with htpc- prefix
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }


.htpc-root {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  box-sizing: border-box;
  width: 100%;
}

.htpc-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 16px rgba(0,0,0,0.08),
    0 12px 40px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 760px;
  overflow: hidden;
}

/* Header */
.htpc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 32px 18px;
  border-bottom: 1px solid #f0f1f3;
}

.htpc-header-icon {
  color: #374151;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.htpc-title {
  font-size: 17px;
  font-weight: 700;
  color: #111111;
  margin: 0;
  letter-spacing: -0.3px;
}

/* Body */
.htpc-body {
  padding: 24px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Top row: input + color values */
.htpc-top-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

/* Input Section */
.htpc-input-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}

.htpc-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.htpc-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.htpc-swatch-picker {
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.htpc-color-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  overflow: hidden;
}

.htpc-swatch-preview {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  position: relative;
}

.htpc-swatch-preview--checker::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
  z-index: 0;
}

.htpc-swatch-picker:hover .htpc-swatch-preview {
  transform: scale(1.06);
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
}

.htpc-text-input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  letter-spacing: 0.5px;
  color: #111111;
  background: #f8f9fa;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
}

.htpc-text-input::placeholder {
  color: #c0c4cc;
  font-weight: 400;
}

.htpc-text-input:focus {
  border-color: #374151;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(55,65,81,0.08);
}

.htpc-text-input--error {
  border-color: #ef4444;
  background: #fef2f2;
}

.htpc-text-input--error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.htpc-icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  color: #374151;
  transition: background 0.15s, color 0.15s, transform 0.12s;
  flex-shrink: 0;
}

.htpc-icon-btn:hover:not(:disabled) {
  background: #e5e7eb;
  color: #111111;
  transform: scale(1.05);
}

.htpc-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.htpc-error-text {
  font-size: 12px;
  color: #ef4444;
  margin: 0;
  display: none;
}

/* Color value pills */
.htpc-color-values {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 24px;
  flex-shrink: 0;
}

.htpc-value-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border: 1.5px solid #f0f1f3;
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 210px;
}

.htpc-value-label {
  font-size: 10px;
  font-weight: 800;
  color: #9ca3af;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
  width: 28px;
}

.htpc-value-text {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  font-family: 'SF Mono', 'Fira Code', monospace;
  flex: 1;
  white-space: nowrap;
}

.htpc-value-copy {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: #9ca3af;
  transition: background 0.13s, color 0.13s;
  flex-shrink: 0;
  padding: 0;
}

.htpc-value-copy:hover {
  background: #e5e7eb;
  color: #374151;
}

/* Divider */
.htpc-divider {
  height: 1px;
  background: #f0f1f3;
  margin: 20px 0;
}

/* Result row */
.htpc-result-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

.htpc-swatches {
  display: flex;
  align-items: center;
  gap: 10px;
}

.htpc-swatch-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.htpc-swatch-large {
  width: 100px;
  height: 68px;
  border-radius: 14px;
  border: 1.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 6px 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.htpc-swatch-large--checker::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
  z-index: 0;
  border-radius: 12px;
}

.htpc-swatch-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.htpc-swatch-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  opacity: 0.8;
  position: relative;
  z-index: 1;
}

.htpc-swatch-hex {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.3px;
}

.htpc-arrow-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 22px;
}

.htpc-arrow {
  color: #d1d5db;
  width: 18px;
  height: 18px;
}

/* Match info */
.htpc-match-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.htpc-match-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.htpc-match-name {
  font-size: 18px;
  font-weight: 700;
  color: #111111;
  letter-spacing: -0.3px;
}

.htpc-copy-btn-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  transition: background 0.15s, color 0.15s, transform 0.12s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.htpc-copy-btn-pill:hover {
  background: #e5e7eb;
  color: #111111;
  transform: scale(1.03);
}

.htpc-copy-btn-pill--copied {
  background: #f0fdf4;
  border-color: #86efac;
  color: #16a34a;
}

/* Accuracy */
.htpc-accuracy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.htpc-accuracy-label-text {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.htpc-accuracy-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.htpc-accuracy-badge--excellent {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.htpc-accuracy-badge--very-good {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.htpc-accuracy-badge--good {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.htpc-accuracy-badge--fair {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.htpc-accuracy-badge--approximate {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Gradient bar */
.htpc-bar-track {
  height: 7px;
  background: #f0f1f3;
  border-radius: 999px;
  overflow: hidden;
}

.htpc-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: linear-gradient(
    90deg,
    hsl(0, 72%, 51%) 0%,
    hsl(25, 90%, 52%) 20%,
    hsl(48, 92%, 48%) 42%,
    hsl(88, 58%, 42%) 65%,
    hsl(142, 60%, 36%) 100%
  );
  background-size: 600px 100%;
  background-position: 0 0;
  width: 0%;
}

.htpc-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Close matches */
.htpc-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin: 0 0 10px;
}

.htpc-matches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.htpc-match-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: #fafafa;
  border: 1.5px solid #f0f1f3;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  cursor: default;
}

.htpc-match-card:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
  transform: translateY(-1px);
}

.htpc-match-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

.htpc-match-swatch--checker::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
  border-radius: 6px;
}

.htpc-match-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.htpc-match-card-name {
  font-size: 12px;
  font-weight: 600;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htpc-match-card-sub {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.2px;
}

.htpc-match-copy-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  color: #9ca3af;
  transition: background 0.13s, color 0.13s;
  flex-shrink: 0;
  padding: 0;
}

.htpc-match-copy-btn:hover {
  background: #e9ecef;
  color: #374151;
}

/* Empty state */
.htpc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 16px 8px;
  text-align: center;
}

.htpc-empty-icon {
  width: 60px;
  height: 60px;
  background: #f8f9fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
}

.htpc-empty-text {
  font-size: 14px;
  color: #9ca3af;
  line-height: 1.5;
  margin: 0;
  max-width: 280px;
}

/* Hidden utility */
.htpc-hidden {
  display: none !important;
}

/* SVG icons inline */
svg { display: inline-block; vertical-align: middle; }

/* Responsive */
@media (max-width: 580px) {
  .htpc-card {
    border-radius: 16px;
  }

  .htpc-header {
    padding: 18px 20px 14px;
  }

  .htpc-body {
    padding: 18px 20px 24px;
  }

  .htpc-result-row {
    grid-template-columns: 1fr;
  }

  .htpc-matches-grid {
    grid-template-columns: 1fr;
  }

  .htpc-color-values {
    padding-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .htpc-value-pill {
    min-width: 0;
    flex: 1;
  }

  .htpc-match-name {
    font-size: 15px;
  }
}
