/*
 * Prompter Hawk live-demo bundle -- agent panel styles (Umbra theme)
 * ==================================================================
 * Extracted from the production stylesheet (static/css/dashboard.css),
 * Umbra (default) theme only. Every rule is scoped under `.ph-demo` so the
 * bundle can be embedded in a host page (the landing site) without its
 * base `body` / `button` / `.task-item` rules leaking into the host.
 *
 * Fonts: the production dashboard ships Iosevka Custom woff2 files. Bundling
 * them would blow the 150KB budget and add external file deps, so we fall
 * back to the monospace stack. A host that already loads 'Iosevka Custom'
 * will pick it up automatically (see README).
 */

/* ---- Seti UI design tokens (Umbra), scoped to the demo container ---- */
.ph-demo {
    --seti-black: #0e1112;
    --seti-black-dark: #090b0d;
    --seti-white: #ffffff;
    --seti-grey: #6b7b80;
    --seti-grey-dark: #2d3438;
    --seti-grey-light: #e0e4e6;
    --seti-blue: #519aba;
    --seti-cyan: #00d4d4;
    --seti-green: #8dc149;
    --seti-orange: #e37933;
    --seti-pink: #f55385;
    --seti-purple: #a074c4;
    --seti-red: #cc3e44;
    --seti-steel: #8aa4b3;
    --seti-yellow: #cbcb41;
    --seti-border: #1a1d1f;

    font-family: 'Iosevka Custom', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--seti-black);
    color: #ffffff;
    box-sizing: border-box;
    /* Layout: agent panels in a responsive row */
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    align-items: stretch;
}

.ph-demo *,
.ph-demo *::before,
.ph-demo *::after {
    box-sizing: border-box;
}

/* Hidden offscreen texture generator canvases created by MarbleGenerator */
.marble-canvas {
    display: none;
}

/* ---- 1. Agent column + state ---- */
.ph-demo .agent-column {
    flex: 1 1 250px;
    width: 250px;
    min-width: 200px;
    max-width: 350px;
    border: 3px solid transparent;
    padding: 8px;
    background: var(--seti-black-dark);
    background-clip: padding-box;
    border-radius: 3px;
    box-sizing: border-box;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: opacity 0.2s, transform 0.2s;
}

/* Remove the transparent border when working to prevent doubling */
.ph-demo .agent-column.working {
    border: none;
    padding: 13px;
}

.ph-demo .agent-column > * {
    position: relative;
    z-index: 2;
}

.ph-demo .agent-column.inactive {
    background: var(--seti-black);
    border-color: var(--seti-grey);
}

.ph-demo .agent-column.inactive .agent-header {
    opacity: 0.5;
}

.ph-demo .agent-column.inactive h4,
.ph-demo .agent-column.inactive .agent-status-section,
.ph-demo .agent-column.inactive .agent-task-queue,
.ph-demo .agent-column.inactive .agent-completed-queue,
.ph-demo .agent-column.inactive .current-task-idle {
    opacity: 0.5;
}

/* Fixed-height sections don't compress */
.ph-demo .agent-column .agent-header,
.ph-demo .agent-column .agent-status-section,
.ph-demo .agent-column .controls,
.ph-demo .agent-column h4 {
    flex-shrink: 0;
}

.ph-demo .agent-column [id^="current-task-"] {
    flex-shrink: 0;
    min-height: 80px;
}

.ph-demo .agent-column .current-task-card,
.ph-demo .agent-column .current-task-idle {
    min-height: 70px;
}

.ph-demo .agent-column .current-task-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.4em;
    line-height: 1.2;
}

.ph-demo .agent-column .agent-task-queue {
    flex: 2 1 80px;
    min-height: 0;
    overflow-y: auto;
}

.ph-demo .agent-column .agent-completed-queue {
    flex: 2 1 100px;
    min-height: 0;
    overflow-y: auto;
}

.ph-demo .agent-column .agent-task-queue:empty,
.ph-demo .agent-column .agent-completed-queue:empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ph-demo .agent-column .agent-task-queue::-webkit-scrollbar,
.ph-demo .agent-column .agent-completed-queue::-webkit-scrollbar {
    width: 4px;
}

.ph-demo .agent-column .agent-task-queue::-webkit-scrollbar-thumb,
.ph-demo .agent-column .agent-completed-queue::-webkit-scrollbar-thumb {
    background: var(--seti-grey);
    border-radius: 2px;
}

.ph-demo .agent-column .agent-task-queue::-webkit-scrollbar-track,
.ph-demo .agent-column .agent-completed-queue::-webkit-scrollbar-track {
    background: transparent;
}

/* ---- 2. Agent header ---- */
.ph-demo .agent-header {
    padding: 6px 8px;
    margin: -10px -10px 8px -10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 16.5px;
    cursor: move;
    user-select: none;
    border-radius: 3px 3px 0 0;
    position: relative;
    overflow: hidden;
}

.ph-demo .agent-column.working .agent-header > *:not(.anim-header-canvas):not(.anim-header-border-canvas) {
    position: relative;
    z-index: 1;
}

.ph-demo .agent-column.working .agent-header {
    border-bottom: none !important;
}

/* ---- 3. Perlin canvas layers (positioning + masking) ---- */
.ph-demo .agent-column .anim-border-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
    display: none;
    object-fit: cover;
    -webkit-mask:
        linear-gradient(#fff 0 0),
        linear-gradient(#fff 0 0) 5px 5px / calc(100% - 10px) calc(100% - 10px) no-repeat;
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0),
        linear-gradient(#fff 0 0) 5px 5px / calc(100% - 10px) calc(100% - 10px) no-repeat;
    mask-composite: exclude;
    transform: translateZ(0);
    backface-visibility: hidden;
    image-rendering: auto;
}

.ph-demo .agent-column.working .anim-border-canvas {
    display: block;
}

.ph-demo .agent-column .anim-header-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    display: none;
    opacity: 0.3;
    object-fit: cover;
    transform: translateZ(0);
    backface-visibility: hidden;
    image-rendering: auto;
}

.ph-demo .agent-column.working .anim-header-canvas {
    display: block;
}

.ph-demo .agent-column .anim-header-border-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    pointer-events: none;
    z-index: 1;
    display: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    image-rendering: auto;
}

.ph-demo .agent-column.working .anim-header-border-canvas {
    display: block;
}

/* Current-task border canvas */
.ph-demo .agent-column .anim-task-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 3px;
    pointer-events: none;
    z-index: 0;
    display: none;
    opacity: 0.8;
    object-fit: cover;
    -webkit-mask:
        linear-gradient(#fff 0 0),
        linear-gradient(#fff 0 0) 1px 1px / calc(100% - 2px) calc(100% - 2px) no-repeat;
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0),
        linear-gradient(#fff 0 0) 1px 1px / calc(100% - 2px) calc(100% - 2px) no-repeat;
    mask-composite: exclude;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    image-rendering: auto;
}

.ph-demo .agent-column.working .anim-task-canvas {
    display: block;
}

.ph-demo .agent-column.working [id^="current-task-"] > div {
    position: relative;
    border: 1px solid transparent !important;
    background-clip: padding-box;
}

.ph-demo .agent-column.working [id^="current-task-"] > div > *:not(.anim-task-canvas) {
    position: relative;
    z-index: 1;
}

.ph-demo .agent-column.working .controls button > * {
    position: relative;
    z-index: 1;
}

/* ---- 4. Agent status ("Stats") section ---- */
.ph-demo .agent-status-section {
    background: var(--seti-black);
    border: 1px solid var(--seti-grey-dark);
    border-radius: 3px;
    padding: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: height 0.2s ease, background-color 0.2s ease;
}

.ph-demo .agent-status-section.collapsed {
    height: 64px;
    overflow: hidden;
}

.ph-demo .agent-status-section .agent-status-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 18px;
}

.ph-demo .agent-status-section .collapse-indicator {
    color: var(--seti-grey-light);
    font-size: 13px;
}

.ph-demo .agent-status-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--seti-grey-dark);
}

.ph-demo .agent-status-row:last-child {
    border-bottom: none;
}

.ph-demo .agent-status-label {
    color: var(--seti-grey-light);
    font-size: 13px;
}

.ph-demo .agent-status-value {
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    margin-right: 40px;
}

/* ---- 5. Controls + buttons ---- */
.ph-demo .controls {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.ph-demo .controls.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ph-demo .controls.controls-grid button {
    min-width: unset;
    width: 100%;
    font-size: 13px;
    padding: 6px 8px;
}

.ph-demo button {
    background: var(--seti-black);
    color: #ffffff;
    border: 1px solid var(--seti-grey-dark);
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Iosevka Custom', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    margin: 0;
    border-radius: 3px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 14px;
    flex: 1 1 auto;
    min-width: 90px;
    text-align: center;
}

.ph-demo button:hover {
    background: var(--seti-grey-dark);
    border-color: var(--seti-grey);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ---- 6. Section headings ---- */
.ph-demo h4 {
    color: #ffffff;
    font-weight: normal;
    font-size: 16px;
    margin: 0;
}

.ph-demo .agent-column h4 {
    margin-top: 8px;
    font-size: 14px;
    margin-bottom: 5px;
}

/* ---- 7. Current-task card / idle ---- */
.ph-demo .current-task-name {
    font-weight: bold;
    color: #ffffff;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ---- 8. Task queues ---- */
.ph-demo .agent-task-queue {
    border: 1px solid var(--seti-border);
    padding: 5px;
    margin-bottom: 10px;
    background: var(--seti-black);
    border-radius: 3px;
}

.ph-demo .agent-task-queue .task-item {
    gap: 1px 4px;
    margin-bottom: 3px;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    border-left: 3px solid var(--seti-grey-dark);
}

.ph-demo .agent-task-queue .task-item .task-name {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 2px;
    word-wrap: break-word;
}

.ph-demo .agent-task-queue .task-item .task-meta {
    font-size: 11px;
    color: var(--seti-grey-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ph-demo .agent-task-queue .task-item .task-meta-row {
    font-size: 11px;
    margin-top: 2px;
}

.ph-demo .agent-task-queue .task-item .task-indicator {
    padding: 0px 3px;
    font-size: 9px;
}

.ph-demo .agent-completed-queue .task-item {
    padding: 3px 5px;
}

.ph-demo .agent-completed-queue .task-item .task-name {
    font-size: 13.6px;
    color: #d0d0d0;
}

.ph-demo .agent-completed-queue .task-item.cancelled .task-name {
    color: #999;
}

.ph-demo .agent-completed-queue .task-item .task-meta {
    display: none;
}

.ph-demo .agent-completed-queue .task-item:hover {
    transform: none;
}

.ph-demo .agent-completed-queue .task-item.task-read .task-name {
    font-weight: normal;
    color: #888;
}

.ph-demo .agent-completed-queue .task-item:not(.task-read) .task-name {
    font-weight: bold;
}

.ph-demo .agent-task-queue .task-item.task-read .task-name {
    font-weight: normal;
    color: #999;
}

/* ---- 9. Task item base + status modifiers ---- */
.ph-demo .task-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 2px 8px;
    background: var(--seti-black);
    border: 1px solid var(--seti-border);
    padding: 12px;
    margin-bottom: 8px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.ph-demo .task-item > .task-name {
    grid-column: 1 / -1;
}

.ph-demo .task-item > .task-meta-row {
    grid-column: 1 / -1;
}

.ph-demo .task-item > .task-deps {
    grid-column: 1 / -1;
}

.ph-demo .task-item:hover {
    border-color: var(--seti-grey);
    background: var(--seti-grey-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.ph-demo .task-item.pending { border-left-width: 4px; }

.ph-demo .task-item.in-progress {
    border-left-width: 4px;
    border-left-color: #6bb6ff;
    background: rgba(107, 182, 255, 0.1);
}

.ph-demo .task-item.scheduled {
    border-left-width: 4px;
    border-left-color: var(--seti-blue);
    background: rgba(107, 182, 255, 0.05);
}

.ph-demo .task-item.completed {
    border-left-width: 4px;
    border-left-color: var(--seti-green);
}

.ph-demo .task-item.cancelled {
    border-left-width: 4px;
    border-left-color: #666 !important;
    opacity: 0.7;
}

/* ---- 10. Task name / meta / indicators ---- */
.ph-demo .task-name {
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 4px;
    word-wrap: break-word;
    line-height: 1.2;
}

.ph-demo .task-cancelled-label {
    font-weight: normal;
    font-size: 10px;
    color: #999;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ph-demo .task-meta {
    color: #ffffff;
    font-size: 16px;
    margin-top: 8px;
}

.ph-demo .task-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--seti-grey-light);
}

.ph-demo .task-meta-row .task-meta {
    flex: 1;
    min-width: 0;
    margin-top: 0;
    font-size: inherit;
}

.ph-demo .task-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.ph-demo .task-indicator.priority {
    background: var(--seti-orange);
    color: white;
}

.ph-demo .task-indicator.feedback {
    background: var(--seti-purple);
    color: white;
}

.ph-demo .task-deps {
    color: var(--seti-grey-light);
    font-size: 11px;
}

.ph-demo .task-duration-info {
    color: var(--seti-grey-light);
}

/* ---- 11. Reduced-motion: freeze all transitions ---- */
@media (prefers-reduced-motion: reduce) {
    .ph-demo *,
    .ph-demo *::before,
    .ph-demo *::after {
        transition: none !important;
        animation: none !important;
    }
}
