/* Layout container - Full width */

body {
  max-width: 100%;
  margin: 0;
  padding: 1.5rem 2rem 3rem;
}

@media (min-width: 1400px) {
  body {
    padding: 1.5rem 3rem 3rem;
  }
}

/* Header & footer */

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header p {
  max-width: 60rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 0.25rem;
}

.page-footer {
  margin-top: 2.5rem;
  text-align: center;
  opacity: 0.75;
}

/* Cards & layout */

.card {
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.5rem;
  box-shadow: 0 1.5rem 2.5rem -2rem rgba(0, 0, 0, 0.7);
}

.card header {
  margin-bottom: 1rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(400px, 1fr) minmax(400px, 1.2fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.layout-grid--bottom {
  grid-template-columns: 1fr 1fr;
}

@media (min-width: 1600px) {
  .layout-grid {
    grid-template-columns: minmax(500px, 1fr) minmax(500px, 1.5fr);
  }
}

@media (max-width: 1100px) {
  .layout-grid,
  .layout-grid--bottom {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Three-column layout for wide screens */
.layout-grid--three {
  display: grid;
  grid-template-columns: minmax(350px, 1fr) minmax(350px, 1.2fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1400px) {
  .layout-grid--three {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .layout-grid--three > article:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .layout-grid--three {
    grid-template-columns: minmax(0, 1fr);
  }
  .layout-grid--three > article:last-child {
    grid-column: auto;
  }
}

/* Full width section */
.full-width-section {
  margin-bottom: 1.5rem;
}

/* Presets section */

.presets-section {
  margin-bottom: 1.5rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.preset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.preset-safe {
  border-color: rgba(0, 255, 135, 0.4);
  background: rgba(0, 255, 135, 0.1);
}

.preset-safe:hover {
  background: rgba(0, 255, 135, 0.2);
}

.preset-danger {
  border-color: rgba(255, 80, 80, 0.4);
  background: rgba(255, 80, 80, 0.1);
}

.preset-danger:hover {
  background: rgba(255, 80, 80, 0.2);
}

.preset-icon {
  font-size: 1rem;
}

/* Simple grid helpers */

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.col {
  flex: 1 1 0;
  min-width: 0;
}

/* Form bits */

textarea {
  min-height: 120px;
  font-family: monospace;
  font-size: 0.9rem;
}

.hint {
  font-size: 0.85rem;
  opacity: 0.8;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 1rem;
}

.form-footer .left {
  display: flex;
  gap: 0.5rem;
}

.form-footer .right {
  text-align: right;
}

.form-footer code {
  font-size: 0.85rem;
}

/* Threshold slider */

.threshold-value {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-weight: bold;
  margin-left: 0.5rem;
}

/* Details (headers section) */

.details-compact > summary {
  font-size: 0.95rem;
  cursor: pointer;
}

/* Header table */

.header-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
}

.header-table th,
.header-table td {
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.header-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.header-actions {
  text-align: right;
  width: 2.5rem;
}

button.small,
button.secondary.small,
button.outline.small {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
}

/* Summary panel */

.summary-card {
  position: relative;
}

.summary-header {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.decision-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.summary-request-line {
  margin-bottom: 0.5rem;
}

.transaction-id {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 1rem;
}

.transaction-id code {
  font-size: 0.75rem;
}

/* Pills, tags, chips */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-width: 1px;
  border-style: solid;
}

.status-pill--allowed {
  border-color: rgba(0, 255, 135, 0.6);
  background: rgba(0, 255, 135, 0.1);
  color: #8af1c0;
}

.status-pill--blocked {
  border-color: rgba(255, 80, 80, 0.7);
  background: rgba(255, 80, 80, 0.1);
  color: #ffb0b0;
}

.status-pill--unknown {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.score-chip {
  font-size: 0.85rem;
  opacity: 0.9;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  margin-right: 0.25rem;
}

.tag.small {
  font-size: 0.7rem;
}

.tag.tiny {
  font-size: 0.65rem;
  margin-top: 0.15rem;
  margin-bottom: 0.15rem;
}

.tag-method {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tag-uri {
  font-family: monospace;
}

.tag-container {
  margin-top: 0.5rem;
}

.tag-container .tag {
  margin-bottom: 0.1rem;
}

/* Rules */

.rule-section {
  margin-top: 0.75rem;
}

.rule-list {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.rule-item {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0.5rem;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.rule-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.rule-message {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.matched-data {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.matched-data code {
  font-size: 0.75rem;
  background: rgba(255, 80, 80, 0.2);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* Severity badges with colors */

.severity-badge {
  display: inline-flex;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: bold;
}

.severity-emergency,
.severity-alert {
  background: rgba(139, 0, 0, 0.8);
  color: #ffcccc;
}

.severity-critical {
  background: rgba(220, 20, 60, 0.8);
  color: #ffdddd;
}

.severity-error {
  background: rgba(255, 80, 80, 0.6);
  color: #fff;
}

.severity-warning {
  background: rgba(255, 165, 0, 0.6);
  color: #fff;
}

.severity-notice {
  background: rgba(30, 144, 255, 0.6);
  color: #fff;
}

.severity-info {
  background: rgba(100, 149, 237, 0.6);
  color: #fff;
}

.severity-unknown {
  background: rgba(128, 128, 128, 0.6);
  color: #fff;
}

/* Intervention log */

.intervention-log {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(255, 80, 80, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 80, 80, 0.3);
}

.intervention-log h3 {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.intervention-log pre {
  font-size: 0.8rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* JSON viewer */

.json-viewer {
  min-height: 200px;
  max-height: 500px;
  overflow: auto;
  font-family: monospace;
  font-size: 0.85rem;
  background: #111111;
  color: #eeeeee;
  border-radius: 0.5rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: pre-wrap;
  word-break: break-word;
}

/* History */

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.history-main {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.1rem;
}

.history-method {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.history-uri {
  font-family: monospace;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
  flex: 1;
}

.history-meta {
  opacity: 0.7;
  font-size: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.history-rules {
  color: rgba(255, 80, 80, 0.9);
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--allowed {
  background: #00d27a;
}

.status-dot--blocked {
  background: #ff4f4f;
}

.status-dot--unknown {
  background: #aaaaaa;
}

/* Generic */

.placeholder {
  opacity: 0.7;
  font-size: 0.9rem;
}

.error {
  margin-top: 0.75rem;
  color: #ff9c9c;
  font-size: 0.9rem;
}
