/* Reset and base styles */
body, html {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    overflow: hidden; /* Prevent scrolling when columns are resized */
    overflow-y: auto;
    background-color: var(--background-color); /* This will set the body background color based on the theme */

}

/* Base color variables for light mode */
:root {
    --background-color: #f8f8f8; /* Main background */
    --input-bg: #ffffff; /* White for input background */
    --button-bg: #007bff; /* Blue for buttons */
    --button-text: white; /* White text on buttons */
    --border-color: #e1e7eb; /* Light gray borders */
    --text-color: black; /* Black text color */
    --resizer-bg: #f8f8f8; /* Light gray resizer */
    --spinner-primary: blue; /* Blue spinner */
    --overlay-color: rgba(255, 255, 255, 0.8); /* White overlay with opacity */
    --editor-bg: #ffffff; /* White background for the editor */
    --output-bg: #ffffff; /* White background for the output */
    --list-bg: #ffffff; /* Light background for codeGenerationsList */
    --list-border: #ddd; /* Light border for items */
    --list-text: black; /* Text color for items */
    --list-hover-bg: #e8e8e8; /* Background color for items on hover */
}

/* Dark mode adjustments for subtle contrasts */
[data-theme="dark"] {
    --background-color: #121212; /* Slightly lighter than pure black for background */
    --input-bg: #121212; /* Dark gray background for the input in dark mode */
    --button-bg: #0056b3; /* Darker blue for buttons */
    --button-text: #ddd; /* Light gray text on buttons */
    --border-color: #333333; /* Darker gray borders */
    --text-color: #ddd; /* Light gray text color */
    --resizer-bg: #2c2c2c; /* Subtle contrast for resizer */
    --spinner-primary: lightblue; /* Light blue spinner */
    --overlay-color: rgba(0, 0, 0, 0.7); /* Black overlay with opacity */
    --editor-bg: #121212; /* Dark gray background for the editor */
    --output-bg: #121212; /* Darker gray background for the output for contrast */
    --list-bg: #333; /* Darker background for codeGenerationsList */
    --list-border: #444; /* Darker border for items */
    --list-text: #ddd; /* Light gray text color for items */
    --list-hover-bg: #454545; /* Darker background color for items on hover */
}

/* Styling for the container of the prompt input and generate code button */
.prompt-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: var(--background-color); /* This sets the background for the container */
}

/* Styling for the input and button within the prompt-container */
#codePrompt, #generateCode {
    margin: 0 10px;
}

/* Styling for the input within the prompt-container */
#codePrompt {
    flex-grow: 1;
    padding: 10px;
    font-size: 16px;
    color: var(--text-color);
    background: var(--input-bg); /* White background for the input field */
    border: 2px solid var(--border-color); /* Default border color */
    margin-right: 10px; /* Space between the input and the button */
}

/* Add border styling for the focused input within the prompt-container */
#codePrompt:focus {
    outline: none; /* Removes the default focus outline */
    border: 2px solid #007bff; /* Sets a blue border when the input is active/clicked */
}


#generateCode {
    flex-shrink: 0;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 5px;
}

/* Styling for the container of the code editor and output */
.editor-container {
    display: flex;
    height: calc(100% - 60px);
    background: var(--background-color);
}

/* Styling for the code editor textarea */
.code-editor {
    width: 50%;
    font-family: monospace;
    border: 2px solid var(--border-color); /* Default border color */
    resize: none;
    background: var(--editor-bg);
    color: var(--text-color);
}

/* Add border styling for the focused code editor */
.code-editor:focus {
    outline: none; /* Removes the default focus outline */
    border: 2px solid #007bff; /* Sets a blue border when active/clicked */
}


/* Styling for the code output iframe */
.code-output {
    width: 50%;
    border: 2px solid var(--border-color);
    resize: none;
    background: var(--output-bg);
    color: var(--text-color);
}

/* Styling for the resizer */
.resizer {
    background: var(--resizer-bg);
    width: 2px;
    padding: 0 2px;
    cursor: col-resize;
    user-select: none;
    position: relative;
    z-index: 10;
}

/* Loading indicator, spinner, and error message styles */
.loading-indicator {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-color);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    border-top-color: var(--spinner-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
}

#errorMessage {
    color: red;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Transitions for smooth theme changes */
body, button, #codePrompt, .code-editor, .code-output, .resizer, .loading-indicator {
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

#themeToggle {
    display: inline-block; /* Ensures the container behaves correctly */
    cursor: pointer; /* Indicates clickable */
    vertical-align: middle; /* Aligns the icon and emoji vertically */
}

.attach-button {
    background: none;
    border: 2px solid var(--border-color);
    cursor: pointer;
    padding: 5px;
    margin-right: 5px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, border-color 0.3s;
}

.attach-button img {
    width: 20px;
    height: 20px;
    transition: filter 0.3s;
}

/* Hover and focus styles for the attach button */
.attach-button:hover, .attach-button:focus {
    background-color: var(--button-bg);
    border-color: var(--button-bg);
}

.attach-button:focus img, .attach-button:hover img {
    filter: brightness(0) invert(1); /* Inverts the icon color for better visibility on hover */
}

/* Style adjustments for better alignment and spacing */
.prompt-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--background-color);
}

.file-names {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-color);
    text-align: left;
    padding-left: 20px; /* Align with the input fields above */
    background-color: var(--input-bg); /* Ensures the background matches the input field */
    border: 1px solid var(--border-color); /* Adds a subtle border for visibility */
    padding: 10px;
}

.upload-preview {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: var(--input-bg); /* Background color that adapts to theme */
    padding: 10px;
}


.uploaded-image-preview {
    width: 25px; /* Small preview size */

    margin-right: 10px;
    margin-bottom: 10px;
}

.uploaded-file-name {
    font-size: 14px;
    color: var(--text-color); /* Text color that adapts to theme */
}


/* Styling for the delete icon in light mode */
.delete-upload {
    cursor: pointer;
    font-size: 16px;
    margin-left: 5px; /* Adjust this value as needed for spacing */
    color: #000; /* Black color for light mode */
}

/* Styling for the delete icon in dark mode */
[data-theme='dark'] .delete-upload {
    color: #fff; /* White color for dark mode */
}


/* Hover effect for delete button */
.delete-upload:hover {
    color: var(--button-bg); /* Use the button background color variable for hover effect */
}

#codeGenerationsList {
    max-height: 400px; /* Adjust as needed */
    overflow-y: auto;
    padding: 0;
    list-style-type: none; /* Removes bullet points from list */
    margin: 20px; /* Add some space around the list */
    background: var(--list-bg); /* Dynamic background color based on theme */
    border: 1px solid var(--list-border); /* Dynamic border color */
    border-radius: 4px; /* Optional: rounds the corners of the list container */
    color: var(--list-text); /* Dynamic text color */
}

#codeGenerationsList li {
    padding: 10px; /* Padding for each list item */
    border-bottom: 1px solid var(--list-border); /* Dynamic border color */
}

#codeGenerationsList li:last-child {
    border-bottom: none; /* Removes bottom border from the last item */
}

#codeGenerationsList li:hover {
    background-color: var(--list-hover-bg); /* Dynamic hover background color */
    cursor: pointer;
}

