/* Add these new styles at the top */
.tab-content {
    margin-top: 20px;
}

/* Override WordPress admin white backgrounds */
.wrap {
    background: transparent !important;
}

.chat-input-section,
.chat-controls,
.echo-container,
.chat-column,
.logs-column {
    background: transparent !important;
}

.tab-pane {
    display: none;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-top: none;
}

.tab-pane.active {
    display: block;
}

/* Existing styles */
.webhook-card {
    max-width: 800px;
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

/* Add these new styles */
#webhook-data-display {
    font-family: monospace;
    font-size: 13px;
    line-height: 1.4;
    margin: 15px 0;
    border-radius: 4px;
    padding: 15px;
    border: 1px solid #ccc;
    max-height: 400px;
    overflow-y: auto;
}

#webhook-data-content {
    margin: 0;
    white-space: pre-wrap;
    font-family: monospace;
}

.webhook-data-section {
    margin-top: 30px;
}

.messages-container {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    background: rgba(128, 128, 128, 0.05);
    border-radius: 8px;
}

.whatsapp-message {
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    clear: both;
}

.whatsapp-message.received {
    float: left;
    background-color: rgba(128, 128, 128, 0.1);
    border: 1px solid rgba(128, 128, 128, 0.1);
    margin-right: auto;
    border-radius: 0 12px 12px 12px;
}

.whatsapp-message.sent {
    float: right;
    background-color: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.2);
    margin-left: auto;
    border-radius: 12px 0 12px 12px;
}

.message-content {
    margin-bottom: 4px;
    color: inherit;
}

.message-meta {
    font-size: 0.75em;
    opacity: 0.7;
    display: flex;
    gap: 8px;
    align-items: center;
}

.message-meta .timestamp {
    color: inherit;
}

.message-meta .phone {
    color: inherit;
    opacity: 0.8;
}

/* Clearfix for message container */
.messages-container::after {
    content: '';
    display: table;
    clear: both;
}

/* Add at the top of the file */
.chat-input-section {
    padding: 15px;
    border: 1px solid #ccd0d4;
    margin-bottom: 20px;
    position: relative;
}

.settings-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.phone-filter-section {
    flex: 0 0 200px;
}

.mode-selector-group {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.phone-select,
.mode-select {
    height: 30px;
    min-width: 150px;
}

.message-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-form textarea {
    flex: 1;
    min-height: 30px;
    max-height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    overflow-y: hidden;
    line-height: 20px;
}

.message-form button,
.mode-selector-group button {
    height: 30px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.message-form button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

#save-response-mode {
    height: 30px;
    padding: 0 10px;
    line-height: 28px;
}

/* Optional: Make the simulate button more compact */
#simulate-message {
    padding: 0 8px;
}

.chat-controls {
    padding: 15px;
    border: 1px solid #ccd0d4;
    margin-bottom: 20px;
}

.controls-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.control-item {
    height: 30px;
    min-height: 30px;
}

.phone-select,
.mode-select {
    min-width: 150px;
}

.message-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.message-form textarea {
    flex: 1;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    overflow-y: hidden;
    line-height: 20px;
}

.message-form button {
    padding: 0 8px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-form button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

#save-response-mode,
#simulate-message {
    white-space: nowrap;
    padding: 0 10px;
}

/* Keep existing message styles */
.messages-container {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    background: rgba(128, 128, 128, 0.05);
    border-radius: 8px;
}

#reset-chat {
    height: 30px;
    padding: 0 10px;
    margin-left: 8px;
}

.message {
    margin: 10px 0;
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    position: relative;
}

.message.user {
    margin-left: auto;
    border: 1px solid #c8e1fb;
    border-bottom-right-radius: 5px;
}

.message.agent {
    margin-right: auto;
    border: 1px solid #ddd;
    border-bottom-left-radius: 5px;
}

.message-meta {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.7;
}

/* Add these styles to the existing .control-item rules */
.simulate-input {
    flex: 1;
    min-width: 150px;
    max-width: 300px;
    height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 8px;
}

.echo-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.chat-column,
.logs-column {
    flex: 1;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    max-width: calc(50% - 15px);
}

.chat-column h2,
.logs-column h2 {
    margin: 0 0 20px 0;
    padding: 0;
    font-size: 1.3em;
    font-weight: 500;
    color: #1d2327;
}

.messages-container,
.ai-logs {
    background: rgba(128, 128, 128, 0.05);
    border-radius: 8px;
    padding: 20px;
    height: 400px;
    overflow-y: auto;
}

.ai-logs {
    font-family: monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* Clear float fix for messages */
.messages-container::after {
    content: '';
    display: table;
    clear: both;
}

.phone-starter {
    display: flex;
    gap: 8px;
    margin-right: 15px;
    border-right: 1px solid #ddd;
    padding-right: 15px;
}

.phone-input {
    width: 150px;
    height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#start-chat {
    height: 30px;
    padding: 0 12px;
    white-space: nowrap;
}

.messages-container,
.ai-logs {
    background: rgba(128, 128, 128, 0.05);
    border-radius: 8px;
    padding: 15px;
    height: 400px;
    overflow-y: auto;
}

.chat-column,
.logs-column {
    flex: 1;
    padding: 15px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    max-width: calc(50% - 15px);
}

.chat-column h2,
.logs-column h2 {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 1.2em;
    font-weight: 500;
    color: #1d2327;
}

.whatsapp-message {
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    clear: both;
}

.message-meta {
    font-size: 11px;
    margin-top: 3px;
    opacity: 0.7;
}

.echo-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}
