/* ── Game Integration ── */

/* Status indicator badges */
.gi-status-active {
    color: var(--success-color);
}
.gi-status-inactive {
    color: var(--text-muted);
}

/* Mapping editor toolbar */
.gi-mapping-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.gi-mapping-toolbar select {
    flex: 0 0 auto;
    max-width: 200px;
}

/* Mapping list */
.gi-mappings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Single mapping row — collapsible item (matches composite-layer-item) */
.gi-mapping-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary, var(--bg-color));
}

/* Header — always visible summary */
.gi-mapping-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.gi-mapping-expand-btn {
    font-size: 0.6rem;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
}
.gi-mapping-expanded .gi-mapping-expand-btn {
    transform: rotate(90deg);
}

.gi-mapping-summary {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.gi-mapping-summary-event {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gi-mapping-summary-effect {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.gi-mapping-summary-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Collapsible body — CSS grid transition (matches composite-layer) */
.gi-mapping-body-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.2s ease;
}
.gi-mapping-expanded .gi-mapping-body-wrapper {
    grid-template-rows: 1fr;
}

.gi-mapping-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 0;
    overflow: hidden;
    min-height: 0;
    transition: padding-top 0.2s ease;
    font-size: 0.85rem;
}
.gi-mapping-expanded .gi-mapping-body {
    padding-top: 8px;
}

/* Field rows inside body */
.gi-mapping-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.gi-mapping-field-row label {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 70px;
    flex-shrink: 0;
}
.gi-mapping-field-row select,
.gi-mapping-field-row input[type="text"],
.gi-mapping-field-row input[type="number"] {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: inherit;
}
.gi-mapping-field-row input[type="range"] {
    flex: 1;
    min-width: 0;
}
.gi-mapping-field-row input[type="color"] {
    width: 40px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

/* Setup instructions pre block */
.gi-instructions-pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-family: var(--font-mono, monospace);
    font-size: 0.85em;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Live event feed */
.gi-event-feed {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    background: var(--bg-secondary);
    font-size: 0.85em;
}
.gi-event-waiting {
    color: var(--text-muted);
    text-align: center;
    padding: 16px;
}
.gi-event-item {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
}
.gi-event-item:last-child {
    border-bottom: none;
}
.gi-event-time {
    color: var(--text-muted);
    flex-shrink: 0;
}
.gi-event-type {
    color: var(--primary-text-color);
    font-weight: 600;
}
.gi-event-value {
    color: var(--text-secondary);
}

/* Connection test panel */
.gi-test-panel {
    margin-top: 8px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.gi-test-waiting {
    color: var(--warning-color);
}
.gi-test-success {
    color: var(--success-color);
}
.gi-test-error {
    color: var(--danger-color);
}
.gi-test-timeout {
    color: var(--text-muted);
}

/* Responsive mapping rows */
@media (max-width: 768px) {
    .gi-mapping-field-row {
        flex-direction: column;
        align-items: stretch;
    }
    .gi-mapping-field-row label {
        min-width: unset;
    }
}
