/* Export Check UI — styled to match Watchtower (Apple Design System) */

:root {
  /* Apple Brand Colors (full set - matches Watchtower) */
  --apple-blue: #007aff;
  --apple-blue-hover: #0051d5;
  --apple-blue-light: #5ac8fa;
  --apple-green: #34c759;
  --apple-indigo: #5856d6;
  --apple-orange: #ff9500;
  --apple-pink: #ff2d55;
  --apple-purple: #af52de;
  --apple-red: #ff3b30;
  --apple-teal: #5ac8fa;
  --apple-yellow: #ffcc00;

  /* Neutral Colors (Apple System Grays) */
  --gray-1: #8e8e93;
  --gray-2: #aeaeb2;
  --gray-3: #c7c7cc;
  --gray-4: #d1d1d6;
  --gray-5: #e5e5ea;
  --gray-6: #f2f2f7;

  /* Light Mode Colors */
  --background: #ffffff;
  --background-secondary: #f5f5f7;
  --background-tertiary: #e8e8ed;
  --card-background: #ffffff;
  --label-primary: #000000;
  --label-secondary: #3c3c43;
  --label-tertiary: #3c3c4399;
  --separator: #3c3c434d;
  --fill: #78788033;
  --focus-ring: rgba(0, 122, 255, 0.25);

  /* Typography */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue",
    sans-serif;
  --font-size-title-2: 24px;
  --font-size-title-3: 22px;
  --font-size-body: 18px;
  --font-size-callout: 17px;
  --font-size-footnote: 15px;
  --font-size-caption-1: 14px;

  /* Spacing (8pt grid - matches Watchtower) */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
  --spacing-6: 24px;

  /* Border Radius */
  --radius-small: 6px;
  --radius-medium: 10px;
  --radius-large: 14px;
  --radius-xlarge: 20px;

  /* Shadows (Apple-style - subtle multi-layer) */
  --shadow-small: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Apple Brand Colors - Dark Mode (more vibrant for dark backgrounds) */
    --apple-blue: #0a84ff;
    --apple-blue-hover: #409cff;
    --apple-blue-light: #64d2ff;
    --apple-green: #30d158;
    --apple-indigo: #5e5ce6;
    --apple-orange: #ff9f0a;
    --apple-pink: #ff375f;
    --apple-purple: #bf5af2;
    --apple-red: #ff453a;
    --apple-teal: #64d2ff;
    --apple-yellow: #ffd60a;

    --gray-1: #8e8e93;
    --gray-2: #636366;
    --gray-3: #48484a;
    --gray-4: #3a3a3c;
    --gray-5: #2c2c2e;
    --gray-6: #1c1c1e;

    --background: #000000;
    --background-secondary: #000000;
    --background-tertiary: #1c1c1e;
    --card-background: #1c1c1e;

    --label-primary: #ffffff;
    --label-secondary: #ebebf5;
    --label-tertiary: rgba(235, 235, 245, 0.6);
    --separator: rgba(84, 84, 88, 0.65);
    --fill: rgba(120, 120, 128, 0.36);
    --focus-ring: rgba(10, 132, 255, 0.25);

    --shadow-small: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

/* Unified tap behavior - removes iOS gray tap highlight (matches Watchtower) */
button,
select,
input,
.card,
.pill,
summary {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: 500;
  color: var(--label-primary);
  background: var(--background-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Prevent iOS auto-zoom on input focus - requires 16px minimum font-size */
@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--label-tertiary);
  font-size: 16px;
  font-weight: 500;
}

.card {
  margin-top: 16px;
  background: var(--card-background);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-small);
  padding: 20px;
}

.form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 16px;
  color: var(--label-secondary);
}

.field input,
.field select {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 14px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--separator);
  background: var(--card-background);
  color: var(--label-primary);
  font-weight: 600;
  font-size: var(--font-size-body);
}

.field input:disabled,
.field select:disabled {
  opacity: 0.7;
  background: var(--background-tertiary);
}

.eccn-split {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.eccn-split input {
  width: auto;
}

#eccn-base-input {
  flex: 1 1 auto;
  min-width: 0;
}

#eccn-suffix-input {
  flex: 0 0 180px;
}

@media (max-width: 560px) {
  .eccn-split {
    flex-direction: column;
  }
  #eccn-suffix-input {
    flex: 1 1 auto;
  }
}

.field input::placeholder {
  color: var(--label-tertiary);
  font-weight: 500;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.hint {
  margin-top: 8px;
  font-size: 15px;
  color: var(--label-tertiary);
  line-height: 1.35;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

@media (max-width: 560px) {
  .actions {
    justify-content: stretch;
  }
  .actions button {
    width: 100%;
  }
}

button {
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  background: var(--apple-blue);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:hover,
button:focus-visible {
  background: var(--apple-blue-hover);
  outline: none;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.lang-button {
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  color: var(--apple-blue);
  border: 1px solid var(--separator);
  border-radius: 999px;
}

.lang-button:hover,
.lang-button:focus-visible {
  background: var(--fill);
  outline: none;
}

.lang-button.active {
  background: rgba(0, 122, 255, 0.12);
  border-color: var(--apple-blue);
}

.error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 59, 48, 0.35);
  background: rgba(255, 59, 48, 0.08);
  color: var(--label-primary);
}

.result-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.pill {
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  border: 1px solid var(--separator);
  background: var(--fill);
  white-space: nowrap;
}

.pill.green {
  background: rgba(52, 199, 89, 0.14);
  border-color: rgba(52, 199, 89, 0.35);
}
.pill.amber {
  background: rgba(255, 149, 0, 0.14);
  border-color: rgba(255, 149, 0, 0.35);
}
.pill.red {
  background: rgba(255, 59, 48, 0.14);
  border-color: rgba(255, 59, 48, 0.35);
}

.result-title {
  font-weight: 800;
  margin-bottom: 4px;
  font-size: 19px;
}

.freshness {
  color: var(--label-tertiary);
  font-size: 15px;
}

.human-result {
  margin-top: 12px;
  padding: 14px 14px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--separator);
  background: var(--background-tertiary);
  font-size: 17px;
}

.human-result .lead {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 600;
}

.human-result h3 {
  margin: 12px 0 8px;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--label-secondary);
  font-weight: 700;
}

.human-result h3:first-child {
  margin-top: 0;
}

.human-result ul {
  margin: 0;
  padding-left: 18px;
}

.human-result li {
  margin: 6px 0;
  line-height: 1.4;
}

.eccn-items {
  margin-top: 12px;
}

.eccn-items-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 16px;
  color: var(--label-secondary);
}

.eccn-item-select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--separator);
  background: var(--card-background);
  color: var(--label-primary);
  font-weight: 600;
}

.eccn-item-select:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.json-details {
  margin-top: 12px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--separator);
  background: transparent;
  padding: 10px 12px;
}

.json-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--label-secondary);
}

.json {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--separator);
  background: var(--background-tertiary);
  overflow: auto;
  max-height: 360px;
  font-size: 13px;
}

.footer {
  margin-top: 14px;
  color: var(--label-tertiary);
  font-size: var(--font-size-footnote);
}
