/* ============================================
   SONANCE PROCESS CAPTURE TOOL
   Brand: Charcoal #333F48, Blue #00A3E1, Montserrat
   ============================================ */

:root {
  --bg: #1a1f24;
  --bg-secondary: #242a31;
  --surface: #2d343c;
  --surface2: #333F48;
  --surface3: #3a444c;
  --border: rgba(255,255,255,.06);
  --border-strong: #3a444c;
  --accent: #00A3E1;
  --accent-dim: #0080b3;
  --accent-glow: rgba(0,163,225,.12);
  --accent-hover: #1ab4f0;
  --charcoal: #333F48;
  --text: #FFFFFF;
  --text-secondary: #D9D9D6;
  --text-muted: #8f999f;
  --danger: #C62828;
  --success: #2E7D32;
  --success-light: rgba(46,125,50,.15);
  --warning: #F57C00;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
}

html.light {
  --bg: #FFFFFF;
  --bg-secondary: #f8f9fa;
  --surface: #f0f2f3;
  --surface2: #f8f9fa;
  --surface3: #D9D9D6;
  --border: rgba(0,0,0,.06);
  --border-strong: #D9D9D6;
  --accent: #00A3E1;
  --accent-dim: #0080b3;
  --accent-glow: rgba(0,163,225,.08);
  --accent-hover: #1ab4f0;
  --text: #333F48;
  --text-secondary: #515c64;
  --text-muted: #6b7780;
  --shadow: 0 8px 32px rgba(0,0,0,.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.header {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 28px;
  width: auto;
}

.header-sep {
  color: var(--border-strong);
  font-size: 18px;
  font-weight: 300;
}

.header-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  gap: 4px;
}

/* ── BUTTONS ── */
.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.btn-icon:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}
.btn-secondary:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-generate {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .2s;
}
.btn-generate:hover {
  filter: brightness(1.1);
  box-shadow: 0 8px 32px var(--accent-glow);
  transform: translateY(-1px);
}

/* ── APP LAYOUT ── */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px 20px 12px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.step-nav {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.step-nav-item:hover {
  background: var(--surface);
  color: var(--text-secondary);
}
.step-nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.step-nav-item.completed {
  color: var(--text-secondary);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.step-nav-item.active .step-num {
  background: var(--accent);
  color: #fff;
}
.step-nav-item.completed .step-num {
  background: var(--success);
  color: #fff;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.capture-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── MAIN CONTENT ── */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.step-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  animation: fadeIn .3s ease;
}
.step-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-header {
  margin-bottom: 32px;
}
.step-header h2 {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.step-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 55ch;
  line-height: 1.6;
}
.step-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ── CAPTURE TYPE GRID ── */
.capture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.capture-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  text-align: left;
  cursor: pointer;
  transition: all .25s;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.capture-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}
.capture-card.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 24px var(--accent-glow);
}

.card-icon {
  color: var(--accent);
}
.capture-card h3 {
  font-size: 15px;
  font-weight: 600;
}
.capture-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── FORM ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.full {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--text-secondary);
}

.field-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.field-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.field-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.6;
}

.field-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f999f' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── VOICE INPUT ── */
.input-voice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.input-voice .field-input {
  flex: 1;
}

.btn-mic {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.btn-mic:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.btn-mic.recording {
  background: rgba(198,40,40,.15);
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,.3); }
  50% { box-shadow: 0 0 0 8px rgba(198,40,40,0); }
}

/* ── NAVIGATION BAR ── */
.nav-bar {
  padding: 16px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg);
}
.nav-spacer { flex: 1; }

/* ── REVIEW ── */
.review-summary {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.review-section {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
}
.review-section h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.review-field {
  margin-bottom: 8px;
}
.review-field-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.review-field-value {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}
.review-field-value.empty {
  color: var(--text-muted);
  font-style: italic;
}

.generate-actions {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

/* ── OUTPUT ── */
.output-area {
  min-height: 300px;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px;
}
.loader p {
  font-size: 13px;
  color: var(--text-muted);
}
.loader-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.output-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 32px;
  font-size: 13px;
  line-height: 1.8;
}
.output-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--accent);
}
.output-content h3:first-child {
  margin-top: 0;
}
.output-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
}
.output-content ul, .output-content ol {
  padding-left: 20px;
  margin: 8px 0;
}
.output-content li {
  margin-bottom: 4px;
}
.output-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.output-content th, .output-content td {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  text-align: left;
  font-size: 12px;
}
.output-content th {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.output-content .tag {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
}

.output-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 24px 48px;
  border-top: 1px solid var(--border);
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}
.modal-close {
  font-size: 22px;
  line-height: 1;
}
.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .step-panel {
    padding: 24px 20px;
  }
  .nav-bar {
    padding: 12px 20px;
  }
  .capture-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .header-logo {
    display: none;
  }
  .header-sep {
    display: none;
  }
}
