/* Variable Profile Viewer – UI aligned with Angular/PrimeNG product-profile */
:root {
  --primary: #4085b5;
  --primary-dark: #1A4D8C;
  --section-header: #e8ecf0;
  --panel-border: #dee2e6;
  --text-primary: #0f1419;
  --text-muted: #3d454d;
  --success: #04AA6D;
  --closed: #FF6666;
  --tab-inactive: #edf2f7;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  margin: 0;
  padding: 1rem;
  background: #f5f6f8;
  color: var(--text-primary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  margin-bottom: 1.5rem;
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Cards / Panels – match Angular .card */
.card {
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Instructions – browse by URL */
.instructions-section {
  margin-bottom: 1rem;
}

.instructions-text {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.instructions-url {
  margin: 0 0 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--tab-inactive);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: ui-monospace, monospace;
}

.instructions-url code {
  color: var(--text-primary);
}

.instructions-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Form */
.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.required {
  color: #c0392b;
}

.form-row input {
  width: 100%;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

.form-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(64, 133, 181, 0.25);
}

.form-row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.form-row-inline .form-field {
  flex: 0 0 auto;
}

.form-row-inline .form-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.form-row-inline .form-field input {
  width: 100%;
  min-width: 120px;
  max-width: 180px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

.form-row-inline .form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(64, 133, 181, 0.25);
}

.form-row-inline .form-field input.invalid {
  border-color: #c0392b;
}

.form-row-inline .form-field input.invalid:focus {
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.25);
}

.validation-errors {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #c0392b;
}

.validation-errors:empty {
  display: none;
}

.validation-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.form-row-inline .form-actions {
  margin-top: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

button[type="submit"] {
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: var(--primary-dark);
}

button[type="submit"]:disabled {
  background: #adb5bd;
  cursor: not-allowed;
}

/* Spinner – shown under profile section while loading */
.profile-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 120px;
}

.profile-spinner.hidden {
  display: none;
}

.profile-spinner-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--tab-inactive);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none;
}

/* Profile section */
.profile-section .profile-grid {
  display: grid;
  gap: 0.75rem 1.5rem;
  grid-template-columns: auto 1fr;
}

.profile-section .profile-grid dt {
  font-weight: 600;
  color: #4a5568;
  margin: 0;
}

.profile-section .profile-grid dd {
  margin: 0;
}

.profile-section .meta {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.raw-json {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.raw-json summary {
  cursor: pointer;
  color: var(--primary);
}

.raw-json pre {
  margin: 0.5rem 0 0 0;
  padding: 0.75rem;
  background: #f8f9fa;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: auto;
  max-height: 300px;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-section pre {
  margin: 0;
  padding: 0.75rem;
  background: #fff5f5;
  border-radius: 6px;
  color: #c0392b;
  overflow: auto;
  font-size: 0.9rem;
}

/* Tab view – match p-tabView */
.profile-section .profile-header {
  margin-bottom: 1rem;
}

.profile-section .profile-header h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.profile-section .profile-header-info {
  display: grid;
  gap: 0.25rem 1.5rem;
  grid-template-columns: auto 1fr;
  margin: 0.75rem 0 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--panel-border);
  font-size: 0.9rem;
}

.profile-section .profile-header-info dt {
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}

.profile-section .profile-header-info dd {
  margin: 0;
  color: var(--text-primary);
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0;
  padding: 0;
  border-bottom: 1px solid var(--panel-border);
  background: #fff;
}

.tab-btn {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}

.tab-btn--disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.tab-btn--disabled .tab-ban-icon {
  color: #c0392b;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.tab-btn--disabled:hover {
  color: var(--text-muted);
}

.tab-panels {
  min-height: 200px;
  padding: 1rem 0;
  max-height: 764px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-top: none;
  border-radius: 0 0 6px 6px;
}

.tab-panel {
  display: none;
  padding: 0 1rem 1rem;
}

.tab-panel.active {
  display: block;
}

/* Panel blocks & section headers – match Angular */
.panel-block {
  margin-bottom: 1.5rem;
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1rem 0 0.5rem 0;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--panel-border);
  background: var(--section-header);
  padding: 0.5rem 0.75rem;
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  border-radius: 4px 4px 0 0;
}

.panel-title:first-child {
  margin-top: 0;
}

/* Accordion – match p-accordion (blue header, white text, chevron) */
.accordion-item {
  margin-bottom: 0.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff !important;
  background: var(--primary) !important;
  border: none;
  cursor: pointer;
  list-style: none;
  text-align: left;
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-header::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 0.5rem;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #fff;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.accordion-item[open] .accordion-header::before {
  transform: rotate(180deg);
}

.accordion-header .accordion-header-text {
  flex: 1;
}

.accordion-header .accordion-status {
  font-size: 0.85rem;
  font-weight: 500;
}

.accordion-content {
  padding: 1rem;
  background: #fff;
  border-top: 1px solid var(--panel-border);
}

.accordion-item .panel-title {
  margin-left: 0;
  margin-right: 0;
}

/* Data tables – match p-datatable */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border: 1px solid var(--panel-border);
}

.data-table thead th {
  background: var(--section-header);
  font-weight: 600;
  color: var(--text-primary);
}

.data-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.data-table--compact th,
.data-table--compact td {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

.badge.closed {
  font-size: 0.75rem;
  color: var(--closed);
  font-weight: 500;
}

.text-success {
  color: var(--success);
}

.plan-list {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  columns: 2;
  column-gap: 1.5rem;
}

.tab-error {
  color: #c0392b;
  font-size: 0.9rem;
}

.check { color: var(--success); font-weight: bold; }
.cross { color: var(--closed); }
.note { font-size: 0.85rem; color: var(--text-muted); margin: 0.5rem 0; }
.fw-bold { font-weight: 600; }
.text-center { text-align: center; }
.table-scroll { overflow-x: auto; margin-bottom: 1rem; }
.detail-row { background: #e7f1ff !important; }
.detail-row td { font-size: 0.85rem; }
.overall-availability-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

.overall-availability-row .availability-map {
  flex: 1 1 auto;
  min-width: 0;
}

.overall-availability-row .state-avail-table {
  flex: 0 0 auto;
  margin-left: auto;
}

.state-avail-table { max-width: 400px; }
.plan-types-table { font-size: 0.9rem; }
.plan-types-table td { padding: 0.35rem 0.5rem; }

/* State availability map */
.availability-map {
  min-height: 360px;
  margin: 0.5rem 0;
}

.availability-map svg {
  display: block;
}

.availability-map .legend text {
  font-size: 12px;
  fill: #4a5568;
}

.availability-map-tooltip {
  position: absolute;
  padding: 6px 10px;
  background: #2d3748;
  color: #fff;
  font-size: 13px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 1000;
  transition: opacity 0.15s;
}
