/* Slideout Panel Styles */

.ai-insights-panel {
    position: fixed;
    right: -520px;
    top: 0;
    width: 500px;
    height: 100vh;
    background: oklch(1 0 0);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 10001;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-top: 3px solid #B9F040;
}

.ai-insights-panel.open {
    right: 0;
}

.ai-insights-panel.expanded {
    width: 50vw;
    right: -50vw;
}

.ai-insights-panel.expanded.open {
    right: 0;
}

.ai-insights-header {
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid oklch(0.922 0 0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: oklch(1 0 0);
    gap: 12px;
}

.ai-insights-content {
    flex: 1;
    min-height: 0; /* Required for flex child with overflow to scroll properly */
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 0;
    transition: opacity 0.2s ease;
    position: relative;
}

.slideout-to-top-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.2s ease;
    padding: 0;
    pointer-events: auto;
}

.slideout-to-top-btn:hover {
    background: #f7fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.slideout-to-top-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.slideout-to-top-btn img {
    display: block;
    width: 24px;
    height: 24px;
}

.ai-insights-chat {
    border-top: 1px solid oklch(0.922 0 0);
    padding: 16px;
    background: oklch(0.98 0 0);
    display: none; /* Hidden by default */
}

/* Only show chat input in prompt engineering context */
.ai-insights-panel.prompt-engineering-context .ai-insights-chat {
    display: block;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid oklch(0.85 0 0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(185, 240, 64, 0.1);
}

.chat-send-btn {
    background: var(--brand-color);
    color: var(--bg-black);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    min-width: 44px;
    height: 44px;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn svg {
    display: block;
}

.ai-close-btn {
    background: none;
    border: none;
    color: oklch(0.556 0 0);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-family: 'Lato', sans-serif;
}

.ai-close-btn:hover {
    background: oklch(0.97 0 0);
    color: oklch(0.145 0 0);
}

.slideout-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    width: 28px;
    height: 28px;
}

.slideout-expand-btn:hover {
    background: oklch(0.97 0 0);
}

.slideout-expand-btn img {
    display: block;
    width: 20px;
    height: 20px;
}

.ai-insights-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px; /* Only cover the slideout panel width */
    background: transparent; /* No gradient/backdrop - removed for cleaner UI */
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* Removed opacity transition and background to prevent fade-in effect */
}

.ai-insights-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* When modal is also open, hide slideout overlay to avoid double overlay */
.modal-backdrop.visible ~ .ai-insights-overlay.visible {
    opacity: 0;
    pointer-events: none;
}

/* Responsive adjustments for prompt engineering */
@media (max-width: 768px) {
    .ai-insights-panel {
        width: 100%;
    }
}
