/* ================================================================
   MyDataTools.ca — Tool UI Stylesheet
   Styles for upload zones, progress, results, tables
   ================================================================ */

/* ════════════════════════════════════════
   TOOL LAYOUT
   ════════════════════════════════════════ */
.tool-body { padding: 2.5rem 0 4rem; }
.tool-layout { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .tool-layout-aside { grid-template-columns: 1fr 280px; } }

/* ════════════════════════════════════════
   PRIVACY NOTICE (inline tool banner)
   ════════════════════════════════════════ */
.privacy-notice {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--green-50); border: 1px solid var(--green-100);
  border-radius: 0.625rem; padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
}
.privacy-notice-icon { color: var(--green-600); flex-shrink: 0; margin-top: 0.0625rem; }
.privacy-notice-icon svg { width: 1rem; height: 1rem; }
.privacy-notice-text { font-size: 0.8125rem; color: var(--green-700); line-height: 1.6; }
.privacy-notice-text strong { font-weight: 700; }

/* ════════════════════════════════════════
   UPLOAD ZONE
   ════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--slate-300); border-radius: 0.875rem;
  padding: 3rem 2rem; text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer; position: relative;
  background: var(--slate-50);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--brand-400); background: var(--brand-50);
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-zone-icon {
  width: 3.5rem; height: 3.5rem; background: var(--brand-100);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; color: var(--brand-600);
}
.upload-zone-icon svg { width: 1.75rem; height: 1.75rem; }
.upload-zone-title { font-size: 1rem; font-weight: 700; color: var(--slate-800); margin-bottom: 0.375rem; }
.upload-zone-sub { font-size: 0.875rem; color: var(--slate-500); line-height: 1.6; }
.upload-zone-formats {
  margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.375rem; justify-content: center;
}
.upload-zone-format {
  font-size: 0.6875rem; font-weight: 700; color: var(--slate-600);
  background: #fff; border: 1px solid var(--slate-200);
  padding: 0.125rem 0.5rem; border-radius: 0.25rem;
}

/* File selected state */
.file-selected {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--brand-50); border: 1px solid var(--brand-200);
  border-radius: 0.625rem; padding: 0.875rem 1rem;
  margin-top: 1rem;
}
.file-selected-icon { color: var(--brand-600); flex-shrink: 0; }
.file-selected-icon svg { width: 1.25rem; height: 1.25rem; }
.file-selected-name { font-size: 0.875rem; font-weight: 600; color: var(--slate-800); }
.file-selected-size { font-size: 0.75rem; color: var(--slate-500); }
.file-selected-remove {
  margin-left: auto; padding: 0.25rem; color: var(--slate-400);
  border-radius: 0.25rem; transition: color 0.15s, background 0.15s; cursor: pointer;
}
.file-selected-remove:hover { color: var(--red-600); background: var(--red-50); }
.file-selected-remove svg { width: 1rem; height: 1rem; }

/* Two-file upload (change monitor) */
.dual-upload { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .dual-upload { grid-template-columns: 1fr 1fr; } }
.upload-label { font-size: 0.875rem; font-weight: 600; color: var(--slate-700); margin-bottom: 0.5rem; }

/* ════════════════════════════════════════
   ANALYZE BUTTON & PROGRESS
   ════════════════════════════════════════ */
.analyze-btn-row { margin-top: 1.5rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.btn-analyze {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--brand-600); color: #fff;
  font-weight: 600; font-size: 0.9375rem;
  padding: 0.6875rem 1.75rem; border-radius: 0.5rem;
  transition: background 0.15s; cursor: pointer; border: none;
}
.btn-analyze:hover { background: var(--brand-700); }
.btn-analyze:disabled { background: var(--slate-300); cursor: not-allowed; }
.btn-analyze svg { width: 1.125rem; height: 1.125rem; }

.btn-clear {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: #fff; color: var(--slate-600);
  font-weight: 600; font-size: 0.875rem;
  padding: 0.6875rem 1.25rem; border-radius: 0.5rem;
  border: 1px solid var(--slate-300); transition: border-color 0.15s; cursor: pointer;
}
.btn-clear:hover { border-color: var(--slate-400); }

/* Progress bar */
.progress-wrap { display: none; margin-top: 1.5rem; }
.progress-wrap.visible { display: block; }
.progress-label { font-size: 0.8125rem; color: var(--slate-600); margin-bottom: 0.5rem; }
.progress-bar-track {
  height: 0.375rem; background: var(--slate-200); border-radius: 9999px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--brand-500); border-radius: 9999px;
  transition: width 0.3s ease; width: 0%;
}

/* ════════════════════════════════════════
   RESULTS PANEL
   ════════════════════════════════════════ */
.results-panel { display: none; margin-top: 2rem; }
.results-panel.visible { display: block; }

.results-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--slate-200);
}
.results-title { font-size: 1.25rem; font-weight: 700; color: var(--slate-900); }
.results-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-download {
  display: inline-flex; align-items: center; gap: 0.375rem;
  background: var(--green-600); color: #fff;
  font-weight: 600; font-size: 0.8125rem;
  padding: 0.5rem 1rem; border-radius: 0.5rem;
  transition: background 0.15s; cursor: pointer; border: none;
}
.btn-download:hover { background: var(--green-700); }
.btn-download svg { width: 0.875rem; height: 0.875rem; }

/* Score / summary stat tiles */
.score-tiles { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1.5rem; }
@media (min-width: 640px)  { .score-tiles { grid-template-columns: repeat(4, 1fr); } }
.score-tile {
  background: #fff; border: 1px solid var(--slate-200);
  border-radius: 0.75rem; padding: 1.125rem 1.25rem; text-align: center;
}
.score-tile-value { font-size: 1.875rem; font-weight: 800; line-height: 1; margin-bottom: 0.375rem; }
.score-tile-label { font-size: 0.75rem; font-weight: 600; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.06em; }
.score-good   { color: var(--green-600); }
.score-warn   { color: var(--amber-600); }
.score-bad    { color: var(--red-600); }
.score-neutral{ color: var(--brand-600); }
.score-slate  { color: var(--slate-700); }

/* Quality score ring */
.quality-score-wrap { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.quality-score-ring {
  width: 5rem; height: 5rem; border-radius: 50%; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; line-height: 1;
  border: 4px solid var(--slate-200);
}
.quality-score-ring.ring-good   { border-color: var(--green-500); color: var(--green-700); }
.quality-score-ring.ring-warn   { border-color: var(--amber-500); color: var(--amber-600); }
.quality-score-ring.ring-bad    { border-color: var(--red-500); color: var(--red-700); }
.quality-score-ring .ring-unit { font-size: 0.875rem; font-weight: 600; color: var(--slate-400); }
.quality-score-desc h3 { font-size: 1.0625rem; font-weight: 700; color: var(--slate-900); margin-bottom: 0.25rem; }
.quality-score-desc p { font-size: 0.875rem; color: var(--slate-600); line-height: 1.6; }

/* Results sections */
.result-section { margin-bottom: 2rem; }
.result-section-title {
  font-size: 1rem; font-weight: 700; color: var(--slate-800);
  padding-bottom: 0.625rem; border-bottom: 2px solid var(--brand-100);
  margin-bottom: 1.125rem; display: flex; align-items: center; gap: 0.5rem;
}
.result-section-title svg { width: 1rem; height: 1rem; color: var(--brand-600); }

/* Results table */
.results-table-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: 0.625rem; }
.results-table {
  width: 100%; border-collapse: collapse; font-size: 0.8125rem;
}
.results-table th {
  background: var(--slate-50); padding: 0.625rem 0.875rem;
  font-weight: 700; font-size: 0.75rem; color: var(--slate-700);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--slate-200); text-align: left; white-space: nowrap;
}
.results-table td {
  padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700); line-height: 1.5; vertical-align: top;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: var(--slate-50); }

/* Column analysis bar */
.col-bar-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 80px; }
.col-bar-track { flex: 1; height: 0.375rem; background: var(--slate-200); border-radius: 9999px; overflow: hidden; }
.col-bar-fill { height: 100%; border-radius: 9999px; }
.col-bar-fill-green { background: var(--green-500); }
.col-bar-fill-amber { background: var(--amber-500); }
.col-bar-fill-red   { background: var(--red-500); }
.col-bar-fill-brand { background: var(--brand-500); }
.col-bar-pct { font-size: 0.75rem; font-weight: 600; color: var(--slate-600); white-space: nowrap; }

/* Validation check items */
.check-list { display: flex; flex-direction: column; gap: 0.625rem; }
.check-item-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem 1rem; border-radius: 0.5rem;
  border: 1px solid var(--slate-200); background: #fff;
}
.check-item-icon { flex-shrink: 0; margin-top: 0.125rem; }
.check-item-icon svg { width: 1.125rem; height: 1.125rem; }
.check-item-icon.pass  svg { color: var(--green-600); }
.check-item-icon.fail  svg { color: var(--red-600); }
.check-item-icon.warn  svg { color: var(--amber-600); }
.check-item-icon.info  svg { color: var(--brand-600); }
.check-item-content { flex: 1; }
.check-item-title { font-size: 0.875rem; font-weight: 700; color: var(--slate-900); margin-bottom: 0.125rem; }
.check-item-desc  { font-size: 0.8125rem; color: var(--slate-600); line-height: 1.55; }
.check-item-row.pass-row { border-color: var(--green-100); background: var(--green-50); }
.check-item-row.fail-row { border-color: var(--red-100); background: var(--red-50); }
.check-item-row.warn-row { border-color: var(--amber-100); background: var(--amber-50); }

/* PII findings */
.pii-finding {
  background: #fff; border: 1px solid var(--slate-200);
  border-radius: 0.625rem; padding: 1rem 1.25rem; margin-bottom: 0.75rem;
}
.pii-finding-header { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.625rem; }
.pii-type-icon { width: 1.75rem; height: 1.75rem; border-radius: 0.375rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pii-type-icon svg { width: 1rem; height: 1rem; }
.pii-type-email  { background: var(--brand-50); color: var(--brand-700); }
.pii-type-phone  { background: var(--indigo-50); color: var(--indigo-700); }
.pii-type-postal { background: var(--green-50); color: var(--green-700); }
.pii-type-sin    { background: var(--red-50); color: var(--red-700); }
.pii-type-other  { background: var(--amber-50); color: var(--amber-600); }
.pii-finding-type { font-size: 0.875rem; font-weight: 700; color: var(--slate-900); }
.pii-finding-count { margin-left: auto; font-size: 0.75rem; font-weight: 700; color: var(--red-600); background: var(--red-50); padding: 0.125rem 0.5rem; border-radius: 9999px; }
.pii-examples { font-size: 0.8125rem; color: var(--slate-600); line-height: 1.7; }
.pii-examples span { background: var(--slate-100); padding: 0.0625rem 0.25rem; border-radius: 0.25rem; font-family: monospace; font-size: 0.8125rem; }

/* No findings / no PII */
.no-pii-banner {
  display: flex; align-items: center; gap: 0.875rem;
  background: var(--green-50); border: 1px solid var(--green-100);
  border-radius: 0.75rem; padding: 1.5rem;
}
.no-pii-icon { color: var(--green-600); flex-shrink: 0; }
.no-pii-icon svg { width: 2rem; height: 2rem; }
.no-pii-title { font-size: 1rem; font-weight: 700; color: var(--green-800); margin-bottom: 0.25rem; }
.no-pii-desc { font-size: 0.875rem; color: var(--green-700); line-height: 1.55; }

/* Data dictionary */
.dict-table { font-size: 0.8125rem; }
.dict-table .type-badge {
  display: inline-block; font-size: 0.6875rem; font-weight: 700;
  padding: 0.125rem 0.4375rem; border-radius: 0.25rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.type-text    { background: var(--slate-100); color: var(--slate-700); }
.type-number  { background: var(--brand-100); color: var(--brand-800); }
.type-date    { background: var(--indigo-100); color: var(--indigo-700); }
.type-boolean { background: var(--green-100); color: var(--green-700); }
.type-empty   { background: var(--red-100); color: var(--red-700); }

/* Postal code result */
.postal-result {
  background: #fff; border: 1px solid var(--brand-200);
  border-radius: 0.875rem; padding: 1.5rem; margin-top: 1rem;
}
.postal-result-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.postal-result-header svg { width: 1.5rem; height: 1.5rem; color: var(--brand-600); flex-shrink: 0; }
.postal-result-code { font-size: 1.5rem; font-weight: 800; color: var(--slate-900); letter-spacing: 0.05em; }
.postal-result-grid { display: grid; gap: 0.875rem; grid-template-columns: 1fr; }
@media (min-width: 480px) { .postal-result-grid { grid-template-columns: 1fr 1fr; } }
.postal-result-item { }
.postal-result-label { font-size: 0.6875rem; font-weight: 700; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.125rem; }
.postal-result-value { font-size: 0.9375rem; font-weight: 600; color: var(--slate-800); }

/* Geocoder result */
.geocoder-result {
  background: #fff; border: 1px solid var(--brand-200);
  border-radius: 0.875rem; padding: 1.5rem; margin-top: 1rem;
}
.geocoder-coords { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; margin-bottom: 1.25rem; }
.coord-item { text-align: center; }
.coord-label { font-size: 0.75rem; font-weight: 700; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.25rem; }
.coord-value { font-size: 1.25rem; font-weight: 800; color: var(--brand-700); font-family: monospace; }
.geocoder-address { font-size: 0.875rem; color: var(--slate-600); line-height: 1.65; padding-top: 1rem; border-top: 1px solid var(--slate-100); }
.geocoder-address strong { font-weight: 700; color: var(--slate-800); display: block; margin-bottom: 0.25rem; }

/* Change monitor diff */
.diff-tabs { display: flex; gap: 0.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--slate-200); padding-bottom: 0; }
.diff-tab {
  padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600; color: var(--slate-500);
  border-radius: 0.375rem 0.375rem 0 0; cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s;
}
.diff-tab:hover { color: var(--slate-800); }
.diff-tab.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.diff-tab-added  .diff-count { background: var(--green-100); color: var(--green-700); }
.diff-tab-removed .diff-count { background: var(--red-100); color: var(--red-700); }
.diff-tab-modified .diff-count { background: var(--amber-100); color: var(--amber-600); }
.diff-count { font-size: 0.6875rem; font-weight: 700; padding: 0.0625rem 0.375rem; border-radius: 9999px; margin-left: 0.375rem; }
.diff-panel { display: none; }
.diff-panel.active { display: block; }
.diff-row-added   td { background: var(--green-50) !important; }
.diff-row-removed td { background: var(--red-50) !important; }
.diff-row-modified td { background: var(--amber-50) !important; }

/* Input panel (postal, geocoder) */
.input-panel {
  background: #fff; border: 1px solid var(--slate-200);
  border-radius: 0.875rem; padding: 1.75rem; margin-bottom: 1.5rem;
}
.input-panel-title { font-size: 1.0625rem; font-weight: 700; color: var(--slate-900); margin-bottom: 1.25rem; }
.input-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.input-field-wrap { flex: 1; min-width: 200px; }
.input-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--slate-700); margin-bottom: 0.375rem; }
.tool-input {
  width: 100%; padding: 0.6875rem 1rem;
  border: 1px solid var(--slate-300); border-radius: 0.5rem;
  font-size: 1rem; color: var(--slate-900); background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-input:focus {
  outline: none; border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.tool-input-lg { font-size: 1.125rem; letter-spacing: 0.05em; }

/* Aside / sidebar info panel */
.tool-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card {
  background: #fff; border: 1px solid var(--slate-200);
  border-radius: 0.75rem; padding: 1.25rem;
}
.sidebar-card-title { font-size: 0.875rem; font-weight: 700; color: var(--slate-800); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.sidebar-card-title svg { width: 1rem; height: 1rem; color: var(--brand-600); }
.sidebar-card ul { display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-card li { font-size: 0.8125rem; color: var(--slate-600); line-height: 1.5; display: flex; align-items: flex-start; gap: 0.5rem; }
.sidebar-card li::before { content: "·"; color: var(--brand-400); font-weight: 700; flex-shrink: 0; }

/* Error state */
.tool-error {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--red-50); border: 1px solid var(--red-100);
  border-radius: 0.625rem; padding: 1rem 1.25rem; margin-top: 1rem;
}
.tool-error-icon { color: var(--red-600); flex-shrink: 0; }
.tool-error-icon svg { width: 1.125rem; height: 1.125rem; }
.tool-error-text { font-size: 0.875rem; color: var(--red-700); line-height: 1.6; }

/* Loading spinner */
.spinner {
  display: inline-block; width: 1.125rem; height: 1.125rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
