/**
 * ODE Meet Stage Panel Styles
 * ponytail: center position, split view, keep last state visible
 */

/* Main stage panel — centered */
.stage-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 900px;
    max-height: 70vh;
    background: var(--surface-elevated, #1a1a2e);
    border: 1px solid var(--border-subtle, #333);
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.stage-panel.active {
    display: flex;
}

.stage-panel.minimized {
    top: auto;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 300px;
    max-height: 48px;
}

.stage-panel.minimized .stage-content {
    display: none;
}

/* Header */
.stage-panel .stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface-sunken, rgba(0,0,0,0.3));
    border-bottom: 1px solid var(--border-subtle, #333);
}

.stage-panel .stage-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary, #fff);
}

.stage-panel .stage-minimize {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.stage-panel .stage-minimize:hover {
    background: var(--surface-hover, rgba(255,255,255,0.1));
    color: var(--text-primary, #fff);
}

/* Content area — split view for multiple agents */
.stage-panel .stage-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--border-subtle, #333);
    overflow: auto;
    min-height: 200px;
}

/* Individual agent stage slot */
.stage-slot {
    flex: 1 1 calc(50% - 1px);
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background: var(--surface-elevated, #1a1a2e);
}

.stage-slot.stage-inactive {
    opacity: 0.6;
}

.stage-slot.stage-inactive::after {
    content: 'Inactive';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 4px 12px;
    background: var(--warning-muted, rgba(234, 179, 8, 0.2));
    color: var(--warning, #eab308);
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
}

.stage-slot-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-sunken, rgba(0,0,0,0.2));
    border-bottom: 1px solid var(--border-subtle, #333);
}

.stage-slot-header .agent-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--accent, #6366f1);
}

.stage-slot-header .stage-slot-title {
    font-size: 12px;
    color: var(--text-secondary, #888);
}

/* Stage content area */
.stage-slot-content {
    flex: 1;
    padding: 8px;
    overflow: auto;
    min-height: 150px;
}

/* Terminal styling */
.stage-slot-content[data-type="terminal"] {
    padding: 0;
    background: #1a1a2e;
}

.stage-slot-content[data-type="terminal"] .xterm {
    padding: 8px;
}

/* Screenshot styling */
.stage-screenshot {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* JSON/structured styling */
.stage-json {
    margin: 0;
    padding: 12px;
    background: var(--surface-sunken, rgba(0,0,0,0.2));
    border-radius: 6px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12px;
    color: var(--text-primary, #e0e0e0);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Light mode */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .stage-panel {
        background: #fff;
        border-color: #e5e7eb;
        box-shadow: 0 16px 64px rgba(0, 0, 0, 0.15);
    }

    :root:not([data-theme="dark"]) .stage-panel .stage-header,
    :root:not([data-theme="dark"]) .stage-slot-header {
        background: #f9fafb;
        border-color: #e5e7eb;
    }

    :root:not([data-theme="dark"]) .stage-slot {
        background: #fff;
    }

    :root:not([data-theme="dark"]) .stage-panel .stage-content {
        background: #e5e7eb;
    }
}

:root[data-theme="light"] .stage-panel {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .stage-panel .stage-header,
:root[data-theme="light"] .stage-slot-header {
    background: #f9fafb;
    border-color: #e5e7eb;
}

:root[data-theme="light"] .stage-slot {
    background: #fff;
}

:root[data-theme="light"] .stage-panel .stage-content {
    background: #e5e7eb;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .stage-panel {
        width: 95%;
        max-height: 60vh;
    }

    .stage-slot {
        flex: 1 1 100%;
        min-width: 100%;
    }
}
