/* =========================================================
   JSON ANALYSER
   ========================================================= */

.jp-json-analyser-input {
  width: 100%;
  min-height: 240px;
  padding: 1rem;
  border: 1px solid var(--jp-border);
  border-radius: 0.75rem;
  background: var(--jp-surface);
  color: var(--jp-text);
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
}

.jp-json-analyser-input:focus {
  outline: none;
  border-color: var(--jp-primary);
}

.jp-json-analyser-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.jp-json-results {
  margin-top: 2rem;
}

.jp-json-results[hidden] {
  display: none;
}

.jp-json-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.jp-json-stat {
  padding: 1rem;
  border: 1px solid var(--jp-border);
  border-radius: 0.75rem;
  background: var(--jp-surface);
}

.jp-json-stat-value {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.jp-json-stat-label {
  font-size: 0.85rem;
  color: var(--jp-muted);
}

.jp-json-section {
  margin-top: 2rem;
}

.jp-json-section h3 {
  margin-bottom: 1rem;
}

.jp-json-type-list,
.jp-json-detection-list,
.jp-json-issue-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jp-json-result-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--jp-border);
  border-radius: 0.65rem;
  background: var(--jp-surface);
}

.jp-json-result-item strong {
  word-break: break-word;
}

.jp-json-result-count {
  flex-shrink: 0;
  color: var(--jp-muted);
}

.jp-json-issue {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--jp-border);
  border-radius: 0.65rem;
  background: var(--jp-surface);
}

.jp-json-validity {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--jp-border);
}

.jp-json-validity[hidden] {
  display: none;
}

/* =========================================================
   DETAIL RESULTS
   ========================================================= */

.jp-json-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.jp-json-detail-grid .jp-json-section {
  margin-top: 0;
}

/* =========================================================
   FIELD ANALYSIS
   ========================================================= */

.jp-json-section-heading {
  margin-bottom: 1rem;
}

.jp-json-section-heading h3 {
  margin-bottom: 0.25rem;
}

.jp-json-field-analysis {
  display: grid;
  gap: 1rem;
}

.jp-json-field-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--jp-border);
  border-radius: 0.75rem;
  background: var(--jp-surface);
}

.jp-json-field-group-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--jp-border);
}

.jp-json-field-path {
  margin: 0;
  font-family: monospace;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.jp-json-field-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.jp-json-field-table {
  width: 100%;
  border-collapse: collapse;
}

.jp-json-field-table th,
.jp-json-field-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--jp-border);
}

.jp-json-field-table th {
  font-size: 0.8rem;
  white-space: nowrap;
}

.jp-json-field-table td {
  font-size: 0.9rem;
}

.jp-json-field-table tr:last-child td {
  border-bottom: 0;
}

.jp-json-field-name {
  font-family: monospace;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.jp-json-field-types {
  overflow-wrap: anywhere;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  /* -----------------------------------------------------
       INPUT
       ----------------------------------------------------- */
  .jp-json-analyser-input {
    min-height: 220px;
    padding: 0.85rem;
    font-size: 0.85rem;
    line-height: 1.5;
  }

  /* -----------------------------------------------------
       ACTIONS
       ----------------------------------------------------- */
  .jp-json-analyser-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .jp-json-analyser-actions .btn {
    width: 100%;
  }

  .jp-json-analyser-actions #analyseJson {
    grid-column: 1 / -1;
  }

  /* -----------------------------------------------------
       RESULTS
       ----------------------------------------------------- */
  .jp-json-results {
    margin-top: 1.5rem;
  }

  .jp-json-section {
    margin-top: 1.5rem;
  }

  .jp-json-section h3 {
    margin-bottom: 0.75rem;
  }

  /* -----------------------------------------------------
       STRUCTURE SUMMARY
       ----------------------------------------------------- */
  .jp-json-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .jp-json-stat {
    padding: 0.8rem;
    min-width: 0;
  }

  .jp-json-stat-value {
    font-size: 1.25rem;
  }

  .jp-json-stat-label {
    font-size: 0.8rem;
  }

  /* -----------------------------------------------------
       DATA TYPES / DETECTED VALUES
       ----------------------------------------------------- */
  .jp-json-detail-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* -----------------------------------------------------
       RESULT ROWS
       ----------------------------------------------------- */
  .jp-json-result-item {
    align-items: flex-start;
    padding: 0.65rem 0.75rem;
  }

  .jp-json-result-item strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .jp-json-result-count {
    flex-shrink: 0;
  }

  /* -----------------------------------------------------
       ISSUES
       ----------------------------------------------------- */
  .jp-json-issue {
    padding: 0.65rem 0.75rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* -----------------------------------------------------
       FIELD ANALYSIS
       ----------------------------------------------------- */

  .jp-json-field-group-header {
    padding: 0.7rem 0.75rem;
  }

  .jp-json-field-table th,
  .jp-json-field-table td {
    padding: 0.6rem 0.75rem;
  }

  .jp-json-field-table th {
    font-size: 0.75rem;
  }

  .jp-json-field-table td {
    font-size: 0.85rem;
  }

  /* -----------------------------------------------------
       VALIDATION
       ----------------------------------------------------- */
  .jp-json-validity {
    padding: 0.75rem;
  }
}

@media (max-width: 400px) {
  .jp-json-summary-grid {
    grid-template-columns: 1fr;
  }

  .jp-json-analyser-actions {
    grid-template-columns: 1fr;
  }

  .jp-json-analyser-actions #analyseJson {
    grid-column: auto;
  }

  .jp-json-field-table th:nth-child(4),
  .jp-json-field-table td:nth-child(4) {
    display: none;
  }
}
