/**
 * Web3User Permission Lab — Interactive Demo Stylesheet
 *
 * Provides responsive, WCAG AA accessible layout and styling for the
 * Milestone 7 client-side policy evaluation playground.
 */

.demo-section {
  padding: 32px 0 48px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.demo-header {
  margin-bottom: 24px;
}

.demo-header h2 {
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  color: #fff;
}

.demo-header p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
  max-width: 850px;
}

/* Presets Bar */
.demo-presets-wrapper {
  background: #0f192b;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.presets-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 12px;
}

.demo-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.demo-preset-btn {
  background: #142238;
  border: 1px solid #283e60;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease-in-out;
  text-align: left;
}

.demo-preset-btn:hover {
  background: #1b2d4b;
  border-color: var(--blue);
  transform: translateY(-1px);
}

.demo-preset-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.demo-preset-btn.active {
  background: #1d3356;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

.preset-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.preset-tag.allow {
  background: #153825;
  color: var(--green);
  border: 1px solid #2c7a4d;
}

.preset-tag.deny {
  background: #3d1a1f;
  color: #ff8a98;
  border: 1px solid #802c38;
}

.preset-tag.unknown {
  background: #3a2d12;
  color: var(--gold);
  border: 1px solid #7a5d20;
}

.preset-description-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: #ffd48a;
  font-size: 0.88rem;
  font-weight: 500;
}

/* Two-column layout for forms */
.demo-workspace {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.demo-card {
  background: linear-gradient(145deg, #121f35, #0f182a);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.demo-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.demo-badge-sub {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  background: #09101d;
  border: 1px solid #22344f;
  border-radius: 6px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  padding: 8px 10px;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(113, 226, 208, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  background: #0a1221;
  border: 1px solid #20314a;
  border-radius: 6px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--cyan);
}

.checkbox-group label {
  margin-bottom: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-inline {
  background: #15263d;
  border: 1px solid #2b4366;
  color: var(--cyan);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
}

.btn-inline:hover {
  background: #1c3352;
  border-color: var(--cyan);
}

/* Evaluation Banner & Results */
.demo-results-wrapper {
  margin-bottom: 28px;
}

.decision-banner {
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.decision-banner.status-allow {
  background: linear-gradient(145deg, #0d281a, #091c12);
  border-color: #276942;
}

.decision-banner.status-deny {
  background: linear-gradient(145deg, #2e1318, #200d11);
  border-color: #792a35;
}

.decision-banner.status-unknown {
  background: linear-gradient(145deg, #2b210c, #1f1708);
  border-color: #72571e;
}

.decision-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.decision-badge {
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: 8px;
  display: inline-block;
}

.badge-allow {
  background: #1b4d2e;
  color: #85f096;
  border: 1px solid #338a53;
}

.badge-deny {
  background: #501d24;
  color: #ff9fa9;
  border: 1px solid #993340;
}

.badge-unknown {
  background: #473512;
  color: #ffe099;
  border: 1px solid #8c6a21;
}

.decision-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.decision-reasons {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 0.95rem;
}

.decision-reasons li {
  margin-bottom: 4px;
}

/* Checklist */
.checklist-container {
  background: #0d1728;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.checklist-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 14px;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  padding: 8px 12px;
  border-radius: 6px;
  background: #09101d;
  border: 1px solid #1a2a42;
}

.check-item.passed .check-icon {
  color: var(--green);
  font-weight: bold;
}

.check-item.failed .check-icon {
  color: #ff8a98;
  font-weight: bold;
}

.check-body strong {
  display: block;
  color: #fff;
}

.check-msg {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Calldata Inspector */
.inspector-card {
  background: #0a1322;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.inspector-title {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--cyan);
  margin-bottom: 10px;
}

.calldata-code-block {
  background: #040810;
  border: 1px solid #172438;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  word-break: break-all;
  line-height: 1.6;
}

.cd-selector {
  color: var(--cyan);
  font-weight: bold;
  background: rgba(113, 226, 208, 0.12);
  padding: 2px 4px;
  border-radius: 3px;
}

.cd-recipient {
  color: var(--blue);
  background: rgba(137, 180, 255, 0.12);
  padding: 2px 4px;
  border-radius: 3px;
}

.cd-amount {
  color: var(--gold);
  font-weight: bold;
  background: rgba(255, 212, 138, 0.12);
  padding: 2px 4px;
  border-radius: 3px;
}

.calldata-decoded-info {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--muted);
}

.calldata-decoded-info code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Code Snippet Box */
.code-generator-card {
  background: #0c1626;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.code-header h4 {
  margin: 0;
  font-size: 0.92rem;
  color: #fff;
  font-weight: 700;
}

.btn-copy {
  background: #17273f;
  border: 1px solid #2d456b;
  color: var(--cyan);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy:hover {
  background: #203554;
  border-color: var(--cyan);
}

.code-pre {
  background: #040810;
  border: 1px solid #16243a;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #d1dcfa;
  margin: 0;
  max-height: 380px;
}

/* Architecture Boundary Notice */
.arch-boundary-box {
  background: #121c2c;
  border: 1px solid #273b57;
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 20px;
}

.arch-boundary-box h4 {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.95rem;
}

.arch-boundary-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.arch-boundary-box code {
  color: #fff;
  background: #0a111c;
  padding: 2px 5px;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .demo-workspace {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .checklist {
    grid-template-columns: 1fr;
  }
}
