/* ============ BACKGROUND PATTERNS ============ */

/* Blueprint grid + centre glow + padlock (Login/Register) */
.bg-blueprint {
  background-color: #0f172a;
  background-image:
    radial-gradient(ellipse at 50% 40%, rgba(37,99,235,0.1) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Crect width='60' height='60' fill='none' stroke='rgba(37,99,235,0.04)' stroke-width='0.5'/%3E%3Crect width='12' height='12' fill='none' stroke='rgba(37,99,235,0.02)' stroke-width='0.5'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 600'%3E%3Cpath d='M0 120H120V200H260V120H400' stroke='rgba(37,99,235,0.04)' fill='none' stroke-width='1'/%3E%3Cpath d='M80 0V120H200V320H340V240H400' stroke='rgba(37,99,235,0.03)' fill='none' stroke-width='1'/%3E%3Ccircle cx='120' cy='120' r='3' fill='rgba(37,99,235,0.06)'/%3E%3Ccircle cx='260' cy='120' r='3' fill='rgba(37,99,235,0.05)'/%3E%3Ccircle cx='200' cy='320' r='3' fill='rgba(37,99,235,0.04)'/%3E%3Crect x='185' y='270' width='30' height='24' rx='4' fill='none' stroke='rgba(96,165,250,0.04)' stroke-width='1.5'/%3E%3Cpath d='M192 270V262C192 256 196 252 200 252C204 252 208 256 208 262V270' fill='none' stroke='rgba(96,165,250,0.04)' stroke-width='1.5'/%3E%3Ccircle cx='200' cy='282' r='2' fill='rgba(96,165,250,0.05)'/%3E%3C/svg%3E");
  background-size: 100% 100%, 60px 60px, 400px 600px;
  background-repeat: no-repeat, repeat, repeat;
}

/* Attendance dot matrix (Dashboard) */
.bg-dots {
  background-color: var(--bg, #0f172a);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Ccircle cx='9' cy='9' r='1.5' fill='rgba(96,165,250,0.045)'/%3E%3C/svg%3E");
  background-size: 18px 18px;
}
[data-theme="light"] .bg-dots {
  background-color: #eef2f7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Ccircle cx='9' cy='9' r='1.5' fill='rgba(37,99,235,0.06)'/%3E%3C/svg%3E");
}
/* bg-blueprint always stays dark (login/register pages) */
[data-theme="light"] .bg-shield {
  background-color: #eef2f7;
}
[data-theme="light"] .bg-blueprint-subtle {
  background-color: #eef2f7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Crect width='60' height='60' fill='none' stroke='rgba(37,99,235,0.04)' stroke-width='0.5'/%3E%3C/svg%3E");
}

/* Shield + charts (Verify page) */
.bg-shield {
  background-color: #0f172a;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 600'%3E%3Cpath d='M200 40L340 70V200C340 300 270 350 200 370C130 350 60 300 60 200V70L200 40Z' fill='none' stroke='rgba(37,99,235,0.04)' stroke-width='2'/%3E%3Cpath d='M200 70L310 92V195C310 275 255 315 200 330C145 315 90 275 90 195V92L200 70Z' fill='none' stroke='rgba(37,99,235,0.025)' stroke-width='1.5'/%3E%3Crect x='185' y='170' width='30' height='24' rx='4' fill='none' stroke='rgba(96,165,250,0.05)' stroke-width='1.5'/%3E%3Cpath d='M192 170V162C192 156 196 152 200 152C204 152 208 156 208 162V170' fill='none' stroke='rgba(96,165,250,0.05)' stroke-width='1.5'/%3E%3Ccircle cx='200' cy='182' r='2.5' fill='rgba(96,165,250,0.06)'/%3E%3Crect x='100' y='420' width='18' height='50' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='126' y='400' width='18' height='70' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='152' y='430' width='18' height='40' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='178' y='410' width='18' height='60' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='204' y='425' width='18' height='45' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='230' y='405' width='18' height='65' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='256' y='435' width='18' height='35' fill='rgba(96,165,250,0.03)'/%3E%3Crect x='282' y='415' width='18' height='55' fill='rgba(96,165,250,0.03)'/%3E%3C/svg%3E");
  background-size: 400px 600px;
  background-position: center top;
  background-repeat: no-repeat;
}

/* Blueprint subtle (for content pages like pitch, how-it-works, wiki) */
.bg-blueprint-subtle {
  background-color: #0f172a;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Crect width='60' height='60' fill='none' stroke='rgba(37,99,235,0.025)' stroke-width='0.5'/%3E%3C/svg%3E");
  background-size: 60px 60px;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #93c5fd;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --bg: #eef2f7;
  --bg-alt: #e2e8f0;
  --card: #f8fafc;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --success: #22c55e;
  --success-bg: #14532d;
  --warning: #fbbf24;
  --warning-bg: #713f12;
  --danger: #ef4444;
  --danger-bg: #7f1d1d;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; transition: background 0.3s, color 0.3s; }
a { color: var(--primary); }

.container { max-width: 900px; margin: 0 auto; padding: 20px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* Nav */
nav { background: var(--card); border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); transition: background 0.3s; }
nav .logo { font-weight: 800; font-size: 1.4em; color: var(--primary); text-decoration: none; letter-spacing: -0.5px; }
nav .logo span { color: var(--text); }
nav .nav-links { display: flex; gap: 12px; align-items: center; }
nav .nav-links a { text-decoration: none; color: var(--text-muted); font-size: 0.9em; font-weight: 500; }
nav .nav-links a:hover { color: var(--primary); }

/* Theme toggle */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 1.1em; color: var(--text); transition: all 0.2s; }
.theme-toggle:hover { border-color: var(--primary); background: var(--bg-alt); }

/* Fullscreen toggle */
.fullscreen-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 1em; color: var(--text); }
.fullscreen-toggle:hover { border-color: var(--primary); background: var(--bg-alt); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 8px; border: none; font-size: 0.95em; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.15s; color: white; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-success { background: var(--success); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 0.85em; }
.btn-lg { padding: 14px 28px; font-size: 1.05em; }
.btn-ghost { background: none; border: none; color: var(--text-muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--primary); }
.btn-block { width: 100%; justify-content: center; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); transition: background 0.3s, border-color 0.3s; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2 { font-size: 1.2em; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9em; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.95em; font-family: inherit; background: var(--card); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.8em; font-weight: 600; }
.badge-verified { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-unverified { background: var(--bg-alt); color: var(--text-muted); }
.badge-amended { background: rgba(251,191,36,0.15); color: #f59e0b; }
.badge-disputed { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-declined { background: var(--danger-bg); color: var(--danger); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 2em; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 0.85em; color: var(--text-muted); }

/* Employment card */
.employment-card { border-left: 4px solid var(--primary); }
.employment-card.verified { border-left-color: var(--success); }
.employment-card.pending { border-left-color: var(--warning); }
.employment-card.declined { border-left-color: var(--danger); }
.employment-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.9em; color: var(--text-muted); margin: 8px 0; }
.employment-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Reference display */
.reference-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.reference-item { text-align: center; padding: 12px; background: var(--bg-alt); border-radius: 8px; }
.reference-item .label { font-size: 0.8em; color: var(--text-muted); }
.reference-item .value { font-weight: 700; font-size: 1.05em; }
.reference-item .value.excellent { color: var(--success); }
.reference-item .value.good { color: var(--primary); }
.reference-item .value.satisfactory { color: var(--warning); }
.reference-item .value.below { color: var(--danger); }

/* Hero */
.hero { text-align: center; padding: 50px 20px 30px; }
.hero h1 { font-size: 2.5em; margin-bottom: 12px; letter-spacing: -1px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.15em; color: var(--text-muted); max-width: 600px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Features */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 30px 0; }
.feature { text-align: center; padding: 24px 20px; }
.feature .icon { font-size: 2.5em; margin-bottom: 10px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: 0.93em; }

/* Demo banner */
.demo-banner { background: var(--bg-alt); border: 2px dashed var(--primary); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; text-align: center; }
.demo-banner .demo-users { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--card); border-radius: var(--radius); padding: 30px; max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal h2 { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* Share view */
.share-header { text-align: center; padding: 30px 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.share-header h1 { font-size: 1.8em; }

/* Verify */
.verify-section { margin-top: 24px; }
.verify-section h3 { margin-bottom: 12px; }
.rating-options { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-options label { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 0.9em; transition: all 0.15s; color: var(--text); }
.rating-options input[type="radio"] { display: none; }
.rating-options label:has(input:checked) { border-color: var(--primary); background: rgba(37,99,235,0.08); }

/* Callout */
.callout { padding: 16px; border-radius: 8px; margin: 16px 0; font-size: 0.95em; }
.callout-info { background: rgba(37,99,235,0.08); border-left: 4px solid var(--primary); }
.callout-warning { background: rgba(245,158,11,0.1); border-left: 4px solid var(--warning); }
.callout-success { background: rgba(22,163,74,0.08); border-left: 4px solid var(--success); }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 14px 24px; border-radius: 8px; color: white; font-weight: 600; z-index: 300; transform: translateY(100px); opacity: 0; transition: all 0.3s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Install banner */
.install-banner { display: none; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 14px 20px; text-align: center; border-radius: var(--radius); margin-bottom: 16px; }
.install-banner.show { display: block; }
.install-banner button { background: white; color: var(--primary); border: none; padding: 8px 20px; border-radius: 6px; font-weight: 700; cursor: pointer; margin-left: 12px; }

/* Wiki styles */
.wiki-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; min-height: calc(100vh - 60px); }
.wiki-sidebar { background: var(--card); border-right: 1px solid var(--border); padding: 20px; border-radius: var(--radius); position: sticky; top: 72px; max-height: calc(100vh - 80px); overflow-y: auto; }
.wiki-sidebar h3 { font-size: 0.8em; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin: 16px 0 8px; }
.wiki-sidebar h3:first-child { margin-top: 0; }
.wiki-sidebar a { display: block; padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--text-muted); font-size: 0.9em; font-weight: 500; margin-bottom: 2px; }
.wiki-sidebar a:hover, .wiki-sidebar a.active { background: rgba(37,99,235,0.08); color: var(--primary); }
.wiki-content { background: var(--card); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); min-height: 400px; }
.wiki-content h1 { font-size: 2em; margin-bottom: 12px; letter-spacing: -0.5px; }
.wiki-content h2 { font-size: 1.4em; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.wiki-content h3 { font-size: 1.1em; margin: 20px 0 8px; }
.wiki-content p { margin-bottom: 12px; }
.wiki-content ul, .wiki-content ol { margin: 8px 0 16px; padding-left: 24px; }
.wiki-content li { margin: 4px 0; }
.wiki-content table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 0.9em; }
.wiki-content th, .wiki-content td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; }
.wiki-content th { background: var(--bg-alt); font-weight: 600; }
.wiki-content blockquote { border-left: 4px solid var(--primary); padding: 14px 18px; background: rgba(37,99,235,0.05); border-radius: 0 8px 8px 0; margin: 16px 0; font-style: italic; }
.wiki-content pre { background: var(--bg-alt); padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; font-size: 0.9em; }
.wiki-content code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.9em; }
.wiki-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.wiki-content .step-flow { display: flex; gap: 0; align-items: center; flex-wrap: wrap; margin: 20px 0; }
.wiki-content .step { background: var(--bg-alt); border-radius: var(--radius); padding: 16px; text-align: center; flex: 1; min-width: 140px; }
.wiki-content .step .step-num { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; background: var(--primary); color: white; border-radius: 50%; font-weight: 700; margin-bottom: 8px; }
.wiki-content .step-arrow { font-size: 1.5em; color: var(--text-muted); padding: 0 8px; }

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

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8em; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  nav { flex-direction: column; gap: 8px; }
  .container, .container-wide { padding: 12px; }
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-sidebar { position: static; max-height: none; }
}

/* PWA fullscreen adjustments */
@media (display-mode: standalone) {
  nav { padding-top: env(safe-area-inset-top, 12px); }
}

/* Gap indicators — neutral, not alarming */
.gap-indicator {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-radius: 8px; margin: 4px 0; font-size: 0.85em;
  background: var(--bg-alt); color: var(--text-muted);
  border-left: 3px solid var(--border);
}
.gap-indicator .gap-icon { font-size: 1em; flex-shrink: 0; }
.gap-indicator .gap-text { flex: 1; }
.gap-indicator .gap-text strong { font-weight: 600; color: var(--text); }

/* Collapsible employment cards */
.emp-collapsed {
  cursor: pointer; transition: all 0.2s;
}
.emp-collapsed:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
[data-theme="dark"] .emp-collapsed:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
.emp-summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap;
}
.emp-summary .emp-dates { font-size: 0.82em; color: var(--text-muted); white-space: nowrap; min-width: 130px; }
.emp-summary .emp-title { flex: 1; min-width: 150px; }
.emp-summary .emp-title h3 { margin: 0; font-size: 0.95em; font-weight: 600; }
.emp-summary .emp-title span { font-size: 0.82em; color: var(--text-muted); }
.emp-summary .emp-stats { font-size: 0.8em; color: var(--text-muted); display: flex; gap: 8px; }
.emp-details { padding: 0 16px 16px; display: none; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
.emp-details.open { display: block; }
.emp-chevron { transition: transform 0.2s; font-size: 0.8em; color: var(--text-muted); }
.emp-chevron.open { transform: rotate(180deg); }
