/* Premium Dark Blue/Black Gradient and Gold Theme */
:root {
    /* New Premium Palette */
    --gradient-start: #131528; /* Deep rich blue */
    --gradient-end: black;     /* Black */
    --gold-trim: #f6b232;       /* Gold for lines, borders */
    --text-bright: #ffffff;    /* Bright white text */
    --button-gold: #FFDE9E;    /* Washed out gold for buttons */
    --button-gold-hover: #ffe8b9; /* Lighter gold for hover */
    --button-text: #131528;   /* Dark blue text for buttons for contrast */
    --code-bg: rgba(246, 178, 50, 0.1); /* Subtle gold tint for code */
    --error-color: #ff7b72; /* Keep light red for errors */
    --user-message-bg: rgba(255, 222, 158, 0.2); /* Subtle washed-out gold for user messages */
    --assistant-message-bg: rgba(255, 255, 255, 0.05); /* Very subtle white for assistant messages */
    --link-color: var(--gold-trim); /* Gold links */
    --link-color-hover: var(--button-gold-hover); /* Lighter gold link hover */
    --input-min-height: calc(1.5em + 0.75rem + 2px); /* Base height for 1 row textarea */
    --input-max-height: calc( (1.5em + 0.75rem + 2px) * 3 ); /* Max height for ~3 rows */

    /* Fonts (Keep existing) */
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Reset and Base Styles */
html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: var(--font-sans);
    /* Apply the linear gradient background */
    background: linear-gradient(to bottom, var(--gradient-start), var(--gradient-end));
    background-attachment: fixed; /* Keep gradient fixed during scroll */
    color: var(--text-bright); /* Use bright white text */
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Card holding the chat */
.card {
    /* Use transparent or subtle background to let body gradient show */
    background-color: rgba(0, 0, 0, 0.3); /* Semi-transparent black */
    border: 1px solid var(--gold-trim); /* Gold border */
    flex-grow: 1; /* Allow card to grow */
    display: flex; /* Use flex for card layout */
    flex-direction: column; /* Stack card elements vertically */
    overflow: hidden; /* Prevent card content overflow */
    border-radius: 8px; /* Slightly rounded corners */
}

.card-body {
    padding: 1rem; /* Padding inside card */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden; /* Ensure card body respects boundaries */
}

/* Heading */
h1, .h1, .display-6, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    color: var(--button-gold) !important; /* Use bright white */
    font-weight: 600; /* Slightly less bold than 700 */
    margin-bottom: 1rem !important; /* Ensure spacing below heading */
    text-align: left;
}

/* Specific styling for the AI Assistant heading */
.chat-column h1 {
    font-family: var(--font-mono) !important; /* Use JetBrains Mono */
    font-weight: 700; /* Make it bolder */
    letter-spacing: 0.05em; /* Add slight letter spacing */
}

/* Chat Container */
.chat-container {
    border: none;
    padding: 0 10px;
    overflow-y: auto;
    /* Make background transparent to see body gradient */
    background-color: transparent;
    box-shadow: none;
    margin-bottom: 1rem;
    height: calc(100vh - 220px); /* Example: VP height minus estimated header/input/padding */
}

/* Messages */
.message-container {
    position: relative;
    margin: 10px 0;
    padding: 10px 15px; /* Adjust padding */
    border-radius: 12px; /* More rounded messages */
    max-width: 85%; 
    word-wrap: break-word; 
    line-height: 1.5; /* Slightly increased line height for Inter */
}

.user-message {
    background-color: var(--user-message-bg); /* Use new variable */
    color: var(--text-bright); /* Use bright text */
    margin-left: auto; 
    margin-right: 0;
    box-shadow: none;
    border-radius: 12px 12px 0 12px; /* Custom rounding */
}

.assistant-message {
    background-color: var(--assistant-message-bg); /* Use new variable */
    color: var(--text-bright); /* Use bright text */
    margin-right: auto; 
    margin-left: 0;
    box-shadow: none;
    border-radius: 12px 12px 12px 0; /* Custom rounding */
}

.message {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font-sans); /* Use Inter for message text */
    color: inherit; /* Inherit bright text color */
}

/* Markdown Styles within Messages */
.message p { margin: 0.5em 0; }
.message p:first-child { margin-top: 0; }
.message p:last-child { margin-bottom: 0; }
.message ul, .message ol { padding-left: 25px; margin: 0.5em 0; }
.message li { margin-bottom: 0.2em; }
.message strong, .message b { font-weight: 600; }
.message pre {
    font-family: var(--font-mono); /* Use JetBrains Mono */
    background-color: var(--code-bg); /* Use new code background */
    color: var(--text-bright); /* Use bright text */
    padding: 12px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0.8em 0;
    border: 1px solid var(--gold-trim); /* Gold border */
    font-size: 0.9em; 
}
.message code { /* Inline code */
    font-family: var(--font-mono); /* Use JetBrains Mono */
    font-size: 0.9em;
    background-color: var(--code-bg);
    color: var(--button-gold); /* Washed gold for inline code */
    padding: 0.2em 0.4em;
    border-radius: 4px;
}
.message pre code { /* Reset style for code within pre */
    font-family: var(--font-mono); /* Ensure JetBrains Mono */
    background-color: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    border-radius: 0;
}
.message a {
    color: var(--link-color); /* Gold links */
    text-decoration: underline;
}
.message a:hover {
    color: var(--link-color-hover); /* Lighter gold hover */
    text-decoration: underline; /* Add underline on hover */
}

/* Add hover effect for left panel links */
/* .left-panel a:hover { ... } */

/* Input Area */
.input-group {
    border-top: 1px solid var(--gold-trim); /* Gold border */
    padding-top: 1rem;
    /* Semi-transparent background */
    background-color: rgba(0, 0, 0, 0.3);
}

.form-control {
    font-family: var(--font-sans);
    /* Subtle background, bright text, gold border */
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-bright);
    border: 1px solid var(--gold-trim);
    border-right: none;
    border-radius: 5px 0 0 5px;
}

/* Style the textarea specifically */
#message-input-offcanvas {
    min-height: var(--input-min-height); /* Start at single line height */
    max-height: var(--input-max-height); /* Limit expansion */
    height: var(--input-min-height); /* Initial height */
    overflow-y: auto; /* Add scrollbar when needed */
    resize: none; /* Disable manual resize handle */
    line-height: 1.5; /* Ensure text fits well */
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6); /* Lighter placeholder */
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-bright);
    border-color: var(--button-gold-hover); /* Lighter gold focus border */
    /* Subtle gold shadow */
    box-shadow: 0 0 0 0.2rem rgba(246, 178, 50, 0.25) !important;
    z-index: 3;
}

/* Buttons */
.btn {
    font-family: var(--font-sans); /* Use Inter */
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    font-weight: 600;
}

.btn-primary {
    /* Washed out gold button */
    background-color: var(--button-gold) !important;
    border-color: var(--button-gold) !important;
    color: var(--button-text) !important; /* Dark text for contrast */
    border-radius: 0 5px 5px 0;
}

.btn-primary:hover {
    background-color: var(--button-gold-hover) !important; /* Lighter gold hover */
    border-color: var(--button-gold-hover) !important;
    color: var(--button-text) !important;
}

.btn-secondary {
    /* Subtle background, gold border, gold text */
    background-color: transparent !important;
    border: 1px solid var(--gold-trim) !important;
    color: var(--gold-trim) !important;
}

.btn-secondary:hover {
    background-color: rgba(246, 178, 50, 0.1) !important; /* Subtle gold tint on hover */
    border-color: var(--button-gold-hover) !important; /* Lighter gold border */
    color: var(--button-gold-hover) !important; /* Lighter gold text */
}

.btn:focus,
.btn.focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 0;
    /* Consistent gold shadow */
    box-shadow: 0 0 0 0.2rem rgba(246, 178, 50, 0.25) !important;
}

/* Tool/Status/Error Styles */
.tool-status {
    font-family: var(--font-sans); /* Use Inter */
    font-style: italic;
    color: var(--button-gold); /* Washed gold for status */
    font-size: 0.85em; /* Slightly smaller */
    margin-top: 5px;
    min-height: 1.2em; 
    padding-left: 15px; /* Align with message padding */
}

.error-message {
    font-family: var(--font-sans); /* Use Inter */
    color: var(--error-color); /* Keep error color */
    font-weight: bold;
    margin-top: 5px;
    padding-left: 15px; /* Align with message padding */
}

.tool-button-container { 
    padding: 5px 15px 10px 15px; /* Adjust padding */
    border-bottom: 1px solid var(--gold-trim); /* Gold border */
    margin-bottom: 10px;
    min-height: 35px; 
}

.tool-output-container { 
    margin-top: 10px; 
    padding: 0 15px; /* Add padding */
}

.action-button {
    font-family: var(--font-sans); /* Use Inter */
    position: absolute;
    right: 10px;
    top: 8px; /* Adjust position */
    padding: 3px 7px; /* Smaller padding */
    /* Match secondary button style */
    background-color: transparent;
    border: 1px solid var(--gold-trim);
    color: var(--gold-trim);
    border-radius: 4px;
    font-size: 11px; /* Smaller font */
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 5; /* Ensure it's above message content */
}

.action-button:hover {
    background-color: rgba(246, 178, 50, 0.1);
    border-color: var(--button-gold-hover);
    color: var(--button-gold-hover);
}

.hidden-content {
    font-family: var(--font-mono); /* Use JetBrains Mono for hidden tool output */
    display: none;
    background-color: var(--code-bg); /* Use code background */
    color: var(--text-bright); /* Bright text */
    padding: 10px;
    margin-top: 10px;
    border-radius: 4px;
    white-space: pre-wrap; 
    word-wrap: break-word; 
    line-height: 1.5; 
    border: 1px solid var(--gold-trim); /* Gold border */
    font-size: 0.85em;
}

/* Hide original logo style if class still exists */
.logo-image {
    display: none !important;
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
    width: 10px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent; /* Transparent track */
}

.chat-container::-webkit-scrollbar-thumb {
    background-color: rgba(246, 178, 50, 0.5); /* Semi-transparent gold thumb */
    border-radius: 5px;
    border: 2px solid transparent; /* No border needed */
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--gold-trim); /* Solid gold on hover */
}

/* Styles for Inline Password Prompt */
.password-box-inline {
    /* Semi-transparent background, gold border */
    background-color: rgba(19, 21, 40, 0.8); /* Dark blue with opacity */
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); /* Stronger shadow */
    text-align: center;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--gold-trim);
    /* Remove position: fixed etc. */
}

.password-box-inline h2 {
    color: var(--text-bright); /* Bright white */
    margin-bottom: 1.5rem;
    font-family: var(--font-mono) !important; /* Apply Monospace font */
    font-weight: 700; /* Match AI Assistant heading weight */
    letter-spacing: 0.05em; /* Match AI Assistant letter spacing */
}

.password-box-inline .form-control {
    /* Match main form control */
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-bright);
    border: 1px solid var(--gold-trim);
    border-radius: 5px !important;
    text-align: center;
    margin-bottom: 1rem !important;
}

.password-box-inline .btn-primary {
    /* Match main primary button */
    background-color: var(--button-gold) !important;
    border-color: var(--button-gold) !important;
    color: var(--button-text) !important;
    font-weight: 600;
    border-radius: 5px !important;
}

.password-box-inline .btn-primary:hover {
    background-color: var(--button-gold-hover) !important;
    border-color: var(--button-gold-hover) !important;
}

#password-error {
    min-height: 1.2em; 
    color: var(--error-color); /* Keep error color */
    font-size: 0.9em;
}

/* Style the mobile chat trigger button */
/* .left-panel .btn-primary { ... } */

/* Style the Main Static Content Panel */
.static-content-panel {
    /* Use transparent background to show gradient */
    background-color: transparent;
    color: var(--text-bright);
    height: 100vh;
    overflow-y: auto; /* Allow scrolling */
    position: relative; /* Needed for positioning the button */
    padding: 2rem; /* Add some padding */
    text-align: center; /* Center align text content */
    flex-grow: 1; /* Allow this panel to grow and fill flex space */
}

/* Override heading alignment within the static panel */
.static-content-panel h1,
.static-content-panel h4 {
    text-align: center;
}

/* Center the image within the static panel */
.static-content-panel .img-fluid {
    display: block; /* Ensure it's a block element */
    margin-left: auto;
    margin-right: auto;
}

/* Center the HR and give it a width */
.static-content-panel hr {
    margin-left: auto;
    margin-right: auto;
    width: 75%; /* Adjust width as needed */
}

/* Style the Chat Toggle Button Container */
.chat-toggle-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040; /* Below offcanvas (1045) but above content */
    display: flex;
    align-items: center; /* Vertically align items */
}

/* Style the Chat Toggle Button */
.chat-toggle-button {
    /* Removed position: fixed; properties are now on the container */
    width: 60px; /* Circle size */
    height: 60px;
    padding: 0; /* Remove padding for icon centering */
    font-size: 1.5rem; /* Adjust icon size */
    /* Use gold button style */
    background-color: var(--button-gold) !important;
    border-color: var(--button-gold) !important;
    color: var(--button-text) !important;
    display: flex; /* Center icon */
    align-items: center;
    justify-content: center;
}

.chat-toggle-button:hover {
    background-color: var(--button-gold-hover) !important;
    border-color: var(--button-gold-hover) !important;
}

/* Style the chat info icon */
.chat-info-icon {
    font-size: 1.5rem; /* Match button icon size */
    color: var(--gold-trim); /* Gold color */
    margin-left: 8px; /* Space between button and icon */
    cursor: help; /* Change cursor to indicate help */
    transition: color 0.2s ease-in-out;
}

.chat-info-icon:hover {
    color: var(--button-gold-hover); /* Lighter gold on hover */
}

/* Style the Bootstrap Popover */
.popover {
    background-color: var(--gradient-start); /* Match theme background */
    border: 1px solid var(--gold-trim); /* Gold border */
    color: var(--text-bright); /* Bright text */
    max-width: 300px; /* Adjust max width if needed */
    font-family: var(--font-sans);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5); /* Darker shadow */
}

.popover-header {
    background-color: rgba(0, 0, 0, 0.2); /* Subtle dark header */
    color: var(--text-bright);
    border-bottom: 1px solid var(--gold-trim);
    font-weight: 600;
}

.popover-body {
    color: var(--text-bright); /* Ensure popover text is bright */
    padding: 0.75rem 1rem; /* Adjust padding if needed */
}

/* Popover arrow color */
.popover .popover-arrow::before,
.popover .popover-arrow::after {
    border-left-color: var(--gold-trim) !important; /* Match border color (for placement=left) */
    border-right-color: var(--gold-trim) !important; /* Match border color (for placement=right) */
    border-top-color: var(--gold-trim) !important; /* Match border color (for placement=top) */
    border-bottom-color: var(--gold-trim) !important; /* Match border color (for placement=bottom) */
}

.popover .popover-arrow::after {
    border-left-color: var(--gradient-start) !important; /* Match bg color (for placement=left) */
    border-right-color: var(--gradient-start) !important; /* Match bg color (for placement=right) */
    border-top-color: var(--gradient-start) !important; /* Match bg color (for placement=top) */
    border-bottom-color: var(--gradient-start) !important; /* Match bg color (for placement=bottom) */
}

.popover .popover-arrow {
    display: none;
}

/* Styles for Chat Offcanvas (Keep and Refine) */
.chat-offcanvas {
    /* Gradient background instead of solid */
    background: linear-gradient(to bottom, var(--gradient-start), var(--gradient-end));
    background-attachment: fixed;
    color: var(--text-bright);
    width: 90% !important; 
    max-width: 500px;
    border-left: 1px solid var(--gold-trim); /* Gold border */
}

.chat-offcanvas .offcanvas-header {
    /* Subtle transparent background, gold border bottom */
    background-color: rgba(19, 21, 40, 0.5); /* Semi-transparent dark blue */
    border-bottom: 1px solid var(--gold-trim);
    color: var(--text-bright);
}

.chat-offcanvas .offcanvas-title {
     color: var(--text-bright);
}

.chat-offcanvas .offcanvas-body {
    padding: 0; 
    overflow: hidden; 
}

/* Password prompt styles within offcanvas */
.chat-offcanvas #password-prompt-offcanvas {
    /* Center content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    /* Use same background as main password prompt */
    background-color: rgba(19, 21, 40, 0.8);
    padding: 2rem;
    margin: 1rem; /* Add margin for spacing */
    border: 1px solid var(--gold-trim);
    border-radius: 8px;
}

/* Chat card styles within offcanvas */
.chat-offcanvas #chat-card-offcanvas {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Transparent background to show offcanvas gradient */
    background-color: transparent;
    height: 100%;
    border: none; /* Remove card border within offcanvas */
}

.chat-offcanvas #chat-card-offcanvas .card-body {
    padding: 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: transparent; /* Ensure transparent */
}

/* Ensure chat container within offcanvas scrolls */
.chat-offcanvas #chat-container-offcanvas {
    height: auto;
    min-height: 100px;
    flex-grow: 1;
    overflow-y: auto;
    /* Transparent background */
    background-color: transparent;
    padding: 0 0.5rem;
}

/* Input group styles within offcanvas */
.chat-offcanvas .input-group {
    padding: 0.5rem;
    border-top: 1px solid var(--gold-trim); /* Gold border */
    /* Match main input group background */
    background-color: rgba(0, 0, 0, 0.3);
}

@media (max-width: 767.98px) {
}

@media (min-width: 768px) {
    .offcanvas-end.chat-offcanvas {
        width: 50% !important; /* Adjust width as needed */
        max-width: 700px !important; /* Override base max-width, adjust as needed */
        /* Or remove max-width limit entirely: max-width: none !important; */
    }
}

.hidden {
    display: none !important;
}

.visible {
    display: flex !important; /* Utility class to force flex display */
    flex-direction: column;
    flex-grow: 1;
}

/* Links in static panel */
.static-content-panel a {
    color: var(--link-color); /* Gold links */
    text-decoration: none; /* Optional: remove underline */
}
.static-content-panel a:hover {
    color: var(--link-color-hover); /* Lighter gold hover */
    text-decoration: underline; /* Add underline on hover */
}
.static-content-panel .btn-secondary { /* Ensure CV download button matches theme */
    /* Match secondary button style */
    background-color: transparent !important;
    border: 1px solid var(--gold-trim) !important;
    color: var(--gold-trim) !important;
}
.static-content-panel .btn-secondary:hover {
    background-color: rgba(246, 178, 50, 0.1) !important; /* Subtle gold tint on hover */
    border-color: var(--button-gold-hover) !important; /* Lighter gold border */
    color: var(--button-gold-hover) !important; /* Lighter gold text */
}

/* Lines/Separators */
hr {
    border-top: 1px solid var(--gold-trim) !important; /* Gold horizontal lines */
}
.border-top {
    border-top: 1px solid var(--gold-trim) !important; /* Ensure gold border */
}
.border-secondary { /* Override bootstrap border color if used */
    border-color: var(--gold-trim) !important;
}

@media (max-width: 767.98px) {
    .project-access-note {
        margin-bottom: 60px;
    }
}