body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.ios-style {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 1.5em;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#chat-log {
    height: 400px;
    overflow-y: auto;
    padding: 1.5em;
    background-color: rgb(255 255 255 / 10%);
    backdrop-filter: blur(10px);
}

.chat-message {
    margin-bottom: 15px;
    clear: both;
    overflow: hidden;
}

.sent-message, .received-message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.sent-message {
    float: right;
    background-color: rgb(0 11 185 / 50%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.received-message {
    float: left;
    background-color: rgb(164 164 166 / 50%);
    color: #000;
    border-bottom-left-radius: 4px;
}

.received-code {
    background-color: rgba(240, 240, 240, 0.8);
    border-radius: 8px;
    padding: 10px;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    clear: both;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    max-width: 85%;
}

/* Ensure proper clearing after each message */
.chat-message::after {
    content: "";
    display: table;
    clear: both;
}

#chat-input-area {
    display: flex;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(209, 209, 214, 0.3);
}

#chat-input {
    flex-grow: 1;
    border: 1px solid rgba(209, 209, 214, 0.3);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 16px;
    margin-right: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#send-btn, .ios-button {
    background-color: rgba(76, 0, 153, 0.8);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#send-btn:hover, .ios-button:hover {
    background-color: rgba(76, 0, 153, 1);
}

#task-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(209, 209, 214, 0.3);
}

.ios-button.small {
    font-size: 14px;
    padding: 8px 15px;
}

#task-name-input, #saved-tasks-dropdown {
    border: 1px solid rgba(209, 209, 214, 0.3);
    border-radius: 15px;
    padding: 8px 15px;
    font-size: 14px;
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

#saved-tasks-dropdown {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Scrollbar styling */
#chat-log::-webkit-scrollbar {
    width: 8px;
}

#chat-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

#chat-log::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

#chat-log::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Settings page styles */
.url-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.connection-status.success {
    background-color: #4CAF50;
}

.connection-status.error {
    background-color: #f44336;
}

.connection-status.testing {
    background-color: #FFA500;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.url-input-group input[type="text"] {
    flex: 1;
}

.url-input-group button {
    white-space: nowrap;
}