/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container, .chat-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 25px 30px; /* Added more horizontal padding */
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1, h4 {
    color: #0056b3;
    text-align: center;
    margin-top: 0; /* Removed default margin */
    margin-bottom: 25px;
}

/* Chat Box Styles */
.chat-box {
    height: 400px; /* Default height */
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
    background-color: #f1f3f5;
    border-radius: 8px;
    scroll-behavior: smooth; /* Smooth scrolling */
}

.message {
    padding: 12px 18px;
    margin: 12px 5px; /* Adjusted margin */
    border-radius: 18px; /* More rounded */
    max-width: 85%; /* Slightly wider */
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    clear: both; /* Ensure messages don't overlap weirdly */
    position: relative; /* For potential future elements like timestamps */
}

.user-message {
    background-color: #cce5ff;
    color: #004085;
    margin-left: auto;
    float: right; /* Align right using float */
    border-bottom-right-radius: 5px;
}

.assistant-message {
    background-color: #e9ecef;
    color: #343a40;
    margin-right: auto;
    float: left; /* Align left using float */
    border-bottom-left-radius: 5px;
}

/* Clearfix for floats in chatbox */
.chat-box::after {
    content: "";
    display: table;
    clear: both;
}


/* Input Area Styles */
.input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px; /* Adjusted padding */
    border: 1px solid #ced4da;
    border-radius: 20px;
    font-size: 1rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
input[type="text"]:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
input[type="text"]:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Button Styles */
button {
    padding: 10px 20px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500; /* Slightly bolder */
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.1s ease;
    white-space: nowrap;
}

button:hover:not(:disabled) {
    background-color: #0056b3;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px); /* Subtle lift effect */
}

button:active:not(:disabled) {
    transform: translateY(0px); /* Press effect */
}


button:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap; /* Allow buttons to wrap on small screens */
}

.submit-btn { /* Specific class for main action button if needed */
    background-color: #28a745; /* Green color */
}
.submit-btn:hover:not(:disabled) {
    background-color: #218838;
}


/* Analysis & Response Sections */
.analysis-container,
.response-section {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #d6d8db;
    background-color: #f8f9fa;
    border-radius: 8px;
}
.analysis-container h4,
.response-section h4 {
    margin-top: 0;
    color: #17a2b8;
    text-align: left; /* Align header left */
    margin-bottom: 15px;
}
.analysis-container p,
.response-section p {
     margin-bottom: 10px;
}
.analysis-container b,
.response-section strong {
     color: #0056b3;
     font-weight: 600;
}
.analysis-container small {
    color: #6c757d;
    display: block;
    margin-top: 10px;
}

/* Diagnosis Page Specifics */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}
.form-group textarea, .form-group select {
    width: 100%; /* Makes it take full container width */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    min-height: 80px;
}
.form-group textarea:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}


.file-list {
    border: 1px solid #ccc;
    padding: 10px;
    margin-top: 10px;
    height: 180px; /* Slightly taller maybe */
    overflow-y: auto;
    background-color: #f9f9f9;
    border-radius: 5px;
}
.file-item {
    padding: 8px 10px; /* More padding */
    display: flex;
    /* justify-content: space-between; */ /* Let label grow */
    align-items: center;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem; /* Adjust overall size */
    gap: 10px; /* Add gap between checkbox, label, button */
}
.file-item:last-child {
    border-bottom: none;
}

.file-item input[type="checkbox"] {
    margin-right: 0; /* Remove default margin if using gap */
    flex-shrink: 0; /* Prevent checkbox shrinking */
    cursor: pointer;
}

/* Style the label to contain the info spans */
.file-item label {
    margin-bottom: 0;
    margin-left: 0; /* Remove default margin if using gap */
    flex-grow: 1;
    cursor: pointer;
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column; /* Stack info vertically */
    gap: 2px; /* Small gap between info lines */
    line-height: 1.3; /* Adjust line height */
}

/* Style the spans within the label */
.file-item label span {
    display: block; /* Ensure each span takes its own line */
}
.file-item label .file-conv-id {
    font-weight: 600; /* Make ID bold */
    color: #333;
}
.file-item label .file-user-id {
    color: #555;
}
.file-item label .file-date {
    color: #777;
    font-size: 0.85em; /* Make date slightly smaller */
}


.file-item:last-child {
    border-bottom: none;
}

.file-item label { /* Style checkbox label if needed */
    margin-bottom: 0; /* Override form-group label style */
    margin-left: 5px;
    flex-grow: 1; /* Allow label to take space */
    cursor: pointer;
}
.file-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.file-item button { /* Style download button */
    padding: 4px 10px; /* Slightly larger */
    font-size: 0.85rem;
    border-radius: 15px; /* Pill shape */
    background-color: #6c757d;
    flex-shrink: 0; /* Prevent shrinking */
    margin-left: 10px; /* Space between name and button */
}
.file-item button:hover:not(:disabled){
    background-color: #5a6268;
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
    font-size: 1rem;
}

html-output {
    background-color: #f8f9fa; /* Or any other background */
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    font-size: 1em; /* Adjust as needed */
    line-height: 1.6;
}

.html-output h1, .html-output h2, .html-output h3, .html-output h4, .html-output h5, .html-output h6 {
    color: #0056b3; /* Example color for headers within LLM output */
    margin-top: 1.2em;
    margin-bottom: 0.6em;
}
.html-output h4 { /* More specific if needed */
    font-size: 1.2rem;
}


.html-output p {
    margin-bottom: 1em;
}

.html-output ul, .html-output ol {
    margin-left: 20px; /* Indent lists */
    margin-bottom: 1em;
}

.html-output li {
    margin-bottom: 0.5em;
}

.html-output strong {
    font-weight: bold;
    color: #333; /* Or your preferred color for strong text */
}

.html-output em {
    font-style: italic;
    color: #555; /* Or your preferred color for emphasized text */
}


/* Link Container */
.link-container {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px; /* Add space above */
    border-top: 1px solid #eee; /* Separator line */
}
.link-container button {
    background-color: #6c757d; /* Grey color for navigation */
}
.link-container button:hover:not(:disabled) {
    background-color: #5a6268;
}

.response-section {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #d6d8db;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Style for the formatted report container */
#formatted-report-container {
    margin-bottom: 20px; /* Space below formatted report */
}
#formatted-report-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #6c757d; /* Different color for this heading */
    font-size: 1.1rem;
}
#formatted-report-content { /* Styling for the <pre> tag */
    white-space: pre-wrap;       /* Allow wrapping */
    word-wrap: break-word;     /* Break long words */
    background-color: #e9ecef; /* Light background */
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em; /* Slightly smaller font */
    max-height: 400px; /* Limit height and add scroll if needed */
    overflow-y: auto;
}

/* Style for the final diagnosis container */
#final-diagnosis-container h4 {
     margin-top: 0;
     margin-bottom: 10px;
     color: #17a2b8; /* Original color for final diagnosis */
     font-size: 1.1rem;
}




.json-output {
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    max-height: 600px; /* Adjust as needed */
    overflow: auto; /* Scroll for large JSON */
}

/* Add styling for the new team name input if desired */
#teamName {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px; /* Space below input */
    border: 1px solid #ced4da;
    border-radius: 5px;
    box-sizing: border-box;
}

.text-output { /* For general recommendation */
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f8f9fa; /* Slightly different background or same as container */
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Regular text font */
    font-size: 1em;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}


.analysis-list-checkbox-container {
    border: 1px solid #ccc;
    padding: 10px;
    margin-top: 10px;
    max-height: 250px; /* Or desired height */
    overflow-y: auto;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.analysis-item-checkbox {
    display: flex;
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px solid #eee;
}
.analysis-item-checkbox:last-child {
    border-bottom: none;
}
.analysis-item-checkbox input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}
.analysis-item-checkbox label {
    cursor: pointer;
    flex-grow: 1;
    font-size: 0.9rem;
}

/* Styling for individual diagnosis result blocks */
#diagnosisResultOutput {
    margin-top: 20px;
}

.diagnosis-result-item {
    background-color: #fff; /* White background for each item */
    border: 1px solid #dee2e6;
    padding: 15px;
    margin-bottom: 20px; /* Space between items */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.diagnosis-result-item h4 {
    color: #0056b3; /* Consistent header color */
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-bottom: 1px solid #eee; /* Separator below title */
    padding-bottom: 8px;
}
.diagnosis-result-item .json-output { /* Style for the <pre> tag within each item */
    max-height: 400px; /* Limit height if needed */
}


/* Style for the download button per analysis item */
button.download-analysis-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
    background-color: #6c757d; /* A neutral grey */
    color: white;
    border-radius: 15px; /* Pill shape */
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent button from shrinking */
    margin-left: auto; /* Pushes button to the right if label doesn't fill space */
}
button.download-analysis-btn:hover:not(:disabled) {
    background-color: #5a6268;
}
button.download-analysis-btn:disabled {
    background-color: #adb5bd;
    opacity: 0.7;
}