﻿
:root {
    --bg: #0f172a;
    --bg-alt: #111827;
    --card: #1f2937;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.15);
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border-subtle: #374151;
    --danger: #f97373;
    --radius-lg: 18px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #020617 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 12px 24px;
    backdrop-filter: blur(16px);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.75));
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #f97316, #312e81 60%, #020617 100%);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-name {
    font-weight: 600;
    letter-spacing: 0.04em;
    font-size: 1rem;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 260px;
    text-align: right;
}

main {
    flex: 1;
    padding: 18px;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.shell {
    width: 100%;
    max-width: 1400px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
    gap: 18px;
    height: 100%;
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .disclaimer {
        display: none;
    }
}

.panel {
    background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.07), transparent 55%), var(--bg-alt);
    border-radius: 24px;
    border: 1px solid rgba(75, 85, 99, 0.8);
    padding: 18px 18px 20px;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.9), 0 0 0 1px rgba(15, 23, 42, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    margin-bottom: 10px;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-muted);
}

.panel-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#results-container {
    margin-top: 10px;
    padding-right: 4px;
    overflow-y: auto;
    min-height: 220px;
    max-height: 55vh; /* ⬅️ main fix: cap it relative to viewport */
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

select,
textarea,
input[type="text"] {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    border-radius: 10px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 7px 9px;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
}

textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.4;
}

    select:focus,
    textarea:focus,
    input[type="text"]:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
    }

.inline-fields {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

    .inline-fields .field-group {
        flex: 1;
        min-width: 130px;
    }

.hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(75, 85, 99, 0.9), transparent);
    margin: 6px 0 10px;
    opacity: 0.7;
}

details {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 14px;
    border: 1px dashed rgba(75, 85, 99, 0.9);
    padding: 7px 9px;
    font-size: 0.8rem;
}

    details summary {
        cursor: pointer;
        list-style: none;
        display: flex;
        align-items: center;
        gap: 6px;
        color: var(--text-muted);
    }

        details summary::-webkit-details-marker {
            display: none;
        }

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 5px;
    margin-top: 6px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

    .checkbox-item input {
        accent-color: var(--accent);
    }

.primary-btn {
    border: none;
    outline: none;
    background: radial-gradient(circle at top left, #38bdf8, #0ea5e9 40%, #0369a1 100%);
    color: #0b1120;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 30px rgba(8, 47, 73, 0.9), 0 0 0 1px rgba(15, 23, 42, 0.8);
    margin-top: 6px;
}

    .primary-btn:disabled {
        opacity: 0.6;
        cursor: default;
        box-shadow: none;
    }

    .primary-btn span.icon {
        font-size: 1rem;
    }

.results-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status-chip {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
}

    .status-dot.pending {
        background: #eab308;
    }

    .status-dot.idle {
        background: #6b7280;
    }

.results-scroll {

}

    .results-scroll.editing {
        outline: 1px dashed rgba(56, 189, 248, 0.6);
        outline-offset: 2px;
    }


.placeholder-card {
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(75, 85, 99, 0.9);
    padding: 14px 12px;
    background: rgba(15, 23, 42, 0.8);
    font-size: 0.83rem;
    color: var(--text-muted);
}

    .placeholder-card strong {
        color: var(--text);
    }

.mini-list {
    margin-top: 8px;
    padding-left: 16px;
}

    .mini-list li {
        margin-bottom: 2px;
    }

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.9);
    padding: 11px 11px 12px;
    font-size: 0.82rem;
    margin-bottom: 8px;
}

    .result-card h3 {
        margin: 0 0 4px;
        font-size: 0.85rem;
        font-weight: 600;
    }

.result-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 7px;
    margin-top: 5px;
}

.option-pill {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(55, 65, 81, 0.9);
    padding: 7px;
    background: rgba(15, 23, 42, 0.9);
}

.option-title {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.option-list {
    padding-left: 14px;
    margin: 0;
}

    .option-list li {
        margin-bottom: 1px;
    }

.tagline {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #e0f2fe;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

    .badge-soft span {
        font-size: 0.8rem;
    }

.followup-box {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(55, 65, 81, 0.9);
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

    .followup-box input {
        flex: 1;
        font-size: 0.8rem;
        padding: 6px 8px;
        border-radius: 999px;
        border: 1px solid rgba(55, 65, 81, 0.9);
        background: rgba(15, 23, 42, 0.9);
        color: var(--text);
        outline: none;
        min-width: 200px;
    }

        .followup-box input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
        }

    .followup-box button {
        border: none;
        border-radius: 999px;
        padding: 6px 10px;
        font-size: 0.78rem;
        cursor: pointer;
        background: rgba(56, 189, 248, 0.15);
        color: #e0f2fe;
    }

/* Results actions (copy/save) */
.results-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.ghost-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

    .ghost-btn:hover {
        border-color: rgba(148, 163, 184, 0.9);
        color: var(--text);
        background: rgba(15, 23, 42, 1);
    }

    .ghost-btn:disabled {
        opacity: 0.5;
        cursor: default;
    }


/* ===============================
   SENTIENTA INFO / AGENT PROGRESS
   =============================== */

#sentienta_info {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(3px);
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    padding: 6px 6px;
    margin-bottom: 8px;
    max-height: 180px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.sentienta-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e2e2;
}

.sentienta-info-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Scrollable area */
.sentienta-info-body {
    flex: 1;
    overflow-y: auto;
    max-height: 140px;
    padding-right: 4px; /* Space for scrollbar */
}

/* Individual log lines */
.sentienta-line {
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.35;
    padding-left: 4px;
    border-left: 2px solid transparent;
}

/* Muted initial line */
.sentienta-line-muted {
    color: #777;
    font-style: italic;
}

/* System messages */
.sentienta-line-system {
    color: #2c3e50;
    border-left-color: #2c3e50;
}

/* Agent messages */
.sentienta-line-agent {
    color: #1a4d8f;
    border-left-color: #1a4d8f;
}

/* Error messages */
.sentienta-line-error {
    color: #a30000;
    border-left-color: #a30000;
    font-weight: 500;
}

/* Thin, subtle scrollbar styling */
.sentienta-info-body::-webkit-scrollbar {
    width: 6px;
}

.sentienta-info-body::-webkit-scrollbar-track {
    background: transparent;
}

.sentienta-info-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

    .sentienta-info-body::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.35);
    }

/* ===============================
   AGENT CHIPS / TABS
   =============================== */

.agent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 0 4px;
    border-bottom: 1px dashed rgba(55, 65, 81, 0.8);
}

/* Individual chip */
.agent-chip {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 3px 9px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, box-shadow 0.15s ease-out, transform 0.1s ease-out;
}

    /* Little dot on the left, echoing status-dot vibe */
    .agent-chip::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.8);
    }

    /* Hover state */
    .agent-chip:hover {
        border-color: rgba(148, 163, 184, 0.9);
        color: var(--text);
        background: rgba(15, 23, 42, 1);
        transform: translateY(-0.5px);
    }

    /* Active chip (selected agent) */
    .agent-chip.active {
        background: var(--accent-soft);
        border-color: var(--accent);
        color: #e0f2fe;
        box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45);
    }

        .agent-chip.active::before {
            background: var(--accent);
        }

.agent-response-divider {
    border: none;
    border-top: 2px dashed rgba(56, 189, 248, 0.65); /* bright cyan */
    margin: 14px 0;
}
