/* ============================================================
   PolicyAudit — Global Styles
   Clean, professional, dark theme with blue accents
   ============================================================ */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #1d4ed8;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --danger-hover: #dc2626;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); text-decoration: none; }

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

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: 10px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

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

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

/* ============================================================
   Hero Section
   ============================================================ */

.hero {
  text-align: center;
  padding: 64px 24px 48px;
}

.hero h1 {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}

/* ============================================================
   Scan Form
   ============================================================ */

.scan-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.scan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.scan-card h2 {
  font-size: 20px;
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

textarea, input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  resize: vertical;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { min-height: 200px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   Framework Checkboxes
   ============================================================ */

.frameworks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.framework-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.framework-checkbox:hover { border-color: var(--accent); }

.framework-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.framework-checkbox.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  position: relative;
}

.framework-checkbox .lock-icon {
  font-size: 11px;
  margin-left: auto;
  color: var(--text-muted);
}

/* ============================================================
   Results
   ============================================================ */

.results-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.scorecard {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  margin-bottom: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.overall-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  border: 6px solid;
  margin-bottom: 8px;
}

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

.framework-scores h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.framework-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.framework-bar .label {
  width: 80px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.framework-bar .bar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-input);
  border-radius: 5px;
  overflow: hidden;
}

.framework-bar .bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.bar-fill.green { background: var(--success); }
.bar-fill.yellow { background: var(--warning); }
.bar-fill.red { background: var(--danger); }

.framework-bar .score-value {
  width: 40px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

/* Violations */

.violations-section {
  margin-bottom: 40px;
}

.violations-section h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.violation-group h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.violation-group h3.critical { color: var(--danger); }
.violation-group h3.high { color: #f97316; }
.violation-group h3.medium { color: var(--warning); }
.violation-group h3.low { color: var(--text-muted); }

.violation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 8px;
  border-left: 3px solid;
}

.violation-card.critical { border-left-color: var(--danger); }
.violation-card.high { border-left-color: #f97316; }
.violation-card.medium { border-left-color: var(--warning); }
.violation-card.low { border-left-color: var(--text-muted); }

.violation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.severity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.severity-badge.critical { background: var(--danger); color: #fff; }
.severity-badge.high { background: #f97316; color: #fff; }
.severity-badge.medium { background: var(--warning); color: #000; }
.severity-badge.low { background: var(--border); color: var(--text-secondary); }

.violation-card .description {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.violation-card .framework-tag {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.violation-card .fix {
  font-size: 13px;
  color: var(--success);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Results actions */

.results-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

/* ============================================================
   Pricing
   ============================================================ */

.pricing-section {
  padding: 64px 24px;
}

.pricing-section h2 {
  text-align: center;
  font-size: 32px;
  margin-bottom: 12px;
}

.pricing-section .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  max-width: 1050px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.pricing-card.featured {
  border-color: var(--accent);
  position: relative;
}

.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  text-transform: uppercase;
}

.pricing-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.pricing-card .price {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 4px;
}

.pricing-card .price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-card .period {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pricing-card ul {
  list-style: none;
  text-align: left;
  margin-bottom: 32px;
  flex: 1;
}

.pricing-card ul li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pricing-card ul li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

.pricing-card .btn { width: 100%; }

/* ============================================================
   How It Works
   ============================================================ */

.how-it-works {
  padding: 64px 24px;
  background: var(--bg-secondary);
}

.how-it-works h2 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 48px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  text-align: center;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.step h3 { font-size: 16px; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-secondary); }

/* ============================================================
   Trust / Features
   ============================================================ */

.trust-section {
  padding: 64px 24px;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.trust-item {
  text-align: center;
  padding: 24px;
}

.trust-item .icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.trust-item h4 { font-size: 15px; margin-bottom: 6px; }
.trust-item p { font-size: 13px; color: var(--text-secondary); }

/* ============================================================
   Dashboard
   ============================================================ */

.dashboard {
  padding: 40px 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.dashboard h1 {
  font-size: 28px;
  margin-bottom: 32px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
}

.usage-bar-container {
  margin-top: 12px;
}

.usage-bar-track {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s;
}

.usage-bar-fill.warning { background: var(--warning); }
.usage-bar-fill.danger { background: var(--danger); }

.scan-history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.scan-history h2 {
  font-size: 18px;
  padding: 20px 20px 0;
  margin-bottom: 16px;
}

.scan-history table {
  width: 100%;
  border-collapse: collapse;
}

.scan-history th, .scan-history td {
  padding: 12px 20px;
  text-align: left;
  font-size: 13px;
  border-top: 1px solid var(--border);
}

.scan-history th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.scan-history tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

.scan-score {
  font-weight: 700;
}

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

/* ============================================================
   Auth Pages
   ============================================================ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 65px);
  padding: 40px 24px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-card .form-group { margin-bottom: 20px; }

.auth-card .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-card .btn { width: 100%; margin-top: 8px; }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============================================================
   Alert / Toast
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer a { color: var(--text-secondary); }
.site-footer .footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 12px;
}

/* ============================================================
   Loading spinner
   ============================================================ */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  flex-direction: column;
  gap: 16px;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
}

.loading-overlay p {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ============================================================
   Utilities
   ============================================================ */

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 16px; }

  .scorecard {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .steps-grid { grid-template-columns: 1fr; gap: 24px; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 360px; margin: 0 auto; }

  .nav-links { gap: 12px; }
  .nav-links a { font-size: 13px; }

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

  .scan-card { padding: 20px; }

  .results-actions { flex-direction: column; }
  .results-actions .btn { width: 100%; }

  .scan-history { overflow-x: auto; }

  .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .nav { padding: 12px 16px; }
  .nav-brand { font-size: 18px; }
  .nav-auth .btn { padding: 8px 12px; font-size: 13px; }
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 24px; }
  .frameworks-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
}
