/* artifact-ui.css (Updated for Mobile PWA) */

.artifact-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: var(--window-bg);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: transform 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.artifact-container.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Desktop view */
@media (min-width: 768px) {
    .artifact-container {
        top: 5%;
        left: auto;
        right: 2%;
        bottom: auto;
        width: 50%;
        max-width: 800px;
        height: 90%;
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        border: 1px solid var(--border-color);
    }
    
    .artifact-container.hidden {
        transform: translateX(120%);
    }
}

.artifact-window {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.artifact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.artifact-title {
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    color: var(--text-color);
}

.artifact-controls {
    display: flex;
    gap: 8px;
}

.copy-artifact-btn, .download-artifact-btn, .close-artifact-btn {
    background: none; border: none; color: var(--text-secondary); cursor: pointer;
    width: 32px; height: 32px; display: flex; align-items: center;
    justify-content: center; border-radius: 6px; transition: all 0.2s ease;
}

.copy-artifact-btn:hover, .download-artifact-btn:hover, .close-artifact-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

.artifact-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-family: var(--font-mono);
    line-height: 1.5;
    position: relative;
    padding-bottom: 64px;
    /* Smooth scroll anchoring */
    overflow-anchor: auto;
}

.artifact-content pre {
    margin: 0;
    border-radius: 8px;
    background: var(--code-bg);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.artifact-content code {
    display: block; padding: 16px; font-family: var(--font-mono);
    font-size: var(--text-sm); overflow-x: auto;
}

.artifact-reference {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 6px; font-size: var(--text-sm); color: var(--text-color);
    cursor: pointer; margin: 4px 0; transition: all 0.2s ease;
}

.artifact-reference:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

.artifact-reference i {
    font-size: 14px;
    color: var(--accent-color);
}

.artifact-content .mermaid {
    background: var(--card-bg); 
    padding: 16px; 
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0 auto; 
    max-width: 100%;
}

.mermaid-artifact-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.mermaid-pan-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: var(--elevated-bg);
    padding: 20px;
    /* Hide scrollbar but maintain functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.mermaid-pan-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.mermaid-pan-container .mermaid {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.mermaid-controls {
    position: absolute; bottom: 16px; right: 16px; display: flex; gap: 8px;
    padding: 8px; background: var(--window-bg); border: 1px solid var(--border-color);
    border-radius: 8px; box-shadow: var(--shadow-md);
}

.zoom-in-btn, .zoom-out-btn, .zoom-reset-btn {
    background: none; border: none; color: var(--text-secondary); cursor: pointer;
    width: 32px; height: 32px; display: flex; align-items: center;
    justify-content: center; border-radius: 6px; transition: all 0.2s ease;
}

.zoom-in-btn:hover, .zoom-out-btn:hover, .zoom-reset-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

.artifact-notification {
    position: fixed; bottom: 24px; right: 24px; padding: 12px 16px;
    border-radius: 8px; background: var(--window-bg); border: 1px solid var(--border-color);
    color: var(--text-color); font-size: 0.9rem; box-shadow: var(--shadow-lg);
    transform: translateY(100%); opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1000;
}

.artifact-notification.show { transform: translateY(0); opacity: 1; }
.artifact-notification.success { border-left: 4px solid var(--success-500); }
.artifact-notification.error { border-left: 4px solid var(--error-500); }
.artifact-notification.info { border-left: 4px solid var(--accent-color); }

/* --- NEW: Terminal Styles --- */
.terminal-output {
    background-color: var(--code-bg);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 8px;
    height: 100%;
}
.terminal-output pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.log-line { display: block; }
.log-command { color: var(--accent-color); font-weight: bold; }
.log-stdout { color: var(--text-color); }
.log-error { color: var(--error-500); }
.log-status { color: var(--text-secondary); font-style: italic; }
.terminal-spinner::after {
    content: '...';
    display: inline-block;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    .artifact-container {
        width: 90%; left: 5%; right: 5%; top: 5%; height: 90%;
    }
}