/* NAC - Northampton County Legal Code Intelligence System
   Main Stylesheet */

:root {
    /* Colors */
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary: #0f766e;
    --secondary-light: #14b8a6;
    --accent: #7c3aed;
    --accent-light: #a78bfa;

    /* Neutrals */
    --bg-dark: #0f172a;
    --bg-medium: #1e293b;
    --bg-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Dimension Colors */
    --dim-fiscal: #3b82f6;
    --dim-governance: #10b981;
    --dim-admin: #f59e0b;
    --dim-extended: #8b5cf6;

    /* UI */
    --border-radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-light);
}

.nav-status {
    display: flex;
    align-items: center;
}

.status-indicator {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-indicator.offline {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-indicator.loading {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.status-indicator.online {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* Main Content */
.main-content {
    padding-top: 64px;
}

/* Hero Section */
.hero {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4rem;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

/* 3D Cube Visual */
.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.dimension-cube {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotateCube 20s infinite linear;
}

@keyframes rotateCube {
    0% { transform: rotateX(-20deg) rotateY(0deg); }
    100% { transform: rotateX(-20deg) rotateY(360deg); }
}

.cube-face {
    position: absolute;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid var(--primary-light);
    background: rgba(30, 64, 175, 0.3);
    backdrop-filter: blur(5px);
}

.cube-face.front { transform: translateZ(100px); }
.cube-face.back { transform: rotateY(180deg) translateZ(100px); }
.cube-face.left { transform: rotateY(-90deg) translateZ(100px); }
.cube-face.right { transform: rotateY(90deg) translateZ(100px); }
.cube-face.top { transform: rotateX(90deg) translateZ(100px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(100px); }

/* Sections */
.section {
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Cards */
.card {
    background: var(--bg-medium);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--bg-light);
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-light);
}

/* Controller Grid */
.controller-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Statutory Duties */
.duties-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.duty-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.duty-item:hover {
    background: var(--bg-light);
}

.section-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.duty-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.duty-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Board Memberships */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.board-item {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.board-role {
    display: inline-block;
    background: var(--secondary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.board-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.board-item p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Independence Visual */
.independence-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 1.5rem;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
}

.branch {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.branch.executive { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.branch.legislative { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.branch.judicial { background: rgba(168, 85, 247, 0.2); color: #a855f7; }

.controller-position {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px solid var(--primary-light);
}

.controller-position span {
    display: block;
    font-weight: 700;
}

.controller-position small {
    font-size: 0.625rem;
    opacity: 0.8;
}

.independence-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Audit Targets */
.targets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.target-group h4 {
    font-size: 0.875rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.target-group ul {
    list-style: none;
}

.target-group li {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--bg-light);
}

/* Modules Grid */
.modules-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dimension-group {
    background: var(--bg-medium);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border-left: 4px solid;
}

.dimension-group.fiscal { border-color: var(--dim-fiscal); }
.dimension-group.governance { border-color: var(--dim-governance); }
.dimension-group.admin { border-color: var(--dim-admin); }
.dimension-group.extended { border-color: var(--dim-extended); }

.dimension-group h3 {
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

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

.module-card {
    background: var(--bg-dark);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    position: relative;
}

.dim-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 50%;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.module-card h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}

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

.explore-btn {
    background: var(--bg-light);
    color: var(--text-primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.explore-btn:hover {
    background: var(--primary);
}

/* AI Assistant */
.ai-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    min-height: 600px;
}

.ai-sidebar {
    background: var(--bg-medium);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-sidebar h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.tool-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary);
}

.tool-btn span {
    font-size: 1.125rem;
}

.quick-lookups {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-lookups select {
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.ai-status-panel {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--bg-light);
}

.ai-status-panel p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.progress-bar {
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-light);
    width: 0%;
    transition: width 0.3s;
}

/* Chat Area */
.ai-main {
    background: var(--bg-medium);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
}

.chat-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 1rem;
}

.chat-message.system .message-content {
    background: var(--bg-dark);
    border-left: 3px solid var(--primary);
}

.chat-message.user .message-content {
    background: var(--primary);
    margin-left: auto;
}

.chat-message.assistant .message-content {
    background: var(--bg-light);
}

.message-content {
    max-width: 80%;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bg-light);
    display: flex;
    gap: 1rem;
}

#chat-input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.875rem;
    resize: none;
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.about-card {
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.about-card h3 {
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.about-card ul {
    list-style: none;
}

.about-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg-light);
}

.about-card a {
    color: var(--primary-light);
}

/* Footer */
.footer {
    background: var(--bg-medium);
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--bg-light);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer a {
    color: var(--primary-light);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-medium);
    border-radius: var(--border-radius);
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem;
    }

    .hero-visual {
        margin-top: 2rem;
    }

    .controller-grid {
        grid-template-columns: 1fr;
    }

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

    .ai-container {
        grid-template-columns: 1fr;
    }

    .ai-sidebar {
        order: 2;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .module-cards {
        grid-template-columns: 1fr;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .boards-grid,
    .targets-grid {
        grid-template-columns: 1fr;
    }
}
