/* Vault - Core Technical Reference Hub */

/* Hero */
.vault-hero {
  margin-bottom: 24px;
}

.vault-hero h1 {
  margin: 0 0 4px 0;
  font-size: 2rem;
}

.vault-hero p {
  margin: 0 0 8px 0;
}

/* Tab Navigation */
.vault-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.vault-tab {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vault-tab:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

.vault-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.vault-tab .tab-icon {
  font-size: 16px;
}

/* Panel Content */
.vault-panel {
  margin-top: 20px;
}

.panel-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  animation: fadeIn 0.2s ease-out;
}

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

/* Algorithm Cards */
.algo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.algo-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.algo-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(106, 166, 255, 0.1);
}

.algo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.algo-card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.algo-card-title h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--fg);
}

.algo-card-title .algo-standard {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.algo-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-kem {
  background: rgba(106, 166, 255, 0.2);
  color: var(--accent);
}

.badge-sig {
  background: rgba(155, 140, 255, 0.2);
  color: var(--accent2);
}

.badge-hash {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.badge-level1 { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.badge-level2 { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.badge-level3 { background: rgba(33, 150, 243, 0.15); color: #2196f3; }
.badge-level5 { background: rgba(156, 39, 176, 0.15); color: #ce93d8; }

.badge-recommended {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}

.algo-card-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.algo-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  margin-bottom: 16px;
}

.algo-spec {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.algo-spec-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.algo-spec-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  font-family: 'SF Mono', Monaco, monospace;
}

.algo-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.algo-card-actions .qn-btn {
  font-size: 12px;
  padding: 8px 14px;
}

/* Standards Reference */
.standards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.standard-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.standard-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.standard-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.standard-icon.nist { background: rgba(106, 166, 255, 0.2); }
.standard-icon.ietf { background: rgba(155, 140, 255, 0.2); }
.standard-icon.nsa { background: rgba(239, 68, 68, 0.2); }
.standard-icon.iso { background: rgba(34, 197, 94, 0.2); }

.standard-title h4 {
  margin: 0;
  font-size: 1rem;
}

.standard-title span {
  font-size: 12px;
  color: var(--muted);
}

.standard-body {
  padding: 16px;
}

.standard-body p {
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.standard-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.standard-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  transition: background 0.15s;
}

.standard-link:hover {
  background: rgba(106, 166, 255, 0.1);
}

/* Implementation Section */
.impl-section {
  margin-top: 24px;
}

.impl-section h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  color: var(--fg);
}

.impl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.impl-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.impl-card h4 {
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.impl-card h4 .lang-icon {
  font-size: 18px;
}

.impl-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px 0;
}

.impl-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.impl-feature {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Code Examples */
.code-example {
  background: #0a0c0f;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 16px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--line);
}

.code-lang {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.code-copy {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.code-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.code-body {
  padding: 14px;
  overflow-x: auto;
}

.code-body pre {
  margin: 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg);
}

.code-body .comment { color: #6a737d; }
.code-body .keyword { color: #ff7b72; }
.code-body .string { color: #a5d6ff; }
.code-body .function { color: #d2a8ff; }
.code-body .variable { color: #ffa657; }

/* Compatibility Matrix */
.compat-matrix {
  overflow-x: auto;
  margin-top: 20px;
}

.compat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.compat-table th,
.compat-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.compat-table th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
}

.compat-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.compat-table .lib-name {
  font-weight: 500;
  color: var(--fg);
}

.compat-table .lib-version {
  color: var(--muted);
  font-size: 12px;
}

.compat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.compat-status.full {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.compat-status.partial {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.compat-status.none {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.compat-status.beta {
  background: rgba(106, 166, 255, 0.15);
  color: var(--accent);
}

/* Security Profiles */
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.security-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.security-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.security-header h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.security-level {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.security-level.high {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.security-level.medium {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.security-body {
  padding: 16px;
}

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

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

.security-item-label {
  color: var(--muted);
}

.security-item-value {
  color: var(--fg);
  font-weight: 500;
}

/* Timeline */
.timeline {
  margin-top: 24px;
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--accent);
}

.timeline-item.past .timeline-dot {
  background: var(--accent);
}

.timeline-item.future .timeline-dot {
  border-color: var(--muted);
  opacity: 0.5;
}

.timeline-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-item.future .timeline-date {
  color: var(--muted);
}

.timeline-content h4 {
  margin: 0 0 4px 0;
  font-size: 1rem;
}

.timeline-content p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Info Callout */
.info-callout {
  margin-top: 20px;
  padding: 16px;
  background: rgba(106, 166, 255, 0.1);
  border: 1px solid rgba(106, 166, 255, 0.2);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
}

.info-callout strong {
  color: var(--accent);
}

/* Warning Callout */
.warning-callout {
  margin-top: 20px;
  padding: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
}

.warning-callout strong {
  color: #ef4444;
  display: block;
  margin-bottom: 8px;
}

.warning-callout p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 12px;
  color: var(--muted);
}

.filter-select {
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Quick Reference */
.quick-ref {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.quick-ref-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.quick-ref-item h5 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--accent);
}

.quick-ref-item p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* HTMX Loading */
.htmx-request .vault-panel {
  opacity: 0.6;
}

.htmx-request .vault-tab.active::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .vault-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 8px;
  }

  .vault-tabs::-webkit-scrollbar {
    height: 4px;
  }

  .vault-tabs::-webkit-scrollbar-track {
    background: var(--panel);
    border-radius: 2px;
  }

  .vault-tabs::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 2px;
  }

  .algo-grid,
  .standards-grid,
  .impl-grid,
  .security-grid {
    grid-template-columns: 1fr;
  }

  .algo-specs {
    grid-template-columns: 1fr;
  }
}
