/* Wonda Playground Styles - Inspired by Wonda Advisor */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#wonda-playground {
    max-width: 1400px;
    margin: 2rem auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.playground-header {
    background: #0F0F2D;
    padding: 1rem 1.8rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title h2 {
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-title p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.2rem;
}

.secondary-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* Main layout */
.playground-main {
    display: flex;
    flex-direction: row;
    height: 550px;
    border-bottom: 1px solid #eef2f8;
}

/* Editors panel */
.editors-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eef2f8;
    background: #fafcff;
}

.editor-tabs {
    display: flex;
    background: #f1f4f9;
    padding: 0.5rem 1rem 0;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    color: #4a5568;
    transition: 0.2s;
}

.tab-btn.active {
    background: white;
    color: #0F0F2D;
    border-bottom: 2px solid #6C44F4;
}

.editor-container {
    flex: 1;
    position: relative;
}

.editor-container .CodeMirror {
    height: 100%;
    font-size: 13px;
}

/* Hide editors by default */
#cssEditor, #jsEditor {
    display: none;
}

/* Preview panel */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.preview-header {
    background: #f8fafd;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #eef2f8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
}

.run-btn {
    background: #0F0F2D;
    border: none;
    color: white;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    font-size: 0.7rem;
    cursor: pointer;
}

#livePreview {
    flex: 1;
    width: 100%;
    border: none;
    background: white;
}

/* AI Assistant */
.ai-assistant {
    border-top: 1px solid #eef2f8;
    background: white;
}

.ai-header {
    background: #f8fafd;
    padding: 0.7rem 1.2rem;
    font-weight: 600;
    color: #0F0F2D;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.toggle-ai {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #6C44F4;
}

.ai-chat-area {
    display: flex;
    flex-direction: column;
    height: 280px;
    transition: 0.2s;
}

.ai-chat-area.collapsed {
    display: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message .avatar {
    width: 32px;
    height: 32px;
    background: #eef2ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-message.user .avatar {
    background: #0F0F2D;
    color: white;
}

.chat-message .bubble {
    max-width: 80%;
    padding: 0.6rem 1rem;
    background: #f1f4f9;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #1a2634;
    border: 1px solid #e4e9f0;
}

.chat-message.user .bubble {
    background: #0F0F2D;
    color: white;
    border: none;
}

.chat-input-area {
    padding: 0.8rem 1rem;
    background: white;
    border-top: 1px solid #eef2f8;
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    padding: 0.6rem;
    font-family: inherit;
    font-size: 0.8rem;
    resize: vertical;
}

#sendChatBtn {
    background: #0F0F2D;
    border: none;
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .playground-main {
        flex-direction: column;
        height: auto;
    }
    .editors-panel {
        height: 350px;
        border-right: none;
        border-bottom: 1px solid #eef2f8;
    }
    .preview-panel {
        height: 350px;
    }
    .ai-chat-area {
        height: 320px;
    }
}
