.selected-message-html {
    background: #f5f5f5;
    border: 1px solid #b2dfdb;
    border-radius: 6px;
    padding: 10px;
    font-size: 1.05em;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.35em;
    word-break: break-word;
    white-space: pre-line;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', 'Courier New', monospace;
}
h2#selectedMessageTitle {
    font-size: 1.1em;
    color: #00796b;
    margin-top: 10px;
    margin-bottom: 10px;
}

.selected-message-divider {
    border: none;
    border-top: 2px solid #b2dfdb;
    margin: 0 0 16px 0;
}

.selected-message-row {
    margin-bottom: 12px;
}
h2#selectedMessageTitle {
    font-size: 1.1em;
    color: #00796b;
    margin-top: 10px;
    margin-bottom: 10px;
}
/* --- Disabled Button --- */
.button-disabled {
    background-color: #cccccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
}
/* --- General Styles --- */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
}

.container {
    max-width: 80%;
    margin: 50px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #444;
}

h2 {
    margin-top: 20px;
    color: #333;
}

ul, #messageList {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* --- Form Styles --- */
form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

label {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

input, textarea {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    max-width: 100%;
}

textarea {
    resize: none;
    height: 100px;
}

button {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background-color: #0056b3;
}


/* Make .primary and all filter buttons match the main blue style */
.primary,
.filters button,
button[type="submit"] {
    background-color: #007bff;
    color: white;
}
.primary:hover,
.filters button:hover,
button[type="submit"]:hover {
    background-color: #0056b3;
}

/* --- Top Bar --- */
.top-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#toggleFormButton, #toggleApiSettingsButton {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#toggleFormButton:hover, #toggleApiSettingsButton:hover {
    background-color: #0056b3;
}

/* --- Main Layout --- */
.main-content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.left-column.hidden {
    display: none;
}

/* --- API Settings & Form Containers --- */
.api-settings-container, .form-container {
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #f4f4f4;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.api-settings-container pre, #apiSettings pre {
    background-color: #e9ecef;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 14px;
    color: #333;
}

/* --- Message List & Row --- */
.message-list-container {
    flex: 1 1 0;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    transition: max-width 0.3s, width 0.3s;
}

#messageList li, .message-row {
    padding: 10px;
    border-bottom: 1px solid #ccc;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: block;
}

.message-row-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-container {
    flex: 0 0 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.message-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.message-details {
    display: flex;
    align-items: center;
    gap: 24px;
}

.message-details strong {
    min-width: 90px;
    display: inline-block;
}

.message-details em {
    color: #666;
    font-style: normal;
}

.message-text {
    font-size: 1.0em;
    line-height: 1.35em;
    color: #333;
    margin-top: 7px;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', 'Courier New', monospace;
}

/* --- Selected Row --- */
.selected {
    background-color: #95c8f5 !important;
    border-left: 4px solid #007bff;
}

/* --- Filters & Pagination --- */
.filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.filters label {
    font-size: 14px;
    font-weight: bold;
}

.filters input[type="date"], .filters input[type="text"] {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.filters input[type="date"] {
    width: 150px;
}

.filters input[type="text"] {
    flex-grow: 1;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.page-size-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

#pagination button {
    padding: 10px 20px;
    margin: 0 5px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#pagination button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#pagination span {
    font-size: 16px;
    margin: 0 10px;
}

/* --- Select All & Delete Selected --- */
.select-all-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* --- Selected Message --- */
.selected-message-container {
    max-width: 500px;
    min-width: 280px;
    width: 22vw;
    flex: 1;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: max-width 0.3s, width 0.3s;
}

.selected-message-container h2 {
    margin-top: 0;
    max-width: 500px;
    overflow-wrap: break-word;
}

#selectedMessageDetails p {
    margin: 10px 0;
}

/* --- Responsive Adjustments when Left Column is Hidden --- */
.left-column.hidden ~ .message-list-container {
    max-width: 1100px;
}

.left-column.hidden ~ .selected-message-container {
    max-width: 500px;
    width: 25vw;
}

/* --- Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    width: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}