/* =========================
   ROOT VARIABLES
========================= */
:root {
    --primary: #1e88e5;
    --primary-dark: #1565c0;
    --secondary: #00b894;
    --danger: #e53935;
    --warning: #f9a825;
    --bg: #f4f7fb;
    --card-bg: #ffffff;
    --text-dark: #1f2933;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 10px 25px rgba(0,0,0,0.08);
    --radius: 14px;
    --radius-sm: 8px;
}

/* =========================
   GLOBAL RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

i {
    color: inherit;
}

/* =========================
   NAVBAR
========================= */
.navbar {
    background: var(--card-bg);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo i {
    color: var(--primary);
    font-size: 22px;
}

.nav-menu a {
    margin: 0 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-menu a.active,
.nav-menu a:hover {
    color: var(--primary);
}

.demo-btn,
.btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn.secondary {
    background: var(--secondary);
}

.btn.danger {
    background: var(--danger);
}

.btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

/* =========================
   HERO SECTION
========================= */
.hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    padding: 70px 8%;
    align-items: center;
}

.hero h2 {
    font-size: 42px;
    margin-bottom: 16px;
}

.highlight {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.hero-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat {
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex: 1;
    text-align: center;
}

.stat i {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 6px;
}

/* =========================
   VAULT DIAGRAM
========================= */
.vault-diagram {
    position: relative;
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.aadhaar-center {
    grid-column: span 2;
    text-align: center;
    font-weight: bold;
    color: var(--primary-dark);
}

.vault {
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    background: #f1f5f9;
}

/* =========================
   SECTIONS
========================= */
section {
    padding: 60px 8%;
}

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

/* =========================
   HOW IT WORKS
========================= */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.step {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.step-number {
    background: var(--primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================
   USE CASES
========================= */
.cases {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.case-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: 0.2s;
}

.case-card:hover {
    transform: translateY(-4px);
}

.case-card i {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--primary);
}

/* =========================
   CONTAINERS
========================= */
.container {
    padding: 40px 8%;
}

/* =========================
   BANNERS & ALERTS
========================= */
.warning-banner,
.welcome-banner {
    background: #fff3cd;
    border-left: 6px solid var(--warning);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    display: flex;
    gap: 14px;
}

/* =========================
   CARDS & GRIDS
========================= */
.access-methods,
.medical-grid,
.vaults-grid,
.forms-grid {
    display: grid;
    gap: 24px;
}

.access-methods {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.method-card,
.info-card,
.vault-card,
.form-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* =========================
   INPUTS
========================= */
input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}

/* =========================
   MODALS
========================= */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 520px;
    border-radius: var(--radius);
    padding: 24px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}

/* =========================
   LOADING
========================= */
.loading-screen {
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 6px solid #ddd;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 14px;
}

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

/* =========================
   FOOTER
========================= */
footer {
    background: #0f172a;
    color: #cbd5e1;
    text-align: center;
    padding: 30px;
    margin-top: 60px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-stats {
        flex-direction: column;
    }

    .nav-menu {
        display: none;
    }
}

/* ====== QR SCANNER MODAL ====== */
.qr-scanner-modal {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.scanner-modal-content {
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.scanner-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    padding: 1.5rem 2rem;
}

.scanner-header .close-btn {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.scanner-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.scanner-body {
    padding: 2rem;
    background: #1a1a2e;
    border-radius: 0 0 20px 20px;
}

.camera-selector {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.camera-selector label {
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.camera-select {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.camera-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.camera-select option {
    background: #1a1a2e;
    color: white;
}

.scanner-view {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: black;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.qr-reader {
    width: 100%;
    height: 100%;
    position: relative;
}

.qr-reader video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scanner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    border: 3px solid rgba(79, 70, 229, 0.8);
    border-radius: 12px;
    box-shadow: 
        0 0 0 1000px rgba(0, 0, 0, 0.7),
        inset 0 0 20px rgba(79, 70, 229, 0.3);
}

.scanner-line {
    position: absolute;
    top: 50%;
    left: 15%;
    width: 70%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
    0% { top: 15%; }
    100% { top: 85%; }
}

.scanner-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
}

.status-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 500;
}

.status-message i {
    color: var(--primary);
    font-size: 1.25rem;
}

.scanner-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Scan Results */
.scan-result {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    animation: fadeIn 0.5s ease;
}

.result-success {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-success i {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 1rem;
    display: block;
}

.result-success h4 {
    color: white;
    margin-bottom: 0.5rem;
}

#scannedData {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    color: white;
    word-break: break-all;
    margin: 1rem 0;
}

/* Error Messages */
.scanner-error {
    background: rgba(220, 38, 38, 0.1);
    border: 2px solid rgba(220, 38, 38, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    animation: fadeIn 0.5s ease;
}

.error-message {
    text-align: center;
    margin-bottom: 1.5rem;
}

.error-message i {
    font-size: 2.5rem;
    color: var(--danger);
    margin-bottom: 1rem;
    display: block;
}

.error-message h4 {
    color: white;
    margin-bottom: 0.5rem;
}

.error-message p {
    color: rgba(255, 255, 255, 0.8);
}

/* Scanner Options */
.option-divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
}

.option-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
}

.option-divider span {
    background: #1a1a2e;
    padding: 0 1rem;
    color: rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 2;
    font-size: 0.875rem;
}

.option-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.scanner-help {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.scanner-help i {
    color: var(--primary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.scanner-help p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Loading Animation */
.scanner-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: white;
}

.scanner-loading .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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