/* === Arc Platform — AI Chat Widget === */
/* FAB (Floating Action Button — minimized state) */
.pdl-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    cursor: pointer;
    z-index: 900;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pdl-chat-fab:hover {
    transform: scale(1.06);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(249,114,22,0.18);
    color: var(--primary-dark);
}
.pdl-chat-fab svg {
    width: 22px;
    height: 22px;
    transition: transform 0.3s ease;
}
.pdl-chat-fab.open svg {
    transform: rotate(90deg);
}

/* Expanded Panel */
.pdl-chat-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 380px;
    height: 500px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border-light);
    z-index: 900;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}
.pdl-chat-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Panel Header */
.pdl-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #0f172a;
    color: #fff;
    flex-shrink: 0;
}
.pdl-chat-header-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pdl-chat-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #F97216;
    flex-shrink: 0;
}
.pdl-chat-header-actions {
    display: flex;
    gap: 6px;
}
.pdl-chat-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.pdl-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Context Bar */
.pdl-chat-context {
    padding: 8px 18px;
    background: var(--primary-light);
    font-size: 12px;
    color: var(--primary-dark);
    font-weight: 500;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pdl-chat-context-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
    flex-shrink: 0;
}

/* Messages Area */
.pdl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pdl-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
}
.pdl-chat-msg.user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.pdl-chat-msg.assistant {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}
.pdl-chat-msg.error {
    align-self: center;
    background: var(--red-light);
    color: var(--red-dark);
    font-size: 12px;
    text-align: center;
    max-width: 90%;
}

/* Markdown in assistant messages */
.pdl-chat-msg.assistant strong { font-weight: 600; }
.pdl-chat-msg.assistant em { font-style: italic; }
.pdl-chat-pre {
    background: #f1f5f9;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    overflow-x: auto;
    margin: 4px 0;
    white-space: pre-wrap;
}
.pdl-chat-code {
    background: #f1f5f9;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.pdl-chat-list {
    list-style: disc;
    padding-left: 20px;
    margin: 4px 0;
}
.pdl-chat-list li {
    margin: 2px 0;
}

/* Typing Indicator */
.pdl-chat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
    align-self: flex-start;
}
.pdl-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pdlChatBounce 1.4s infinite ease-in-out;
}
.pdl-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.pdl-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pdlChatBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Input Area */
.pdl-chat-input-area {
    padding: 12px 14px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: var(--surface);
}
.pdl-chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    min-height: 38px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s;
    overflow-y: auto;
}
.pdl-chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249,114,22,0.08);
}
.pdl-chat-input::placeholder { color: var(--text-muted); }
.pdl-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.pdl-chat-send-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(249,114,22,0.25);
}
.pdl-chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pdl-chat-send-btn svg { width: 16px; height: 16px; }

/* Welcome State */
.pdl-chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    gap: 12px;
}
.pdl-chat-welcome-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.pdl-chat-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
}
.pdl-chat-welcome h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.pdl-chat-welcome p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}
.pdl-chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
}
.pdl-chat-suggestion {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
}
.pdl-chat-suggestion:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* No API Key State */
.pdl-chat-no-key {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    gap: 12px;
}
.pdl-chat-no-key p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}
.pdl-chat-no-key button {
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.pdl-chat-no-key button:hover {
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ─── MOBILE RESPONSIVE ──────────────────────────────────── */
@media (max-width: 768px) {
    .pdl-chat-msg { max-width: 92%; word-break: break-word; }
    .pdl-chat-messages { padding: 12px 14px; }
    .pdl-chat-input-area { padding: 10px 12px; }
    .pdl-chat-welcome { padding: 16px; }
    .pdl-chat-pre { font-size: 11px; }
}

