/* ============================================================
   KSS ClawAgent Live Demo – Component Styles
   ============================================================ */

.kss__clawagent-live-demo {
    --cld-bg:          #0f172a;
    --cld-surface:     #1e293b;
    --cld-border:      rgba(255,255,255,.08);
    --cld-text:        #e2e8f0;
    --cld-muted:       #94a3b8;
    --cld-green:       #22c55e;
    --cld-orange:      #f97316;
    --cld-blue:        #60a5fa;
    --cld-purple:      #c084fc;
    --cld-highlight:   #f97316;
    --cld-radius:      14px;
    --cld-dot-red:     #ff5f57;
    --cld-dot-yellow:  #ffbd2e;
    --cld-dot-green:   #28c840;

    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--cld-text);
}

/* ── Header ─────────────────────────────────────────────── */

.kss-cld__header {
    text-align: center;
    margin-bottom: 48px;
}

.kss-cld__headline {
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    color: #0f172a;
    margin: 0 0 .75rem;
}

.kss-cld__headline .highlight {
    color: var(--cld-orange);
}

.kss-cld__subheadline {
    font-size: clamp(.95rem, 1.6vw, 1.1rem);
    color: #475569;
    margin: 0;
}

/* ── Stage (two-col grid) ────────────────────────────────── */

.kss-cld__stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

@media (max-width: 768px) {
    .kss-cld__stage {
        grid-template-columns: 1fr;
    }
    .kss-cld__browser {
        order: -1; /* show browser above terminal on mobile */
    }
}

/* ── Shared window chrome ────────────────────────────────── */

.kss-cld__terminal,
.kss-cld__browser {
    background: var(--cld-surface);
    border-radius: var(--cld-radius);
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
}

/* Title-bar */
.kss-cld__terminal-titlebar,
.kss-cld__browser-titlebar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(0,0,0,.35);
    border-bottom: 1px solid var(--cld-border);
    flex-shrink: 0;
}

/* Traffic-light dots */
.kss-cld__dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.kss-cld__dot--red    { background: var(--cld-dot-red); }
.kss-cld__dot--yellow { background: var(--cld-dot-yellow); }
.kss-cld__dot--green  { background: var(--cld-dot-green); }

/* ── Terminal ────────────────────────────────────────────── */

.kss-cld__terminal-title {
    margin-left: 8px;
    font-size: .8rem;
    color: var(--cld-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.kss-cld__terminal-body {
    flex: 1;
    padding: 20px 20px 20px 20px;
    background: #0d1117;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.kss-cld__terminal-lines {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: .82rem;
    line-height: 1.7;
}

/* Individual log line – starts invisible, slides in */
.kss-cld__log-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .25s ease, transform .25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kss-cld__log-line.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Timestamp badge */
.kss-cld__log-time {
    color: #64748b;
    flex-shrink: 0;
}

/* Text colour by type */
.kss-cld__log-text--action  { color: var(--cld-orange); }
.kss-cld__log-text--param   { color: var(--cld-green); }
.kss-cld__log-text--llm     { color: var(--cld-blue); }
.kss-cld__log-text--success { color: #4ade80; }
.kss-cld__log-text--default { color: var(--cld-text); }

/* Typing cursor on the last active line */
.kss-cld__log-text::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: .85em;
    background: currentColor;
    margin-left: 3px;
    vertical-align: text-bottom;
    opacity: 0;
}
.kss-cld__log-text.is-typing::after {
    opacity: 1;
    animation: kss-cld-blink .7s step-end infinite;
}

@keyframes kss-cld-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Success line at the bottom of the terminal */
.kss-cld__terminal-success {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: .82rem;
    color: var(--cld-green);
    opacity: 0;
    transition: opacity .4s ease .1s;
}

.kss-cld__terminal-success.is-visible {
    opacity: 1;
}

.kss-cld__terminal-success[hidden] {
    display: flex !important; /* keep in layout for transition */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.kss-cld__success-icon {
    font-size: 1rem;
    animation: kss-cld-spin-check 1s ease forwards;
    display: inline-block;
}

@keyframes kss-cld-spin-check {
    from { transform: scale(0) rotate(-90deg); }
    to   { transform: scale(1) rotate(0deg); }
}

/* ── Browser Window ─────────────────────────────────────── */

.kss-cld__browser-url {
    flex: 1;
    margin: 0 12px;
    background: rgba(255,255,255,.07);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: .75rem;
    color: var(--cld-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kss-cld__job-list {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.kss-cld__job-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.kss-cld__job-card--highlight {
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249,115,22,.15), 0 4px 12px rgba(0,0,0,.08);
}

/* Pulse animation on the highlight card while analysis runs */
.kss-cld__job-card--highlight.is-analysing {
    animation: kss-cld-pulse-card 1s ease infinite alternate;
}

@keyframes kss-cld-pulse-card {
    from { box-shadow: 0 0 0 2px rgba(249,115,22,.15), 0 4px 12px rgba(0,0,0,.08); }
    to   { box-shadow: 0 0 0 4px rgba(249,115,22,.35), 0 8px 24px rgba(0,0,0,.12); }
}

.kss-cld__job-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.kss-cld__job-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.kss-cld__job-info strong {
    font-size: .875rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kss-cld__job-info span {
    font-size: .75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Analyse button */
.kss-cld__analyse-btn {
    flex-shrink: 0;
    /* animated gradient background – scrolls left→right to simulate processing */
    background: linear-gradient(
        90deg,
        #f97316 0%,
        #fb923c 25%,
        #fdba74 45%,
        #fb923c 65%,
        #f97316 100%
    );
    background-size: 250% 100%;
    color: #fff;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 5px 11px; /* compensate 2px border */
    font-size: .78rem;
    font-weight: 600;
    cursor: default;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    animation:
        kss-cld-btn-flow   2.2s linear infinite,
        kss-cld-btn-border 1.4s ease-in-out infinite;
    box-shadow: 0 0 0 2px rgba(249,115,22,.3);
}

/* Shimmer sweep on top of the moving gradient */
.kss-cld__analyse-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,.45) 50%,
        transparent 70%
    );
    transform: translateX(-120%);
    animation: kss-cld-shimmer 2s ease-in-out infinite;
}

/* Gradient moves right → gives the "wave being processed" feel */
@keyframes kss-cld-btn-flow {
    0%   { background-position: 100% 0; }
    100% { background-position:   0% 0; }
}

/* Border pulses between transparent and a visible orange glow */
@keyframes kss-cld-btn-border {
    0%, 100% { box-shadow: 0 0 0 2px rgba(249,115,22,.25); }
    50%       { box-shadow: 0 0 0 4px rgba(249,115,22,.65); }
}

@keyframes kss-cld-shimmer {
    0%   { transform: translateX(-120%); }
    55%  { transform: translateX(120%); }
    100% { transform: translateX(120%); }
}

/* ── Stats Bar ───────────────────────────────────────────── */

.kss-cld__stats {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-top: 40px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--cld-radius);
    overflow: hidden;
}

.kss-cld__stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 16px;
    border-right: 1px solid #e2e8f0;
    transition: background .2s;
}

.kss-cld__stat:last-child {
    border-right: none;
}

.kss-cld__stat:hover {
    background: #f1f5f9;
}

.kss-cld__stat-value {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.kss-cld__stat-label {
    font-size: .8rem;
    color: #64748b;
    margin-top: 6px;
}

@media (max-width: 480px) {
    .kss-cld__stats {
        flex-direction: column;
    }
    .kss-cld__stat {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    .kss-cld__stat:last-child {
        border-bottom: none;
    }
}
