body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #333;
    color: #fff;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    margin-right: auto; /* Pushes other items to the right */
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem; /* Space between language selector and hamburger */
}

.language-selector select {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
}

.hamburger-menu {
    position: relative;
}

.hamburger-icon {
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    color: white;
}

.menu-links {
    display: none;
    position: absolute;
    right: 0;
    top: 100%; /* Position below the icon */
    background-color: #444;
    border: 1px solid #555;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 1000;
    min-width: 150px;
}

.menu-links.show {
    display: block;
}

.menu-links li a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #fff;
}

.menu-links li a:hover {
    background-color: #555;
}

main {
    flex: 1;
    padding: 2rem;
    width: 90%;
    max-width: 900px;
    margin: 20px auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.task-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.task-buttons .btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    text-decoration: none;
    color: white;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    width: 80%;
    max-width: 300px;
}

.task-buttons .btn:hover {
    background-color: #0056b3;
}

.content-form label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.content-form input[type="text"],
.content-form input[type="email"],
.content-form input[type="password"],
.content-form input[type="number"],
.content-form textarea,
.content-form select {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.content-form textarea {
    min-height: 100px;
    resize: vertical;
}

.content-form .btn-submit {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    color: white;
    background-color: #28a745;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.content-form .btn-submit:hover {
    background-color: #1e7e34;
}

.generated-content {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    position: relative;
}

#streaming-output-preview {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

#streaming-output-preview h2, #streaming-output-full h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

#streaming-output-preview h3, #streaming-output-full h3 {
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

#streaming-output-preview p, #streaming-output-full p {
    margin-bottom: 1em;
    line-height: 1.6;
}

#see-more-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
}

#see-more-btn:hover {
    background-color: #0056b3;
}

.test-options div {
    margin-bottom: 0.5rem;
}
.test-options label { /* Minor adjustment for radio button labels */
    display: inline-block;
    margin-left: 0.25rem;
    margin-right: 1rem;
    font-weight: normal;
}

/* Main Form Layout for side-by-side view */
.main-form-container {
    display: flex;
    gap: 2rem;
}

.form-content {
    flex: 1; /* Main form takes up remaining space */
    min-width: 0; /* Prevents overflow in flexbox */
}

/* Advanced Settings - Side Panel on Desktop */
.advanced-settings-container {
    flex-basis: 280px; /* Fixed width for the side panel */
    flex-shrink: 0;
    border-left: 1px solid #eee;
    padding-left: 1.5rem;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    border-top: none;
}

#advanced-settings-toggle {
    background: none;
    border: none;
    color: #333;
    padding: 0;
    width: 100%;
    text-align: left;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    cursor: pointer;
}

#advanced-settings-toggle:hover {
    color: #007bff;
    background-color: transparent;
}

#advanced-settings-toggle .toggle-icon {
    display: inline-block;
    margin-left: 8px;
    transition: transform 0.2s ease-in-out;
}

#advanced-settings-toggle.active .toggle-icon {
    transform: rotate(90deg);
}

#advanced-settings-menu {
    padding: 0;
    border: none;
    background-color: transparent;
    display: none; /* Hidden by default */
}

#advanced-settings-menu.active {
    display: block; /* Shown when toggled */
}

#advanced-settings-menu div {
    margin-bottom: 1rem;
}

#advanced-settings-menu label {
    font-weight: normal;
}

#advanced-settings-menu input[type="range"] {
    width: calc(100% - 40px);
    display: inline-block;
    vertical-align: middle;
}

#temperature-value {
    display: inline-block;
    width: 30px;
    text-align: right;
    font-weight: bold;
}

/* Responsive adjustments for side menu */
@media (max-width: 850px) {
    .main-form-container {
        flex-direction: column;
    }

    .advanced-settings-container {
        flex-basis: auto;
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #eee;
        padding-top: 1.5rem;
    }

    #advanced-settings-toggle {
        border: 1px solid #007bff;
        color: #007bff;
        padding: 0.5rem 1rem;
        border-radius: 5px;
        font-size: 1rem;
        font-weight: normal;
    }

    #advanced-settings-toggle:hover {
        background-color: #f0f8ff;
    }

    #advanced-settings-menu {
        display: none; /* Hidden by default on mobile */
    }

    #advanced-settings-menu.active {
        display: block; /* Shown when toggled */
        padding: 1rem;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
        margin-top: 1rem;
    }
}


footer {
    text-align: center;
    padding: 1rem;
    background-color: #333;
    color: #fff;
    margin-top: auto;
}

/* Added styles for Export and Preview */

/* Export Options Container */
#export-options {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9; /* Light background for the section */
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    text-align: center; /* Center buttons */
}

#export-options button {
    background-color: #007bff; /* Primary button color - consistent with .task-buttons .btn */
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

#export-options button:hover {
    background-color: #0056b3; /* Darker shade on hover - consistent with .task-buttons .btn:hover */
}

#export-options button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Preview Modal */
/* Styles for the outer modal container - id="preview-modal" */
#preview-modal {
    /* display is controlled by JS - none initially */
    /* The following styles were previously inline on the #preview-modal element */
    /* position: fixed; */
    /* z-index: 1000; */
    /* left: 0; */
    /* top: 0; */
    /* width: 100%; */
    /* height: 100%; */
    /* overflow: auto; /* Good for scroll if needed */
    /* align-items: center; */
    /* justify-content: center; */
    /* These are now expected to be handled by JS or default browser behavior for fixed elements */
    /* We will ensure our CSS for background and display behavior is robust */
    background-color: rgba(0,0,0,0.65); /* Slightly darker overlay */
}

/* Styling the inner div of the modal (which currently has inline styles) */
/* This is the direct child div of #preview-modal */
#preview-modal > div {
    /* Replicated inline styles are commented out if directly overridden or accepted */
    /* background-color:white; */ /* Overridden by #fefefe */
    /* padding:20px; */ /* Kept from inline, but can be managed here */
    /* border-radius:5px; */ /* Overridden by 8px */
    /* width:80%; */ /* Kept from inline, can be managed here */
    /* max-width:700px; */ /* Overridden by 750px */
    /* max-height:80%; */ /* Overridden by 85vh */
    /* overflow-y:auto; */ /* Kept from inline, good for scroll */
    /* box-shadow: 0 4px 8px rgba(0,0,0,0.2); */ /* Overridden by more pronounced shadow */

    /* CSS Overrides & Enhancements */
    padding: 20px; /* Ensure padding is defined in CSS */
    width: 80%; /* Ensure width is defined in CSS */
    overflow-y: auto; /* Ensure scroll is defined in CSS */
    background-color: #fefefe;
    border-radius: 8px;
    max-width: 750px;
    max-height: 85vh;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: relative; /* For absolute positioning of the close button */
}

/* Styling the H3 title inside the modal's content div */
#preview-modal > div > h3 {
    margin: 0 0 15px 0;
    font-size: 1.6em;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

/* Styling the close button */
#preview-modal > div > #close-modal {
    /* float:right; /* From inline, avoid with flex, use absolute instead */
    /* cursor:pointer; /* From inline, managed by CSS */
    /* font-size:1.5em; /* From inline, overridden */
    color: #aaa;
    font-size: 28px; /* Larger for better clickability */
    font-weight: bold;
    cursor: pointer; /* Ensure cursor is pointer */
    position: absolute;
    top: 15px;
    right: 20px;
    line-height: 1;
}

#preview-modal > div > #close-modal:hover,
#preview-modal > div > #close-modal:focus {
    color: #000;
    text-decoration: none;
}

/* The actual preview content area */
#preview-content {
    margin-top:10px; /* From inline, kept for spacing */
    flex-grow: 1;
    overflow-y: auto;
    min-height: 250px;
}

#preview-content object,
#preview-content iframe {
    width: 100%;
    min-height: 500px;
    border: 1px solid #ccc;
}

#preview-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border: 1px solid #ddd;
}

/* Tab container styling */
.tab-container {
    width: 100%;
    margin: 0 auto;
}

.tab-buttons {
    display: flex;
    border-bottom: 2px solid #ccc;
    margin-bottom: 20px;
}

.tab-button {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    padding: 10px 20px;
    cursor: pointer;
    margin-right: 5px;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
}

.tab-button.active {
    background-color: #fff;
    border-bottom: 2px solid #fff;
    position: relative;
    top: 2px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Flashed messages */
.flashed-messages {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}