/* ScreenContextWidget — US-22 screenshot stack UI */

.scw-attach-btn {
    position: relative;
    background: transparent;
    border: none;
    color: #8b949e;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 150ms, color 150ms;
    flex: 0 0 auto;
    margin-right: 2px;
}

.scw-attach-btn:hover {
    background: rgba(99,102,241,0.12);
    color: #a5b4fc;
}

.scw-attach-btn.scw-busy {
    opacity: 0.6;
    cursor: wait;
}

.scw-attach-btn.scw-busy i {
    animation: scw-spin 1s linear infinite;
}

@keyframes scw-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.scw-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.scw-badge.scw-badge-active {
    background: var(--primary, #2563eb);
}

/* Panel above the textarea, inside the input bar (dark-theme friendly, compact) */
.scw-panel {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
}

.scw-panel.scw-panel-open {
    display: flex;
}

.scw-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #8b949e;
    font-weight: 600;
    padding: 0 2px;
}

.scw-panel-head > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.scw-panel-head i {
    font-size: 11px;
}

.scw-count {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(99,102,241,0.18);
    color: #a5b4fc;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.scw-clear-all {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 120ms, color 120ms;
}

.scw-clear-all:hover {
    background: rgba(248,113,113,0.12);
    color: #f87171;
}

.scw-clear-all i {
    margin-right: 3px;
}

.scw-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.scw-chip {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 6px;
    padding: 5px;
    background: #161b22;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    width: 220px;
    flex: 0 0 220px;
}

.scw-chip-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
    flex: 0 0 auto;
    background: rgba(255,255,255,0.04);
}

.scw-chip-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6e7681;
    font-size: 14px;
}

.scw-chip-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-right: 14px;
}

.scw-chip-title {
    font-size: 11px;
    font-weight: 600;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.scw-chip-err {
    padding: 0 5px;
    background: rgba(248,113,113,0.18);
    color: #f87171;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    flex: 0 0 auto;
}

.scw-chip-meta {
    font-size: 10px;
    color: #8b949e;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scw-chip-footer {
    margin-top: auto;
    font-size: 9px;
    color: #6e7681;
}

.scw-chip-x {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    background: transparent;
    border: none;
    color: #6e7681;
    cursor: pointer;
    border-radius: 3px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms, color 120ms;
}

.scw-chip-x:hover {
    background: rgba(248,113,113,0.15);
    color: #f87171;
}

.scw-flash {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    animation: scw-fadein 200ms ease-out;
}

.scw-flash-ok {
    background: #dcfce7;
    color: #166534;
}

.scw-flash-err {
    background: #fee2e2;
    color: #b91c1c;
}

.scw-flash-info {
    background: #e0e7ff;
    color: #3730a3;
}

@keyframes scw-fadein {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
