/* ============================================================
   SiteRooster — Homepage Styles
   ------------------------------------------------------------
   This file contains styles that are specific to the public
   homepage (the block-editor page rendered by the theme).
   It covers:

     1. Demo frame (browser chrome) wrapping the agent widget
     2. Agent widget — idle/draft state styles
        (extracted from site-detail-automation.css — idle state
        only; run/completed/activity/receipt/unsaved-bar rules
        are NOT included here by design)

   If the dashboard agent tab design changes, the homepage will
   drift — update this file manually to keep it aligned.
   ============================================================ */


/* ============================================================
   1. DEMO FRAME (browser chrome around the widget)
   ============================================================ */

.sr-agent-demo-wrap {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    text-align: left;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
    background: #ffffff;
}

.sr-agent-demo-chrome {
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sr-agent-demo-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.sr-agent-demo-dots span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: block;
}
.sr-agent-demo-dots span:nth-child(1) { background: #fc6058; }
.sr-agent-demo-dots span:nth-child(2) { background: #fec02e; }
.sr-agent-demo-dots span:nth-child(3) { background: #2aca44; }

.sr-agent-demo-bar {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    color: #9ca3af;
    font-family: 'DM Sans', system-ui, sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.sr-agent-demo-bar svg { flex-shrink: 0; }
.sr-agent-demo-bar-url {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-agent-demo-body {
    padding: 24px;
    background: #ffffff;
    max-height: 720px;
    overflow-y: auto;
}


/* ============================================================
   2. AGENT WIDGET — scoped tokens + base
   (idle-state subset of site-detail-automation.css)
   ============================================================ */

#section-automation {
    --sra-emerald:       #0ea5e9;
    --sra-emerald-dark:  #0284c7;
    --sra-emerald-light: #f0f9ff;
    --sra-emerald-ring:  rgba(56, 189, 248, 0.133);

    --sra-ink:       #022c22;
    --sra-slate-900: #0f172a;
    --sra-slate-700: #334155;
    --sra-slate-600: #475569;
    --sra-slate-500: #64748b;
    --sra-slate-400: #94a3b8;
    --sra-slate-300: #cbd5e1;
    --sra-slate-200: #e2e8f0;
    --sra-slate-100: #f1f5f9;
    --sra-slate-50:  #f8fafc;
    --sra-white:     #ffffff;

    --sra-amber: #f59e0b;
    --sra-red:   #ef4444;

    --sra-radius-card: 14px;
    --sra-radius:      10px;
    --sra-radius-sm:   7px;

    color: var(--sra-ink);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 500;
    line-height: 1.5;
}

#section-automation *,
#section-automation *::before,
#section-automation *::after {
    box-sizing: border-box;
}


/* ============================================================
   3. WORKSPACE LAYOUT
   ============================================================ */

.sr-agent-workspace {
    display: grid;
    grid-template-columns: minmax(420px, 42%) 1fr;
    gap: 24px;
    align-items: start;
}


/* ============================================================
   4. AGENT CARD (left; not sticky on homepage)
   ============================================================ */

.sr-agent-card {
    position: static; /* on homepage this is never sticky */
    background: var(--sra-white);
    border: 1px solid var(--sra-slate-200);
    border-radius: var(--sra-radius-card);
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(2, 44, 34, 0.04),
        0 8px 20px -10px rgba(2, 44, 34, 0.08);
}
.sr-agent-card-accent {
    height: 4px;
    background: linear-gradient(90deg,
        var(--sra-emerald) 0%,
        #38bdf8 60%,
        var(--sra-emerald) 100%);
}
.sr-agent-card-body { padding: 24px 26px 20px; }

/* Meta row: label + status chip */
.sr-agent-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.sr-agent-label {
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sra-emerald);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sr-agent-label::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sra-emerald);
}

.sr-agent-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: var(--sra-slate-600);
    background: var(--sra-slate-100);
}
.sr-agent-status-chip .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sra-slate-400);
}

/* Agent name input styled as heading */
.sr-agent-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.sr-agent-name-input {
    font-family: inherit;
    font-size: 28px;
    font-weight: 700;
    color: var(--sra-ink);
    letter-spacing: -0.02em;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    width: 100%;
    min-width: 0;
    outline: none;
    line-height: 1.2;
}
.sr-agent-name-input::placeholder {
    color: var(--sra-slate-400);
    font-weight: 600;
}
.sr-agent-name-input:focus {
    background: var(--sra-slate-50);
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: -6px;
}

/* Shimmer on empty name field — draws the eye. Animation pauses on focus
   and whenever the input has a value (JS adds .has-value on input). */
.sr-agent-name-input:placeholder-shown:not(:focus) {
    background-image: linear-gradient(
        90deg,
        transparent 0%,
        transparent 40%,
        rgba(14, 165, 233, 0.09) 50%,
        transparent 60%,
        transparent 100%
    );
    background-size: 250% 100%;
    background-repeat: no-repeat;
    background-position: 100% 0;
    animation: sra-name-shimmer 2.6s ease-in-out infinite;
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: -6px;
}
@keyframes sra-name-shimmer {
    0%   { background-position: 120% 0; }
    60%  { background-position: -20% 0; }
    100% { background-position: -20% 0; }
}

/* Shake the name input when user clicks Deploy while it's empty.
   JS toggles .shake briefly, then removes it. */
.sr-agent-name-input.shake {
    animation: sra-name-shake 480ms cubic-bezier(.36,.07,.19,.97) both;
    background: #fef3c7 !important;
    background-image: none !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: -6px;
}
@keyframes sra-name-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.sr-agent-name-hint {
    font-family: inherit;
    font-size: 11px;
    color: var(--sra-slate-400);
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 120ms ease;
    flex-shrink: 0;
    white-space: nowrap;
}
.sr-agent-name-wrap:hover .sr-agent-name-hint,
.sr-agent-name-input:focus ~ .sr-agent-name-hint { opacity: 1; }

/* Mission statement */
.sr-agent-mission {
    font-size: 15px;
    line-height: 1.55;
    color: var(--sra-slate-700);
    margin: 0 0 22px;
}
.sr-agent-mission strong {
    color: var(--sra-ink);
    font-weight: 600;
}
.sr-agent-mission .mono {
    font-family: inherit;
    font-weight: 600;
    color: var(--sra-ink);
    font-size: 14px;
}
.sr-agent-mission.is-empty {
    color: var(--sra-slate-400);
    font-style: italic;
}

/* Stats row */
.sr-agent-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--sra-slate-200);
    border-bottom: 1px solid var(--sra-slate-200);
    margin: 0 -26px 20px;
    background: var(--sra-slate-50);
}
.sr-agent-stat {
    padding: 14px 20px;
    border-right: 1px solid var(--sra-slate-200);
}
.sr-agent-stat:last-child { border-right: none; }
.sr-agent-stat .label {
    font-family: inherit;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sra-slate-500);
    font-weight: 600;
    margin-bottom: 4px;
}
.sr-agent-stat .value {
    font-family: inherit;
    font-size: 18px;
    color: var(--sra-ink);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.sr-agent-stat .value.value-text { font-size: 14px; }
.sr-agent-stat .value .unit {
    font-size: 11px;
    color: var(--sra-slate-400);
    font-weight: 500;
    margin-left: 3px;
}

/* Capability pip summary */
.sr-agent-caps-summary { padding-bottom: 18px; }
.sr-agent-caps-summary .label {
    font-family: inherit;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sra-slate-500);
    font-weight: 600;
    margin-bottom: 10px;
}
.sr-agent-pips {
    display: flex;
    gap: 6px;
    align-items: center;
}
.sr-agent-pip {
    flex: 1;
    height: 36px;
    background: var(--sra-slate-100);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--sra-slate-400);
    transition: all 180ms ease;
    position: relative;
}
.sr-agent-pip.on {
    background: var(--sra-emerald-light);
    color: var(--sra-emerald);
}
.sr-agent-pip svg { width: 14px; height: 14px; stroke-width: 2; }
.sr-agent-pip .pip-num {
    font-family: inherit;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Primary action (Deploy) */
.sr-agent-action {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sr-btn-deploy {
    width: 100%;
    background: var(--sra-emerald);
    color: var(--sra-white);
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    padding: 14px 20px;
    border-radius: var(--sra-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 140ms ease;
    box-shadow: 0 4px 12px -2px rgba(14, 165, 233, 0.28);
    letter-spacing: -0.005em;
}
.sr-btn-deploy:hover:not([aria-disabled="true"]) {
    background: var(--sra-emerald-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -2px rgba(14, 165, 233, 0.36);
}
.sr-btn-deploy:active:not([aria-disabled="true"]) { transform: translateY(0); }
.sr-btn-deploy[aria-disabled="true"] {
    background: var(--sra-slate-200);
    color: var(--sra-slate-400);
    cursor: pointer; /* clickable so the shake handler runs */
    box-shadow: none;
}
.sr-btn-deploy svg { width: 16px; height: 16px; stroke-width: 2.2; }
.sr-btn-deploy .icon-stop { display: none; }
.sr-btn-deploy .cost-pill {
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    letter-spacing: 0;
}
.sr-btn-deploy[aria-disabled="true"] .cost-pill {
    background: transparent;
    color: var(--sra-slate-400);
}
.sr-agent-action-hint {
    font-size: 11px;
    color: var(--sra-slate-500);
    text-align: center;
}
.sr-agent-action-hint .mono {
    font-family: inherit;
    color: var(--sra-slate-700);
}


/* ============================================================
   5. CAPABILITY STACK (right)
   ============================================================ */

.sr-capability-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* Global strip */
.sr-agent-global-strip {
    background: var(--sra-white);
    border: 1px solid var(--sra-slate-200);
    border-radius: var(--sra-radius);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 4px;
}

.sr-field-label {
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sra-slate-500);
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}
.sr-select,
.sr-input {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--sra-slate-300);
    border-radius: var(--sra-radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--sra-ink);
    background: var(--sra-white);
    appearance: none;
    outline: none;
}
.sr-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.sr-select:focus,
.sr-input:focus {
    border-color: var(--sra-emerald);
    box-shadow: 0 0 0 3px var(--sra-emerald-ring);
}
.sr-field-help {
    font-size: 11px;
    color: var(--sra-slate-500);
    margin-top: 4px;
}
.sr-run-meta-inline {
    font-family: inherit;
    font-size: 11px;
    color: var(--sra-slate-500);
    text-align: right;
    padding-bottom: 4px;
    white-space: nowrap;
}
.sr-run-meta-inline .next {
    color: var(--sra-ink);
    font-weight: 500;
}

/* Section head above capability cards */
.sr-cap-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 10px;
    margin-bottom: 4px;
}
.sr-cap-section-head .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sra-ink);
    letter-spacing: -0.005em;
}
.sr-cap-section-head .sub {
    font-size: 12px;
    color: var(--sra-slate-500);
}


/* ============================================================
   6. CAPABILITY CARD
   ============================================================ */

.sr-cap-card {
    background: var(--sra-white);
    border: 1px solid var(--sra-slate-200);
    border-radius: var(--sra-radius);
    transition: all 160ms ease;
    overflow: hidden;
}
.sr-cap-card:hover { border-color: var(--sra-slate-300); }
.sr-cap-card.expanded {
    border-color: var(--sra-emerald);
    box-shadow: 0 0 0 3px var(--sra-emerald-ring);
}
.sr-cap-card.disabled { background: var(--sra-slate-50); }

/* Card head (the clickable summary row) */
.sr-cap-head {
    display: grid;
    grid-template-columns: 36px 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
}
.sr-cap-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--sra-slate-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sra-slate-600);
    flex-shrink: 0;
}
.sr-cap-card:not(.disabled) .sr-cap-icon {
    background: var(--sra-emerald-light);
    color: var(--sra-emerald);
}
.sr-cap-icon svg { width: 17px; height: 17px; stroke-width: 2; }

.sr-cap-main { min-width: 0; }
.sr-cap-name-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}
.sr-cap-num {
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--sra-slate-400);
    font-weight: 600;
}
.sr-cap-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sra-ink);
    letter-spacing: -0.005em;
}
.sr-cap-card.disabled .sr-cap-name { color: var(--sra-slate-500); }
.sr-cap-summary {
    font-family: inherit;
    font-size: 11px;
    color: var(--sra-slate-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sr-cap-summary .sep {
    color: var(--sra-slate-300);
    margin: 0 5px;
}
.sr-cap-card.disabled .sr-cap-summary { color: var(--sra-slate-400); }
.sr-cap-summary .summary-run { display: none; } /* idle-only on homepage */

/* Cost pill */
.sr-cap-meta { display: flex; align-items: center; }
.sr-cap-cost {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--sra-ink);
    padding: 4px 9px;
    background: var(--sra-slate-100);
    border-radius: 6px;
    white-space: nowrap;
}
.sr-cap-card:not(.disabled) .sr-cap-cost {
    background: var(--sra-emerald-light);
    color: var(--sra-emerald-dark);
}
.sr-cap-card.disabled .sr-cap-cost {
    color: var(--sra-slate-300);
    background: transparent;
}
.sr-cap-status { display: none; } /* hidden on homepage; run states only */

/* Toggle + chev wrapper */
.sr-cap-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sr-cap-toggle {
    width: 34px;
    height: 20px;
    background: var(--sra-emerald);
    border: none;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 160ms ease;
    flex-shrink: 0;
    padding: 0;
}
.sr-cap-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 16px;
    width: 16px;
    height: 16px;
    background: var(--sra-white);
    border-radius: 50%;
    transition: left 160ms ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.sr-cap-toggle.off,
.sr-cap-toggle[aria-checked="false"] { background: var(--sra-slate-300); }
.sr-cap-toggle.off::after,
.sr-cap-toggle[aria-checked="false"]::after { left: 2px; }
.sr-cap-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}
.sr-cap-chev {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sra-slate-400);
    transition: transform 220ms ease;
}
.sr-cap-card.expanded .sr-cap-chev {
    transform: rotate(180deg);
    color: var(--sra-emerald);
}
.sr-cap-chev svg { width: 14px; height: 14px; stroke-width: 2.2; }

/* Card body (expanded config) */
.sr-cap-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
    border-top: 1px solid transparent;
}
.sr-cap-card.expanded .sr-cap-body {
    max-height: 1600px;
    border-top-color: var(--sra-slate-200);
}
.sr-cap-body-inner {
    padding: 22px 18px 20px;
    display: grid;
    gap: 22px;
}
.sr-cap-desc {
    font-size: 13px;
    color: var(--sra-slate-600);
    line-height: 1.55;
    max-width: 60ch;
    margin: 0;
}

/* Config section inside card body */
.sr-cap-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.sr-cap-section-title .title {
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sra-slate-500);
    font-weight: 600;
}
.sr-cap-section-title .rule {
    flex: 1;
    height: 1px;
    background: var(--sra-slate-100);
}
.sr-cap-field-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 18px;
}
.sr-cap-field-group.single-col { grid-template-columns: 1fr; }

/* In-body toggle row (eg. Google/Bing/ChatGPT/Gemini) */
.sr-field-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Output chips (feeds X, Y) */
.sr-cap-outputs {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.sr-cap-output-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sra-slate-600);
    padding: 4px 8px;
    background: var(--sra-slate-100);
    border-radius: 5px;
    font-weight: 600;
}
.sr-cap-output-chip svg { width: 11px; height: 11px; }


/* ============================================================
   7. RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    /* Hide the complex agent demo widget on mobile —
       the section heading + CTA buttons remain visible */
    .sr-agent-demo-wrap {
        display: none !important;
    }
}

@media (max-width: 1180px) {
    .sr-agent-workspace { grid-template-columns: 1fr; }
    .sr-cap-field-group { grid-template-columns: 1fr; }
    .sr-agent-global-strip { grid-template-columns: 1fr 1fr; }
    .sr-run-meta-inline {
        grid-column: 1 / -1;
        text-align: left;
    }
}

@media (max-width: 640px) {
    .sr-agent-demo-body { padding: 16px; }
    .sr-agent-stats { grid-template-columns: 1fr; }
    .sr-agent-stat {
        border-right: none;
        border-bottom: 1px solid var(--sra-slate-200);
    }
    .sr-agent-stat:last-child { border-bottom: none; }
    .sr-agent-global-strip { grid-template-columns: 1fr; }
    .sr-cap-head {
        grid-template-columns: 36px 1fr auto;
    }
    .sr-cap-head .sr-cap-meta { display: none; }
}