/* ═════════════ Artifacts (side panel with live preview) ═════════════ */

.artifact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: rgba(var(--green-rgb), 0.05);
    border: 1px solid var(--green-dim);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    margin: 12px 0;
    transition: all 0.15s;
    color: var(--text);
}

.artifact-card:hover {
    border-color: var(--green);
    background: rgba(var(--green-rgb), 0.1);
    transform: translateX(2px);
    box-shadow: 0 0 16px rgba(var(--green-rgb), 0.15);
}

.artifact-card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.artifact-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.artifact-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--green);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artifact-card-meta {
    font-size: 11px;
    color: var(--muted);
    font-family: monospace;
}

.artifact-card-arrow {
    color: var(--green);
    font-size: 20px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: all 0.15s;
}

.artifact-card:hover .artifact-card-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Side panel itself */
.artifact-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 55%;
    min-width: 480px;
    max-width: 900px;
    background: var(--panel);
    border-left: 2px solid var(--green-dim);
    z-index: 4500;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
}

.artifact-panel.open {
    transform: translateX(0);
}

.artifact-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    background: rgba(var(--green-rgb), 0.03);
}

.artifact-panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--green);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.artifact-panel-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.artifact-panel-badge {
    background: var(--green-dim);
    color: #000;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    font-family: monospace;
}

.artifact-panel-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.12s;
}

.artifact-panel-close:hover {
    background: rgba(var(--red-rgb), 0.12);
    color: var(--red);
}

.artifact-panel-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.artifact-tab {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 600;
}

.artifact-tab:hover {
    color: var(--text);
    border-color: var(--green-dim);
}

.artifact-tab.active {
    background: rgba(var(--green-rgb), 0.1);
    color: var(--green);
    border-color: var(--green);
}

.artifact-panel-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: var(--bg);
}

.artifact-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    background: #fff;
    min-height: 500px;
}

.artifact-svg-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 8px;
    min-height: 400px;
}

.artifact-svg-wrap svg {
    max-width: 100%;
    max-height: 70vh;
    height: auto;
}

.artifact-md-preview {
    color: var(--text);
    padding: 20px;
    background: rgba(var(--green-rgb), 0.02);
    border-radius: 8px;
    line-height: 1.6;
}

.artifact-md-preview h1,
.artifact-md-preview h2,
.artifact-md-preview h3 {
    color: var(--green);
    margin-top: 16px;
}

.artifact-code {
    margin: 0;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.55;
    font-family: 'Share Tech Mono', monospace;
    overflow: auto;
    white-space: pre;
    max-height: 100%;
}

.artifact-unsupported {
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

.artifact-panel-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    background: rgba(var(--green-rgb), 0.03);
    flex-shrink: 0;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .artifact-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
        border-left: none;
    }
}

@media (max-width: 560px) {
    .artifact-panel-header {
        padding: 12px 14px;
    }
    .artifact-panel-tabs {
        padding: 8px 14px;
    }
    .artifact-panel-body {
        padding: 12px;
    }
    .artifact-panel-actions {
        padding: 10px 14px;
    }
}

