/* --------------------------------------------------------
   BRAVE Platform - Mock Portal Styles
   -------------------------------------------------------- */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --primary: #c05621;
  --primary-hover: #a84b1c;
  --accent: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --postman-orange: #ff6c37;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Navigation */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 2px;
}

.nav-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

/* App Layout (sidebar + main) */
.app-layout {
  display: flex;
  min-height: calc(100vh - 52px);
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 20px;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.sidebar-link {
  display: block;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: var(--bg);
}

.sidebar-link.active {
  background: var(--bg);
  font-weight: 500;
  color: var(--primary);
}

/* Main Content */
.main-content {
  flex: 1;
  min-width: 0;
}

/* Container */
.container {
  max-width: 1100px;
  padding: 32px;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hidden {
  display: none;
}

/* Template Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.template-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.template-card p {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}

.template-card.highlighted {
  border-color: var(--postman-orange);
  box-shadow: 0 0 0 1px var(--postman-orange);
}

.badge {
  display: inline-block;
  background: var(--postman-orange);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 8px;
  width: fit-content;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.version {
  font-size: 12px;
  color: var(--text-secondary);
}

.card-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
}

/* Form */
.form-header {
  margin-bottom: 24px;
}

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.form-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

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

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface);
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(192, 86, 33, 0.15);
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

.postman-section {
  border-color: var(--postman-orange);
  border-left: 4px solid var(--postman-orange);
}

.section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.provision-list {
  list-style: none;
  padding: 0;
}

.provision-list li {
  font-size: 13px;
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.provision-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  background: var(--postman-orange);
  border-radius: 50%;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Status Timeline */
.status-timeline {
  margin-top: 24px;
}

.status-step {
  display: flex;
  gap: 16px;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
  flex-shrink: 0;
}

.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  z-index: 1;
}

.step-line {
  width: 2px;
  flex: 1;
  background: var(--border);
}

.step-content {
  padding-bottom: 32px;
  flex: 1;
}

.step-content h3 {
  font-size: 15px;
  font-weight: 600;
}

.step-content p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.step-detail {
  margin-top: 8px;
  font-size: 13px;
}

/* Step states */
.status-step.running .step-dot {
  background: var(--warning);
  border-color: var(--warning);
  animation: pulse 1.5s infinite;
}

.status-step.complete .step-dot {
  background: var(--success);
  border-color: var(--success);
}

.status-step.complete .step-line {
  background: var(--success);
}

.status-step.error .step-dot {
  background: var(--error);
  border-color: var(--error);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Result Summary */
.result-summary {
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 24px;
  margin-top: 24px;
}

.result-summary h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 16px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 13px;
}

.result-row:last-child {
  border-bottom: none;
}

.result-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.result-value a {
  color: var(--accent);
  text-decoration: none;
}

.result-value a:hover {
  text-decoration: underline;
}

/* Floating teardown button */
.teardown-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--error);
  color: white;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, transform 0.15s;
  z-index: 1000;
}

.teardown-fab:hover {
  background: #b91c1c;
  transform: translateY(-2px);
}

.teardown-fab.hidden {
  display: none;
}

.fab-icon {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.teardown-fab.tearing-down {
  background: var(--warning);
  pointer-events: none;
}

.teardown-fab.tearing-down .fab-label::after {
  content: "...";
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

/* Spec source toggle */
.spec-source-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  margin: 0;
}

/* File drop zone */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.file-drop-zone:hover {
  border-color: var(--primary);
  background: rgba(192, 86, 33, 0.03);
}

.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Checkbox label */
.form-group .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}

/* Mock panels */
.mock-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.mock-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.mock-panel h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mock-panel .panel-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
}

.panel-badge.passed { background: var(--success); }
.panel-badge.open { background: var(--accent); }

.mock-panel .panel-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--bg);
}

.mock-panel .panel-row:last-child { border-bottom: none; }
.mock-panel .panel-label { color: var(--text-secondary); }
.mock-panel .panel-value { font-weight: 500; }

/* Email preview mock */
.email-preview {
  background: #f8f8f8;
  border-radius: 6px;
  padding: 16px;
  font-size: 12px;
  margin-top: 8px;
}

.email-preview .email-header {
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.email-preview .email-body {
  line-height: 1.6;
}

.email-preview .email-body a {
  color: var(--accent);
  text-decoration: none;
}

/* Auto-populate flash */
.auto-populated {
  animation: flash 0.5s ease-out;
}

@keyframes flash {
  0% { background: #fef3c7; }
  100% { background: transparent; }
}

/* Full-width mock panel */
.mock-panels .mock-panel:first-child {
  grid-column: 1 / -1;
}

/* Spec preview card */
.spec-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 8px;
}

.spec-preview.hidden { display: none; }

.spec-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.spec-preview-title {
  font-size: 13px;
  font-weight: 600;
}

.spec-preview-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.spec-preview-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.spec-tag {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Postman badge (app icon in card footer, matches Select button height exactly) */
.postman-badge {
  display: block;
  height: 31px;
  width: 31px;
  border-radius: 6px;
}
