:root {
    --nera-bg: #10141f; /* Dark background */
    --nera-container-bg: #1c2333; /* Slightly lighter for containers */
    --nera-accent: #3375d6; /* Primary accent blue */
    --nera-text: #e1e1e1; /* Light text */
    --nera-text-muted: #8a93a5; /* Muted text for secondary info */
    --user-msg-bg: #3375d6; /* User message background */
    --ai-msg-bg: #2a3952; /* AI message background */
    --border-color: #384257; /* General border/divider color */
}

html {
    overflow-y: auto !important;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--nera-bg);
    color: var(--nera-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px; /* Add some overall body padding */
    box-sizing: border-box;
}

#app {
    width: 100%;
    max-width: 760px; /* Slightly wider for better chat readability */
    height: 90vh;
    min-height: 600px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    background-color: var(--nera-container-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative; /* Added for tooltip positioning context */
}

.nera-header {
    padding: 1rem 1.5rem;
    background-color: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space out title and button */
    gap: 1rem;
}

.nera-header .logo-container {
    display: flex;
    align-items: center;
    flex-grow: 1; /* Allow logo and title to take space */
}

.nera-header .logo {
    height: 30px; /* Adjust as needed for your logo */
    margin-right: 12px;
    /* Potentially add filter: invert(1) if your logo is dark on dark background */
}

.nera-header h1 {
    font-size: 1.6rem; /* Slightly larger title */
    font-weight: 700; /* Bolder */
    color: var(--nera-text);
    letter-spacing: 2px;
    margin: 0; /* Reset default margin */
}

.chat-window {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background-color: var(--nera-container-bg); /* Ensure consistent background */
}

/* --- TOOLTIP STYLES for HTML Table --- */
.preview-tooltip {
    position: fixed; /* Position relative to the viewport */
    z-index: 9999;
    background-color: #2e3440; /* Darker theme for preview */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    padding: 0; /* Remove padding, table will handle it */
    width: 450px; /* Wider for table */
    max-height: 300px; /* Limit height */
    overflow: auto; /* Allow scrolling for large previews */
    pointer-events: none; /* Allows mouse to pass through to elements underneath */
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.preview-tooltip.is-active {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.preview-tooltip .table-container {
    padding: 8px;
}
.preview-tooltip table {
    width: 100%;
    border-collapse: collapse;
}
.preview-tooltip th, .preview-tooltip td {
    padding: 6px 8px;
    border: 1px solid #434c5e;
    text-align: left;
    font-size: 0.8rem;
    color: var(--nera-text);
    white-space: nowrap;
}
.preview-tooltip th {
    background-color: #3b4252;
    font-weight: 500;
}
.preview-tooltip .loading-preview {
    padding: 2rem;
    text-align: center;
    color: var(--nera-text-muted);
}

/* Scrollbar styles */
.chat-window::-webkit-scrollbar, .preview-tooltip::-webkit-scrollbar {
    width: 8px;
}
.chat-window::-webkit-scrollbar-track, .preview-tooltip::-webkit-scrollbar-track {
    background: var(--nera-container-bg);
}
.chat-window::-webkit-scrollbar-thumb, .preview-tooltip::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}
.chat-window::-webkit-scrollbar-thumb:hover, .preview-tooltip::-webkit-scrollbar-thumb:hover {
    background-color: var(--nera-accent);
}

.message {
    background: transparent;
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.message .message-body {
    max-width: 85%;
    padding: 0.9rem 1.2rem;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message.is-user {
    align-items: flex-end;
}

.message.is-user .message-body {
    background-color: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.is-ai {
    align-items: flex-start;
}

.message.is-ai .message-body {
    background-color: var(--ai-msg-bg);
    color: var(--nera-text);
    border-bottom-left-radius: 6px;
}

.message .file-tags {
    margin-top: 0.6rem;
    max-width: 85%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.message.is-user .file-tags {
    justify-content: flex-end;
}

.message.is-ai .file-tags {
    justify-content: flex-start;
}

.file-tags .tag {
    cursor: pointer;
}

.chat-input-form {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.2);
}

.user-details {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-details .control {
    flex-grow: 1;
}

.user-details .input {
    background-color: var(--ai-msg-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--nera-text);
    box-shadow: none;
}
.user-details .input::placeholder {
    color: var(--nera-text-muted);
}


.input-area {
    background-color: var(--ai-msg-bg);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.8rem;
    border: 1px solid transparent;
    transition: border-color 0.2s ease-in-out;
}

.input-area:focus-within {
    border-color: var(--nera-accent);
}

.input-area .file-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.2rem 0.6rem;
}

.file-preview-tags .tags.has-addons .tag:first-child {
    cursor: pointer;
}

.chat-input-form .input {
    background-color: transparent;
    border: none;
    color: var(--nera-text);
    box-shadow: none;
    width: 100%;
    padding: 0.5rem 0.2rem;
    font-size: 0.95rem;
}

.chat-input-form .input::placeholder {
    color: var(--nera-text-muted);
}
.chat-input-form .input:focus {
    outline: none;
}

.button.is-link {
    background-color: var(--nera-accent);
    border-radius: 8px;
}

/* Status Animation */
.status-container {
    padding: 0.5rem 1.5rem;
    text-align: center;
    color: var(--nera-text-muted);
    font-style: italic;
    margin-top: 1rem;
    font-size: 0.9rem;
}
@keyframes fadeInOut {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
.status-message {
    animation: fadeInOut 2s ease-in-out infinite;
}

/* Req 1 (Spacing) & 2 (Centering) */
.graph-container {
    margin-top: 1rem; /* Adds space between AI text and graph card */
    align-self: center; /* Centers the card in the chat window */
    width: 95%;       /* Gives the card a nice width */
    max-width: 600px; /* Prevents it from being too wide */
}

/* Req 4: Card Colors & Styling */
.graph-container .card {
    background-color: var(--ai-msg-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    overflow: hidden; /* Ensures border-radius is respected */
}

/* Req 4 & 5: Card Header Colors & Spacing */
.graph-container .card-header {
    background-color: rgba(0,0,0,0.2); /* Darker header */
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem; /* Req 5: Tighter padding */
    margin: 0;
    /* This overrides inline styles from the last turn */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.graph-container .card-header-title {
    font-size: 0.9rem; /* Smaller title */
    font-weight: 600;
    color: var(--nera-text);
    padding: 0; /* Req 5: Remove extra padding */
}

.graph-container .card-header-icon .button {
    background: transparent;
    border: none;
    color: var(--nera-text-muted);
    font-size: 0.9rem;
}
.graph-container .card-header-icon .button:hover {
    color: var(--nera-text);
    background-color: var(--border-color);
}

/* Req 5: Card Content Padding */
.graph-container .card-content {
    padding: 1rem; /* Default padding for the graph */
}

/* Req 3: Minimized State Styling */
.graph-container .card.is-minimized .card-content {
    padding: 0.75rem 1rem; /* Req 3: Tighter padding when minimized */
}

.graph-container .card.is-minimized .minimized-text {
    font-size: 0.85rem; /* Req 3: Smaller font */
    color: var(--nera-text-muted);
    text-align: center;
    margin: 0; /* Req 3: Remove margins */
}