/* 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, .deploy-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, .deploy-artifact-btn:hover, .close-artifact-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

.deploy-artifact-btn {
    display: none;
    color: var(--accent-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%;
    }
}

.deploy-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.deploy-preview-modal.hidden {
    display: none;
}

.deploy-preview-dialog {
    width: min(900px, 100%);
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--window-bg);
    display: flex;
    flex-direction: column;
}

.deploy-preview-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deploy-preview-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.deploy-preview-title {
    font-weight: var(--font-semibold);
}

.deploy-preview-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.deploy-preview-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.deploy-preview-meta {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    display: grid;
    gap: 4px;
}

.deploy-preview-tree {
    overflow: auto;
    padding: 12px 16px;
    flex: 1;
}

.deploy-editor-list {
    display: grid;
    gap: 8px;
}

.deploy-editor-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--card-bg);
}

.deploy-editor-path {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--window-bg);
    color: var(--text-color);
    padding: 7px 9px;
    font-size: 13px;
}

.deploy-editor-type {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.deploy-editor-tree {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: var(--card-bg);
    max-height: 220px;
    overflow: auto;
}

.deploy-tree-list {
    list-style: none;
    margin: 0;
    padding-left: 16px;
}

.deploy-tree-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    margin: 3px 0;
    font-size: 13px;
}

.deploy-preview-actions {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.deploy-preview-cancel,
.deploy-preview-confirm {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    color: var(--text-color);
}

.deploy-preview-confirm {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}
