body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1000px; /* Wider for 2-column images */
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    padding: 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}
.header h2 {
    margin: 0;
    color: #333;
    text-align: center;
}

/* --- Analysis Section --- */
.analysis-section {
    padding: 20px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}
#image-upload {
    width: 100%;
    padding: 10px;
    font-size: 0.9em;
}
.model-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}
.model-checkboxes label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}
#analyze-button {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    font-weight: 600;
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
#analyze-button:disabled {
    background-color: #9ecbff;
    cursor: not-allowed;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007aff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Results Section*/
.results-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}
.image-comparison {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
.image-container {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    overflow: hidden;
}
.image-container h3 {
    margin-top: 0;
    font-size: 1em;
    color: #555;
}
.image-container img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: grab;
}
.image-container img:active {
    cursor: grabbing;
}
.download-buttons {
    display: flex;
    flex-wrap: wrap; /* Added for responsiveness */
    gap: 15px;
    margin-bottom: 20px;
}
.download-buttons button {
    flex: 1;
    min-width: 150px; /* Added for smaller screens */
    padding: 10px;
    font-size: 0.9em;
    font-weight: 500;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.download-buttons button:hover {
    background-color: #e0e0e0;
}

.report-tabs {
    display: flex;
    border-bottom: 1px solid #ccc;
    margin-bottom: 15px;
}
.tab-button {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1em;
    color: #555;
    border-bottom: 3px solid transparent;
}
.tab-button.active {
    color: #007aff;
    font-weight: 600;
    border-bottom-color: #007aff;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.report-text-box {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 15px;
    background-color: #fdfdfd;
    border-radius: 6px;
    line-height: 1.6;
    font-family: monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
}
/* Style for the rendered Markdown in the report tab */
#medical-report-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1em;
    white-space: normal;
}
#medical-report-content h3 { margin-top: 10px; }
#medical-report-content ul { padding-left: 20px; }
#medical-report-content li { margin-bottom: 8px; }
#medical-report-content hr { 
    border: none; 
    border-top: 1px solid #ccc;
    margin: 15px 0;
}


/* Chat Section */
.chat-container {
    height: 500px;
    display: flex;
    flex-direction: column;
}
.chat-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #f9f9f9;
}
.message {
    padding: 12px 18px;
    border-radius: 20px;
    line-height: 1.5;
    max-width: 75%;
    word-wrap: break-word;
}
.message.user {
    background-color: #007aff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message.bot {
    background-color: #eef1f5;
    color: #222;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.message.bot.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #c62828;
}
.message.bot.loading::after {
    content: '...';
    display: inline-block;
    animation: bounce 1s linear infinite;
}
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } }

.input-box {
    display: flex;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}
#user-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 12px 20px;
    font-size: 1em;
    margin-right: 10px;
}
#send-button {
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}
#send-button:disabled {
    background-color: #9ecbff;
    cursor: not-allowed;
}

.error-message {
    color: #c62828;
    background-color: #ffebee;
    border: 1px solid #c62828;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

/* Feedback Modal Styles */
/* .feedback-button {
    background-color: #333; 
    color: white;
}
.feedback-button:hover {
    background-color: #e0e0e0;
} */

.feedback-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-modal.hidden {
    display: none;
}

.feedback-modal-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.feedback-modal-content {
    position: relative;
    background-color: #ffffff;
    margin: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    z-index: 1001;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.feedback-modal-content h3 {
    margin: 0;
    padding: 20px 24px;
    font-size: 1.25em;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}
.feedback-modal-content p {
    padding: 0 24px;
    margin-top: 10px;
    color: #666;
}

#feedback-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.feedback-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box; 
}

.feedback-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 24px;
    background-color: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.modal-button-cancel,
.modal-button-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-button-cancel {
    background-color: #e0e0e0;
    color: #333;
}
.modal-button-cancel:hover {
    background-color: #c7c7c7;
}

.modal-button-submit {
    background-color: #007aff;
    color: white;
}
.modal-button-submit:hover {
    background-color: #0056b3;
}
.modal-button-submit:disabled {
    background-color: #9ecbff;
    cursor: not-allowed;
}

.feedback-status-message {
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    margin-top: 15px;
    display: block;
}
.feedback-status-message.hidden {
    display: none;
}
.feedback-status-message.success {
    background-color: #e6f7ec;
    color: #0d6832;
    border: 1px solid #a6e7c0;
}
.feedback-status-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #c62828;
}