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

.app-wrapper {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 300px;
    background-color: #fff;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8em;
    color: #0056b3;
    text-align: center;
}

.main-content {
    flex-grow: 1;
    padding: 25px;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.main-content .main-title {
    color: #0056b3;
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 2.5em;
}

h1, h2 {
    color: #0056b3;
    text-align: center;
    margin-bottom: 20px;
}

.config-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.character-config {
    background-color: #e9f5ff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #cceeff;
}

.character-config h2 {
    font-size: 1.3em;
    margin-top: 0;
    margin-bottom: 15px;
}

.character-config label,
.sidebar-section label,
.chat-input-area label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.character-config input[type="text"],
.character-config textarea,
.sidebar-section textarea,
.sidebar-section select,
.chat-input-area textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    resize: vertical;
    min-height: 40px;
    box-sizing: border-box;
}

textarea {
    min-height: 80px;
}

.sidebar-section {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    flex-grow: 1;
}

#startResumeButton {
    background-color: #28a745; /* Green */
}
#startResumeButton:hover:not(:disabled) {
    background-color: #218838;
}

#pauseButton {
    background-color: #ffc107; /* Amber */
    color: #212529;
}
#pauseButton:hover:not(:disabled) {
    background-color: #e0a800;
}

button:hover:not(:disabled) {
    background-color: #0056b3;
}

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

.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-mode-toggle button {
    width: 100%;
}

.conversation-display {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    flex-grow: 1;
}

#chatLog p {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 5px;
    line-height: 1.5;
    word-wrap: break-word;
}

#chatLog .message.char1 {
    background-color: #e0f7fa;
    text-align: left;
    margin-right: 20%;
    border-left: 5px solid #00bcd4;
}

#chatLog .message.char2 {
    background-color: #fff3e0;
    text-align: right;
    margin-left: 20%;
    border-right: 5px solid #ff9800;
}

#chatLog .message.user {
    background-color: #e6ffe6;
    text-align: center;
    font-style: italic;
    color: #4CAF50;
    margin: 10px auto;
    max-width: 70%;
    border-radius: 20px;
}

.chat-input-area {
    display: flex;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    gap: 10px;
    align-items: center;
}

.chat-input-area textarea {
    flex-grow: 1;
    margin-bottom: 0;
    min-height: 40px;
    max-height: 100px;
    padding: 8px 12px;
}

.chat-input-area button {
    flex-shrink: 0;
    width: auto;
    padding: 10px 15px;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #2c2c2c;
    color: #f0f0f0;
}

body.dark-mode .sidebar,
body.dark-mode .main-content,
body.dark-mode .conversation-display,
body.dark-mode .chat-input-area {
    background-color: #3a3a3a;
    border-color: #555;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .main-title {
    color: #f0f0f0;
}

body.dark-mode h1,
body.dark-mode h2 {
    color: #f0f0f0;
}

body.dark-mode .character-config {
    background-color: #2f2f2f;
    border-color: #666;
}

body.dark-mode .character-config label,
body.dark-mode .sidebar-section label,
body.dark-mode .chat-input-area label {
    color: #f0f0f0;
}

body.dark-mode input[type="text"],
body.dark-mode textarea,
body.dark-mode select {
    background-color: #555;
    color: #f0f0f0;
    border-color: #777;
}

body.dark-mode button {
    background-color: #5d9cec;
}

body.dark-mode #startResumeButton {
    background-color: #28a745;
}
body.dark-mode #startResumeButton:hover:not(:disabled) {
    background-color: #218838;
}

body.dark-mode #pauseButton {
    background-color: #ffc107;
    color: #212529;
}
body.dark-mode #pauseButton:hover:not(:disabled) {
    background-color: #e0a800;
}

body.dark-mode button:hover:not(:disabled) {
    background-color: #4a8ad9;
}

body.dark-mode button:disabled {
    background-color: #666;
}

body.dark-mode .sidebar-section {
    background-color: #2f2f2f;
    border-color: #555;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode #chatLog .message.char1 {
    background-color: #4d6067;
    border-left-color: #00bcd4;
}

body.dark-mode #chatLog .message.char2 {
    background-color: #675d4d;
    border-right-color: #ff9800;
}

body.dark-mode #chatLog .message.user {
    background-color: #4d674d;
    color: #8bc34a;
}