/* ==========================================
   KELORA AccessiDOC - Core Styles
   ========================================== */

:root {
    /* Colors */
    --bg-main: #0d0c14;
    --surface-card: #13121f;
    --surface-hover: #1a192b;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #7c5cfc;
    --primary-hover: #6a4aef;
    --secondary-accent: #a78bfa;
    
    --text-primary: #f0eeff;
    --text-muted: #8b8aa0;
    --text-faint: #55546a;
    
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 24px rgba(124, 92, 252, 0.15);
    
    /* Badges */
    --badge-critical-bg: rgba(239, 68, 68, 0.15);
    --badge-success-bg: rgba(34, 197, 94, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Accessibility: Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 9999;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* Typography & Layout Utils */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.italic { font-style: italic; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover {
    background-color: rgba(255,255,255,0.05);
}
.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}
.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}
.btn-icon {
    padding: 6px;
    background: rgba(255,255,255,0.1);
    color: white;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   LANDING PAGE SECTIONS
   ========================================== */

/* Header */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 72px;
    background-color: rgba(13, 12, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-mark {
    background-color: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}
.logo-mark.small { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }
.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: white;
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 24px;
}
.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s;
}
.main-nav a:hover { color: white; }
.header-actions { display: flex; gap: 12px; }

/* Hero Section */
.hero-section {
    padding: 160px 0 80px;
    text-align: center;
    background: radial-gradient(circle at top center, rgba(124, 92, 252, 0.15) 0%, transparent 60%);
}
.hero-container {
    max-width: 800px;
}
.badge-pill {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(124, 92, 252, 0.1);
    border: 1px solid rgba(124, 92, 252, 0.3);
    color: var(--secondary-accent);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
}
.hero-title {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.03em;
}
.hero-title span {
    color: var(--primary);
}
.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Features Section */
.features-section { padding: 80px 0; border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.2); }
.section-heading { margin-bottom: 48px; }
.section-heading h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.section-heading p { color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}
.feature-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    transition: transform 0.2s, border-color 0.2s;
}
.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}
.feature-icon {
    width: 48px;
    height: 48px;
    background: rgba(124, 92, 252, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.feature-card h3 { font-size: 18px; margin-bottom: 12px; }
.feature-card p { color: var(--text-muted); font-size: 14px; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 48px 0 24px;
    background: #000;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 48px;
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: white; }
.footer-bottom {
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================
   APP INTERFACE (LIVE LAB)
   ========================================== */
.lab-section { padding: 40px 0 80px; }
.app-interface {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* Tabs */
.inner-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border-color);
}
.inner-tab {
    flex: 1;
    padding: 16px 24px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.inner-tab:hover { color: white; background: rgba(255,255,255,0.02); }
.inner-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(124, 92, 252, 0.05);
}
.tab-content-area { display: none; padding: 32px; }
.tab-content-area.active { display: block; }

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background-color: rgba(0,0,0,0.2);
    transition: all 0.2s;
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background-color: rgba(124, 92, 252, 0.05);
}
.upload-icon { color: var(--primary); margin-bottom: 16px; opacity: 0.8; width: 48px; height: 48px; }
.upload-text { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.upload-sub { font-size: 13px; color: var(--text-muted); }
#pdfFileInput { display: none; }

/* Loading State */
.loading-state { text-align: center; padding: 40px; }
.lucide-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Cards & Tables */
.kpi-card { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; }
.compliance-card { display: flex; align-items: center; justify-content: space-between; }
.kpi-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.filename-text { font-size: 16px; font-weight: 600; color: white; }

.badge { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; }
.badge-critical { background-color: var(--badge-critical-bg); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-success { background-color: var(--badge-success-bg); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }

.table-card { background: var(--bg-main); border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); font-weight: 600; background: rgba(0,0,0,0.2); }
.justify-center { display: flex; justify-content: center; }
.issues-table { width: 100%; border-collapse: collapse; text-align: left; }
.issues-table th { padding: 12px 20px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
.issues-table td { padding: 16px 20px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.code-id { font-family: 'JetBrains Mono', monospace; color: var(--secondary-accent); font-size: 13px; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; color: white; margin-bottom: 8px; }

/* Repair Grid (Tab 2) */
.pdf-repair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.pdf-viewer-card { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden;}
.viewer-container { min-height: 400px; display: flex; align-items: center; justify-content: center; background: #000; padding: 24px; position: relative; flex-grow: 1; }
.viewer-actions { padding: 16px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); }
.pagination-controls { display: flex; align-items: center; gap: 12px; }

/* AI Assistant */
.ai-chat-card { background: var(--bg-main); border: 1px solid var(--primary); border-radius: 12px; padding: 24px; box-shadow: var(--shadow-glow); display: flex; flex-direction: column;}
.ai-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ai-textarea { width: 100%; flex-grow: 1; background: rgba(0,0,0,0.3); border: 1px solid var(--border-color); color: white; padding: 16px; border-radius: 8px; font-size: 14px; outline: none; resize: none; min-height: 200px; font-style: italic; white-space: pre-wrap; }
.ai-actions { display: flex; justify-content: space-between; align-items: center; }

/* ==========================================
   DOCUMENT X-RAY OVERLAYS
   ========================================== */
.xray-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}
.pdf-page-img {
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border-radius: 4px;
}
.xray-overlays {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2;
}
.xray-block {
    position: absolute;
    border: 2px solid var(--primary);
    background-color: rgba(124, 92, 252, 0.15);
    border-radius: 4px;
    pointer-events: auto;
    cursor: crosshair;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.xray-block:hover {
    background-color: rgba(124, 92, 252, 0.4);
    border-color: var(--text-primary);
    z-index: 10;
}
.xray-number {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 2px 0 4px 0;
    position: absolute;
    top: -2px; left: -2px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.xray-type-heading { border-color: var(--warning); background-color: rgba(245, 158, 11, 0.15); }
.xray-type-heading .xray-number { background: var(--warning); }
.xray-type-image { border-color: var(--error); background-color: rgba(239, 68, 68, 0.15); }
.xray-type-image .xray-number { background: var(--error); }

.xray-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #000;
    color: #fff;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 4px;
    pointer-events: none;
    border: 1px solid #333;
    box-shadow: var(--shadow-sm);
    z-index: 20;
}
.xray-block:hover .xray-tooltip { display: block; }

/* --- X-Ray Legend --- */
.xray-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; border: 1px solid; }

.legend-color.type-text { 
    background: rgba(124, 92, 252, 0.15); 
    border-color: var(--primary); 
}
.legend-color.type-heading { 
    background: rgba(245, 158, 11, 0.15); 
    border-color: var(--warning); 
}
.legend-color.type-image { 
    background: rgba(239, 68, 68, 0.15); 
    border-color: var(--error); 
}