/* ============================================
   Microdata Schema Tester — Styles
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #6C63FF;
  --primary-light: #a78bfa;
  --primary-dark: #4f46e5;
  --accent: #34d399;
  --accent-dark: #059669;
  --warning: #fbbf24;
  --error: #f87171;
  --bg: #0F0A1A;
  --bg-surface: #1a1230;
  --bg-card: #221a3a;
  --bg-elevated: #2d2348;
  --text: #e8e0f0;
  --text-muted: #9b8fb8;
  --text-dim: #6b5f82;
  --border: #3a2e55;
  --border-light: #4a3d68;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.2);
  --glow: 0 0 20px rgba(108, 99, 255, 0.15);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- App Layout --- */
.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.header {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-left: 44px;
}

/* --- Main --- */
.main {
  flex: 1;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* --- Panels --- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.panel-actions {
  display: flex;
  gap: 8px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 12px 24px;
  font-size: 0.875rem;
  font-weight: 600;
  width: 100%;
  justify-content: center;
  box-shadow: var(--glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(108, 99, 255, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* --- Code Editor --- */
.editor-wrap {
  position: relative;
  margin-bottom: 14px;
}

.code-editor {
  width: 100%;
  min-height: 200px;
  max-height: 400px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color var(--transition);
}

.code-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--glow);
}

.code-editor::placeholder {
  color: var(--text-dim);
}

/* --- Summary Bar --- */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.summary-stat {
  text-align: center;
  padding: 14px 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

#stat-valid .stat-value { color: var(--accent); }
#stat-warnings .stat-value { color: var(--warning); }
#stat-errors .stat-value { color: var(--error); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

.tab:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: -2px;
  border-radius: var(--radius-xs);
}

.tab-content[hidden] {
  display: none;
}

/* --- Data Tree --- */
.data-tree {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.schema-node {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  animation: fadeSlideIn 0.3s ease;
}

.schema-node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.schema-node-header:hover {
  background: var(--border);
}

.schema-type {
  font-weight: 600;
  color: var(--primary-light);
}

.schema-type-badge {
  font-size: 0.6875rem;
  padding: 2px 8px;
  background: rgba(108, 99, 255, 0.15);
  color: var(--primary-light);
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 500;
}

.schema-node-body {
  padding: 12px 16px;
  background: var(--bg-surface);
}

.schema-property {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(58, 46, 85, 0.5);
}

.schema-property:last-child {
  border-bottom: none;
}

.prop-name {
  color: var(--accent);
  min-width: 140px;
  flex-shrink: 0;
}

.prop-value {
  color: var(--text);
  word-break: break-word;
}

.prop-missing {
  color: var(--error);
  font-style: italic;
}

/* Nested schemas */
.nested-schema {
  margin: 8px 0;
  margin-left: 16px;
  border-left: 2px solid var(--primary);
  padding-left: 12px;
}

/* --- Warnings --- */
.warnings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.warning-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  animation: fadeSlideIn 0.3s ease;
}

.warning-item.warning {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.warning-item.error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--error);
}

.warning-item.success {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--accent);
}

.warning-icon {
  flex-shrink: 0;
  font-size: 1rem;
}

.warning-text {
  flex: 1;
  line-height: 1.5;
}

.warning-text strong {
  font-weight: 600;
}

/* --- JSON-LD Output --- */
.jsonld-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.badge {
  font-size: 0.6875rem;
  padding: 4px 10px;
  background: rgba(108, 99, 255, 0.15);
  color: var(--primary-light);
  border-radius: 999px;
  font-weight: 500;
}

.code-output {
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

/* --- Rich Results --- */
.rich-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rich-result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  animation: fadeSlideIn 0.3s ease;
}

.rich-result-title {
  font-size: 1rem;
  font-weight: 600;
  color: #8ab4f8;
  margin-bottom: 4px;
}

.rich-result-url {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.rich-result-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.rich-result-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.rich-meta-item {
  font-size: 0.6875rem;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

.compatibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 10px;
}

.compatibility-badge.pass {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent);
}

.compatibility-badge.fail {
  background: rgba(248, 113, 113, 0.12);
  color: var(--error);
}

/* --- Empty States --- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.875rem;
}

/* --- Footer --- */
.footer {
  padding: 20px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- Animations --- */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .app {
    padding: 0 14px;
  }

  .header {
    padding: 20px 0 14px;
  }

  .logo h1 {
    font-size: 1.2rem;
  }

  .tagline {
    margin-left: 0;
    margin-top: 4px;
  }

  .summary-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel {
    padding: 14px;
  }

  .schema-property {
    flex-direction: column;
    gap: 2px;
  }

  .prop-name {
    min-width: auto;
  }

  .tab {
    padding: 8px 12px;
    font-size: 0.75rem;
  }
}
