:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #0d9e0d;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
}

* { 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;
  min-height: 100vh;
}

/* Header */
.header {
  background: #e2e8f0;
  color: #1e293b;
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-logo {
  height: 48px;
}

.header-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.06);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
}

/* Navigation */
nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}

nav a {
  display: block;
  padding: 0.9rem 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

nav a:hover {
  color: var(--primary);
  background: rgba(26,115,232,0.04);
}

nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Main content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
  background: #e2e8f0;
}

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
}

/* Landing page hero */
.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Stats bar */
.stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 auto 2rem;
  max-width: 480px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.stats-comparison {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* Features grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.feature-card .icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Test progress */
.test-progress {
  margin: 2rem 0;
}

.progress-bar-container {
  background: #e2e8f0;
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4fc3f7);
  border-radius: 20px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Test layers */
.test-layer {
  margin-bottom: 1.5rem;
}

.layer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.layer-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.layer-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.test-items {
  padding-left: 1rem;
}

.test-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}

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

.test-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.test-result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Status indicators */
.status-pass { color: var(--success); }
.status-warn { color: var(--warning); }
.status-fail { color: var(--danger); }
.status-pending { color: var(--text-muted); }
.status-running { color: var(--primary); }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-pass { background: var(--success); }
.dot-warn { background: var(--warning); }
.dot-fail { background: var(--danger); }
.dot-pending { background: #cbd5e1; }

.dot-running {
  background: var(--primary);
  animation: pulse 1.2s infinite;
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Score display */
.score-display {
  text-align: center;
  padding: 2rem;
}

.score-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  border: 6px solid;
  box-shadow: var(--shadow-lg);
}

.score-circle.green {
  border-color: var(--success);
  background: rgba(13,158,13,0.05);
}

.score-circle.yellow {
  border-color: var(--warning);
  background: rgba(245,158,11,0.05);
}

.score-circle.red {
  border-color: var(--danger);
  background: rgba(220,38,38,0.05);
}

.score-number {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.score-circle.green .score-number { color: var(--success); }
.score-circle.yellow .score-number { color: var(--warning); }
.score-circle.red .score-number { color: var(--danger); }

.score-circle.green .score-label { color: var(--success); }
.score-circle.yellow .score-label { color: var(--warning); }
.score-circle.red .score-label { color: var(--danger); }

.score-verdict {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.score-description {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* Recommendations */
.recommendation {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.recommendation.critical {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.recommendation.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.recommendation.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.recommendation .rec-icon {
  flex-shrink: 0;
  font-size: 1.2rem;
}

/* Whitelist table */
.whitelist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.whitelist-table th {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.whitelist-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.whitelist-table tr:hover td {
  background: #f8fafc;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-required {
  background: #dcfce7;
  color: #166534;
}

.tag-optional {
  background: #f1f5f9;
  color: var(--text-muted);
}

.tag-category {
  background: #e0e7ff;
  color: #3730a3;
}

/* Download/copy bar */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Organization input */
.org-input {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.org-input label {
  font-weight: 600;
  font-size: 0.95rem;
}

.org-input input {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  width: 300px;
  max-width: 100%;
}

.org-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

/* Platform selector */
.platform-selector {
  margin-bottom: 1.5rem;
}

.platform-selector h3 {
  margin-bottom: 1rem;
}

.platform-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.platform-card:hover {
  border-color: var(--primary);
  background: rgba(26,115,232,0.04);
}

.platform-card input[type="radio"] {
  display: none;
}

.platform-card.selected {
  border-color: var(--primary);
  background: rgba(26,115,232,0.08);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.platform-card .platform-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.platform-card .platform-domain {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.platform-card .platform-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.platform-card[data-platform="jitsi"] .platform-icon {
  background: #e0e7ff;
  color: #3730a3;
}

.platform-card[data-platform="nextcloud"] .platform-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

.platform-card[data-platform="both"] .platform-icon {
  background: #f0fdf4;
  color: #166534;
}

/* Dual score display */
.dual-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.dual-score .platform-score-section {
  text-align: center;
}

.dual-score .platform-score-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.dual-score .score-circle {
  width: 140px;
  height: 140px;
}

.dual-score .score-number {
  font-size: 2.5rem;
}

@media (max-width: 768px) {
  .platform-cards {
    grid-template-columns: 1fr;
  }

  .dual-score {
    grid-template-columns: 1fr;
  }
}

/* Dropdown */
select {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

/* Firewall code block */
.code-block {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  max-height: 400px;
  overflow-y: auto;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* Print styles */
@media print {
  nav, .footer, .toast, .btn, button, .action-bar, select, #firewall-output,
  #test-setup, #test-running, .org-input {
    display: none !important;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  .header {
    background: white !important;
    box-shadow: none;
    border-bottom: 2px solid #1a73e8;
    padding: 1rem 0;
  }

  .header h1 { color: #1a73e8; }
  .header .subtitle { color: #64748b; }
  .header-date { background: none; }
  .header-logo { height: 40px; }

  .container { padding: 0; max-width: none; }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  .score-circle {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .score-circle.green { border-color: #0d9e0d !important; }
  .score-circle.yellow { border-color: #f59e0b !important; }
  .score-circle.red { border-color: #dc2626 !important; }

  .recommendation {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    break-inside: avoid;
  }

  #recommendations-card {
    break-before: page;
  }

  .whitelist-table th {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    background: #f1f5f9 !important;
  }

  .tag {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    text-align: center;
  }

  nav .nav-inner {
    overflow-x: auto;
  }

  nav a {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .container {
    padding: 1rem;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .score-circle {
    width: 140px;
    height: 140px;
  }

  .score-number {
    font-size: 2.5rem;
  }

  .org-input {
    flex-direction: column;
    align-items: stretch;
  }

  .org-input input {
    width: 100%;
  }

  .whitelist-table {
    font-size: 0.8rem;
  }

  .whitelist-table th, .whitelist-table td {
    padding: 0.5rem;
  }
}
