
:root {
    --primary-background: #121212;
    --secondary-background: #1E1E1E;
    --tertiary-background: #242424;
    --primary-text: #E0E0E0;
    --secondary-text: #B0B0B0;
    --accent-color: #64FFDA; /* Light Teal */
    --accent-color-darker: #00BFA5; /* Darker Teal for hover/active */
    --border-color: #2D2D2D;
    --error-color: #FF5252;
    --warning-color: #FFAB40;
    --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--primary-background);
    color: var(--primary-text);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.header {
    background-color: var(--secondary-background);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--accent-color);
}

.navigation {
    display: flex;
    gap: 10px;
}

.nav-link {
    color: var(--secondary-text);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.95rem;
    background: transparent;
    border: none; /* For button consistency */
    cursor: pointer; /* For button element */
    font-family: var(--font-primary); /* Ensure button inherits font */
}

.nav-link:hover, .nav-link:focus {
    color: var(--primary-text);
    background-color: var(--tertiary-background);
    outline: none;
}

/* Sections */
.content-section {
    margin-bottom: 60px;
    padding: 30px;
    background-color: var(--secondary-background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.content-section:last-of-type {
    margin-bottom: 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 30px;
    text-align: center;
}

/* Terminal / Log Display */
.terminal {
    background-color: var(--primary-background); /* Darker than section */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.terminal-header {
    background-color: var(--tertiary-background);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.terminal-title {
    color: var(--secondary-text);
    font-size: 0.9rem;
    font-weight: 500;
}

.terminal-body {
    padding: 15px;
    height: 280px;
    overflow-y: auto;
    font-family: var(--font-monospace);
    font-size: 0.875rem;
    line-height: 1.7;
    color: #B0BEC5; /* Lighter gray for logs */
}

.terminal-body p {
    margin-bottom: 0.6em;
    word-break: break-word;
}
.terminal-body p:last-child {
    margin-bottom: 0;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.card {
    background-color: var(--tertiary-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.card h3 {
    color: var(--primary-text);
    margin-bottom: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--secondary-text);
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Control Buttons (Shared by cards and nav) */
.viz-control {
    background-color: var(--accent-color);
    color: #000; /* Black text for high contrast on light teal */
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: none; /* Or 'capitalize' if preferred */
    letter-spacing: 0;
    font-size: 0.9rem;
    display: inline-block; /* For proper sizing */
    text-align: center;
    width: auto; /* Allow button to size to content */
}

.viz-control:hover, .viz-control:focus {
    background-color: var(--accent-color-darker);
    transform: translateY(-1px);
    outline: none;
    box-shadow: none; /* Remove synthwave glow */
}

.viz-control:disabled {
    background-color: #444;
    color: #888;
    cursor: not-allowed;
    transform: none;
}

/* Specific button on nav needs to be .nav-link.viz-control if it shares styles */
.nav-link.viz-control { /* If a nav item is also a main action button */
    background-color: var(--accent-color);
    color: #000;
}
.nav-link.viz-control:hover, .nav-link.viz-control:focus {
    background-color: var(--accent-color-darker);
    color: #000;
}

/* API Response Area (within cards or modals) */
.api-response-area {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--primary-background); /* Darker than card */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-height: 80px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--secondary-text);
}
.api-response-area h4 {
    color: var(--accent-color);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}
.api-response-area p {
    margin-bottom: 10px;
}
.api-response-area ul {
    list-style-position: inside;
    padding-left: 5px;
    margin-bottom: 10px;
}
.api-response-area li {
    margin-bottom: 8px;
}
.api-response-area a {
    color: var(--accent-color);
    text-decoration: none;
}
.api-response-area a:hover {
    text-decoration: underline;
    color: var(--accent-color-darker);
}

/* Analysis Section */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Adjusted for potentially more content */
    gap: 25px;
}

.analysis-chart, .analysis-feed {
    background-color: var(--tertiary-background);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.analysis-chart h4, .analysis-feed h4 {
    color: var(--primary-text);
    margin-bottom: 20px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
}

#cognitiveLoadChart { /* Ensure canvas is responsive */
    max-width: 100%;
    height: auto;
}

#anomalyFeed {
    list-style: none;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
}

#anomalyFeed li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--secondary-text);
}
#anomalyFeed li:last-child {
    border-bottom: none;
}
.timestamp {
    color: #888;
    margin-right: 10px;
    font-size: 0.85rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--secondary-background);
    font-size: 0.875rem;
    color: var(--secondary-text);
}
.footer p {
    margin-bottom: 8px;
}
.footer p:last-child {
    margin-bottom: 0;
}
#footerStatus, #securityLevel { /* Example, may not be used in new design */
    color: var(--accent-color);
    font-weight: 500;
}

/* Modal Styles */
.modal {
    display: none; /* Initially hidden, JS controls visibility */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    align-items: center; /* Corrected from display:flex here to items-center */
    justify-content: center;
    padding: 20px;
}

/* This rule was duplicated and had 'display:flex', it's better on .modal directly */
/* .modal {
    display: flex; 
    align-items: center;
    justify-content: center;
}*/


.modal-content {
    background-color: var(--secondary-background);
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    animation: modalOpen 0.2s ease-out;
}

@keyframes modalOpen {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close-btn {
    color: var(--secondary-text);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    font-weight: 300;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.modal-close-btn:hover, .modal-close-btn:focus {
    color: var(--primary-text);
    outline: none;
}

#modalTitleGeneric {
    color: var(--primary-text);
    text-align: left; /* Or center, depending on preference */
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

#geminiQueryInput {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    margin-bottom: 20px;
    background-color: var(--primary-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--primary-text);
    font-family: var(--font-primary);
    font-size: 1rem;
    resize: vertical;
}
#geminiQueryInput:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color-darker); /* Use accent color for focus ring, adjusted for better visibility */
}

#submitGeminiQueryBtn { /* For modal submit button */
    display: block; 
    margin: 0 auto 15px auto; 
    width: fit-content; 
}

#geminiQueryOutputArea { /* Within modal */
    margin-top: 20px;
    padding: 15px;
    background-color: var(--primary-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-height: 60px;
    max-height: 250px;
    overflow-y: auto;
}

/* Loading and Error/Warning States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text);
    padding: 20px;
    font-size: 0.95rem;
}

.loading {
    border: 3px solid var(--accent-color-darker); /* Use accent color for loader */
    border-left-color: var(--accent-color);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.error {
    color: var(--error-color);
    font-weight: 500;
}
.warning {
    color: var(--warning-color);
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }
    .container {
        padding: 20px 15px;
    }
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    .navigation {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    .content-section {
        padding: 20px;
        margin-bottom: 40px;
    }
    .card-grid {
        grid-template-columns: 1fr; /* Stack cards */
        gap: 20px;
    }
    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .modal-content {
        padding: 20px;
        margin: 10px; /* Ensure some space from screen edges */
    }
    #modalTitleGeneric {
        font-size: 1.3rem;
    }
    #geminiQueryInput {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }
    .viz-control {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
}