/* ============================================
   FlickZZ Builder — AI Plugin Maker Styles
   ============================================ */

.builder-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + var(--ann-offset) + 3rem) 1.5rem 4rem;
}

.builder-hero { text-align: center; margin-bottom: 3rem; }
.builder-hero-badge {
    display: inline-flex; align-items: center; gap: .5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.15));
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: .5rem 1.2rem; border-radius: 999px;
    font-size: .9rem; font-weight: 600; margin-bottom: 1.5rem;
}
.builder-hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.builder-hero p { color: var(--text-muted); max-width: 680px; margin: 1rem auto 0; font-size: 1.05rem; }

.builder-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: 620px;
}

/* Chat Panel */
.chat-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}
.chat-header i { color: var(--primary); margin-right: .5rem; }

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 480px;
    min-height: 400px;
}

.chat-msg {
    display: flex;
    gap: .75rem;
    animation: msgFadeIn .3s ease;
}
@keyframes msgFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.chat-msg.user { flex-direction: row-reverse; }
.chat-msg .msg-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 1rem;
}
.chat-msg.user .msg-avatar { background: rgba(34, 197, 94, 0.15); color: #22c55e; }

.chat-msg .msg-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .85rem 1.1rem;
    font-size: .92rem;
    line-height: 1.6;
    max-width: 82%;
    word-wrap: break-word;
    color: var(--text);
}
.chat-msg.user .msg-content { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.2); }
.chat-msg .msg-content p { margin: 0 0 .5rem; }
.chat-msg .msg-content p:last-child { margin-bottom: 0; }
.chat-msg .msg-content ul { margin: .5rem 0 .5rem 1.2rem; padding: 0; }
.chat-msg .msg-content li { margin-bottom: .3rem; font-size: .88rem; color: var(--text-muted); }
.chat-msg .msg-content code {
    background: var(--bg-hover);
    padding: .1rem .4rem; border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .85em;
    color: var(--accent);
}

.chat-input-area {
    display: flex;
    gap: .6rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}
.chat-input-area textarea {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .75rem 1rem;
    color: var(--text);
    font-family: inherit;
    font-size: .92rem;
    resize: none;
    transition: var(--transition);
}
.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.btn-send {
    width: 48px; height: 48px; border-radius: 10px;
    background: var(--primary); color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}
.btn-send:hover { background: var(--primary-dark); transform: scale(1.05); }
.btn-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Preview Panel */
.preview-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}
.preview-header i { color: var(--primary); margin-right: .5rem; }
.btn-copy {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); }

.code-preview {
    flex: 1;
    background: #0b0b12;
    padding: 1.5rem;
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .8rem;
    color: #c9d1e3;
    overflow: auto;
    max-height: 600px;
    min-height: 500px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}
[data-theme="light"] .code-preview { background: #f6f7fb; color: #1e293b; }

/* Responsive */
@media (max-width: 968px) {
    .builder-workspace { grid-template-columns: 1fr; }
    .chat-messages { max-height: 350px; min-height: 300px; }
    .code-preview { max-height: 400px; min-height: 300px; }
}
@media (max-width: 560px) {
    .builder-main { padding-left: 1rem; padding-right: 1rem; }
    .chat-msg .msg-content { max-width: 90%; }
    .chat-input-area { padding: .75rem 1rem; }
    .code-preview { font-size: .72rem; padding: 1rem; }
}
