/*
  Force Measurement (Force Plate) import workflow -- Phase 1.

  Loaded alongside styles/v3-app-shell.css in v3.html (after it, so the
  --v3-* custom properties it defines are already in scope) -- this file
  never redefines them and never touches css/styles.css, the legacy Phase
  9.7 stylesheet. Scoped entirely under .v3-import-* / [data-force-
  measurement-import-*] selectors so it can never bleed into the rest of
  the shell or the Force Measurement dashboard's own .v3-fm-* styles.
*/

[data-force-measurement-import-root] {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--v3-space-6) var(--v3-space-4);
  overflow-y: auto;
  background: rgba(28, 32, 36, 0.55);
}

[data-force-measurement-import-root][hidden] {
  display: none;
}

.v3-import-modal {
  width: 100%;
  max-width: 860px;
  margin-top: var(--v3-space-6);
  background: var(--v3-surface);
  border-radius: var(--v3-radius-md);
  box-shadow: 0 24px 48px rgba(28, 32, 36, 0.28);
  display: flex;
  flex-direction: column;
  gap: var(--v3-space-4);
  padding: var(--v3-space-5);
}

.v3-import-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--v3-space-4);
}

.v3-import-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.v3-import-modal-subtitle {
  margin: var(--v3-space-1) 0 0;
  color: var(--v3-text-muted);
  font-size: 0.85rem;
}

.v3-import-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--v3-text-muted);
  min-height: 1.2em;
}

.v3-import-success {
  margin: 0;
  padding: var(--v3-space-2) var(--v3-space-3);
  border-radius: var(--v3-radius-sm);
  background: #e6f4ea;
  border: 1px solid #a8d5b5;
  color: #1e5631;
  font-weight: 600;
  font-size: 0.85rem;
}

.v3-import-field {
  display: flex;
  flex-direction: column;
  gap: var(--v3-space-2);
}

.v3-import-field label {
  font-weight: 600;
  font-size: 0.85rem;
}

.v3-import-field input[type="file"] {
  font: inherit;
  padding: var(--v3-space-2);
  border: 1px dashed var(--v3-border-strong);
  border-radius: var(--v3-radius-sm);
  background: var(--v3-surface-muted);
}

.v3-import-file-errors {
  padding: var(--v3-space-3);
  border-radius: var(--v3-radius-sm);
  border: 1px solid #e0a3a3;
  background: #fdecea;
  color: #7a1f1f;
  font-size: 0.85rem;
}

.v3-import-file-errors ul {
  margin: 0;
  padding-left: var(--v3-space-4);
}

.v3-import-preview {
  display: flex;
  flex-direction: column;
  gap: var(--v3-space-5);
  max-height: 55vh;
  overflow-y: auto;
  padding-right: var(--v3-space-2);
}

.v3-import-section-heading {
  margin: 0 0 var(--v3-space-2);
  font-size: 0.95rem;
  font-weight: 700;
}

.v3-import-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--v3-space-3);
  margin: 0;
}

.v3-import-summary-item {
  padding: var(--v3-space-3);
  border-radius: var(--v3-radius-sm);
  background: var(--v3-surface-muted);
  border: 1px solid var(--v3-border);
}

.v3-import-summary-item dt {
  margin: 0 0 var(--v3-space-1);
  font-size: 0.75rem;
  color: var(--v3-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.v3-import-summary-item dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.v3-import-summary-item--matched {
  border-color: #a8d5b5;
}

.v3-import-summary-item--unmatched {
  border-color: #e0a3a3;
}

.v3-import-summary-item--ambiguous {
  border-color: #e6c36a;
}

.v3-import-table-wrap {
  overflow-x: auto;
}

.v3-import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.v3-import-table th,
.v3-import-table td {
  padding: var(--v3-space-2) var(--v3-space-3);
  border-bottom: 1px solid var(--v3-border);
  text-align: left;
  white-space: nowrap;
}

.v3-import-table thead th {
  background: var(--v3-surface-muted);
  font-weight: 700;
}

.v3-import-row--unmatched {
  background: #fdecea;
}

.v3-import-row--ambiguous {
  background: #fdf3d9;
}

.v3-import-status-badge {
  display: inline-block;
  padding: 2px var(--v3-space-2);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.v3-import-status-badge--matched {
  background: #e6f4ea;
  color: #1e5631;
}

.v3-import-status-badge--unmatched {
  background: #fdecea;
  color: #7a1f1f;
}

.v3-import-status-badge--ambiguous {
  background: #fdf3d9;
  color: #7a4f00;
}

.v3-import-validation-group {
  margin-bottom: var(--v3-space-3);
}

.v3-import-validation-group h4 {
  margin: 0 0 var(--v3-space-1);
  font-size: 0.85rem;
}

.v3-import-validation-group ul {
  margin: 0;
  padding-left: var(--v3-space-4);
  font-size: 0.82rem;
  color: var(--v3-text-muted);
}

.v3-import-validation-group--file ul {
  color: #7a1f1f;
}

.v3-import-note {
  margin: 0;
  color: var(--v3-text-muted);
  font-size: 0.85rem;
}

.v3-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--v3-space-3);
  padding-top: var(--v3-space-3);
  border-top: 1px solid var(--v3-border);
}

@media (max-width: 720px) {
  [data-force-measurement-import-root] {
    padding: var(--v3-space-3);
  }

  .v3-import-modal {
    margin-top: var(--v3-space-3);
    padding: var(--v3-space-4);
  }

  .v3-import-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .v3-import-actions {
    flex-direction: column-reverse;
  }

  .v3-import-actions .v3-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .v3-import-modal-header {
    flex-direction: column;
  }
}
