/* ========================================== */
/* ALBO BUILDER - Chat + Preview Layout       */
/* Lovable-style Finance Software Builder     */
/* ========================================== */

/* Layout: Sidebar | Chat | Preview */
.builder-layout {
    display: flex;
    height: calc(100vh - 130px);
    overflow: hidden;
}

/* ========================================== */
/* SIDEBAR                                    */
/* ========================================== */

.builder-sidebar {
    width: 240px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.builder-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #1e293b;
}

.builder-sidebar-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.builder-new-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.builder-new-btn:hover {
    background: #1d4ed8;
}

.builder-project-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.builder-project-item {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
    margin-bottom: 2px;
}

.builder-project-item:hover {
    background: #1e293b;
}

.builder-project-item.active {
    background: #1e293b;
    border-left: 3px solid #2563eb;
}

.builder-project-name {
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.builder-project-date {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
    display: block;
}

/* ========================================== */
/* MAIN AREA                                  */
/* ========================================== */

.builder-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.builder-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.builder-header-left h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
}

.builder-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: #f0fdf4;
    color: #15803d;
    font-weight: 500;
}

.builder-status.building {
    background: #eff6ff;
    color: #2563eb;
    animation: builder-pulse 1.5s ease-in-out infinite;
}

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

.builder-status.error {
    background: #fef2f2;
    color: #dc2626;
}

.builder-header-actions {
    display: flex;
    gap: 0.5rem;
}

.builder-action-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.builder-action-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.builder-action-btn.active {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

.builder-action-primary {
    background: #2563eb;
    color: #fff !important;
    border-color: #2563eb;
}

.builder-action-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* ========================================== */
/* CONTENT: Chat + Preview nebeneinander      */
/* ========================================== */

.builder-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ========================================== */
/* CHAT PANEL                                 */
/* ========================================== */

.builder-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.builder-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Welcome Screen */
.builder-welcome {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.builder-welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.builder-welcome h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.builder-welcome p {
    color: #6b7280;
    margin-bottom: 2rem;
}

.builder-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.builder-suggestion {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    color: #374151;
    transition: all 0.15s;
}

.builder-suggestion:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

/* Chat Messages */
.builder-msg {
    margin-bottom: 1.25rem;
    display: flex;
    gap: 0.75rem;
}

.builder-msg-user {
    justify-content: flex-end;
}

.builder-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.builder-msg-ai .builder-msg-avatar {
    background: #2563eb;
    color: #fff;
}

.builder-msg-user .builder-msg-avatar {
    background: #e5e7eb;
    color: #374151;
    order: 2;
}

.builder-msg-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.builder-msg-ai .builder-msg-bubble {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    color: #111827;
}

.builder-msg-user .builder-msg-bubble {
    background: #2563eb;
    color: #fff;
}

/* Input Area */
.builder-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    align-items: flex-end;
}

.builder-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    max-height: 120px;
}

.builder-input:focus {
    border-color: #2563eb;
}

.builder-send-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.builder-send-btn:hover {
    background: #1d4ed8;
}

.builder-send-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* ========================================== */
/* PREVIEW PANEL                              */
/* ========================================== */

.builder-preview {
    width: 50%;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.builder-preview-header {
    flex-shrink: 0;
}

.builder-preview-bar {
    background: #1e293b;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.builder-preview-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.builder-preview-dot.red { background: #ef4444; }
.builder-preview-dot.yellow { background: #eab308; }
.builder-preview-dot.green { background: #22c55e; }

.builder-preview-url {
    margin-left: 10px;
    font-size: 0.7rem;
    color: #94a3b8;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.builder-preview-frame {
    flex: 1;
    border: none;
    background: #fff;
    width: 100%;
}

/* ========================================== */
/* RESPONSIVE                                 */
/* ========================================== */

@media (max-width: 1024px) {
    .builder-sidebar {
        width: 200px;
    }

    .builder-preview {
        width: 45%;
    }
}

@media (max-width: 768px) {
    .builder-layout {
        flex-direction: column;
        height: auto;
    }

    .builder-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .builder-preview {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }

    .builder-suggestions {
        grid-template-columns: 1fr;
    }
}
