/* ==========================================================================
   AI AGENT BENTO GRID (7-SECTION ARCHITECTURE)
   Matching the Webpot Design System: Glassmorphism, Micro-Animations,
   Spotlight Hover, 3D Kinetic Tilt, & Real-Time Dynamic Simulation.
   ========================================================================== */

@property --bento-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes spin-bento-border {
    0% { --bento-angle: 0deg; }
    100% { --bento-angle: 360deg; }
}

.bento-section {
    position: relative;
    padding: var(--section-padding, 120px) 0;
    background: transparent;
    border-bottom: 1px solid var(--border, #E5E7EB);
    overflow: hidden;
}

/* Background Ambient Glow */
.bento-ambient-glow {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 700px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, rgba(168, 85, 247, 0.04) 50%, transparent 75%);
    pointer-events: none;
    filter: blur(100px);
    z-index: 0;
}

/* Background Streamlines Canvas */
.bento-bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

/* Header */
.bento-header {
    text-align: center;
    max-width: 820px;
    margin: 0 auto 50px auto;
    position: relative;
    z-index: 5;
}

.bento-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    border-radius: 9999px;
    background: rgba(56, 189, 248, 0.1);
    color: #2563eb;
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 18px;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
}

.bento-badge .pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 10px #38bdf8;
    animation: bentoPulse 2s infinite ease-in-out;
}

@keyframes bentoPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.6; }
}

.bento-title {
    font-size: clamp(2.4rem, 4.5vw, 3.4rem);
    font-weight: 800;
    color: var(--text, #111111);
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -0.03em;
}

.bento-title span {
    background: linear-gradient(135deg, #2563eb 0%, #38bdf8 40%, #818cf8 70%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bento-subtitle {
    font-size: 1.08rem;
    color: var(--text-light, #6B7280);
    line-height: 1.6;
}

/* ==========================================================================
   12-COLUMN BENTO GRID CONTAINER
   ========================================================================== */
.agent-bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(220px, auto);
    gap: 22px;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

/* Base Bento Card */
.bento-card {
    position: relative;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(203, 213, 225, 0.85);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 26px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.3s ease;
    user-select: none;
}

.bento-card:hover {
    box-shadow: 0 20px 45px rgba(37, 99, 235, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(56, 189, 248, 0.6);
}

/* Cursor Dynamic Spotlight */
.bento-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        450px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(56, 189, 248, 0.14),
        transparent 55%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.bento-card:hover::before {
    opacity: 1;
}

/* Shimmer Border for Master Hero Card */
.bento-card-orchestrator {
    grid-column: span 6;
    grid-row: span 2;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.9) 100%);
    position: relative;
    z-index: 2;
}

.bento-card-orchestrator::after {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: 25px;
    padding: 1.5px;
    background: conic-gradient(
        from var(--bento-angle),
        #38bdf8,
        #2563eb,
        #818cf8,
        #a855f7,
        #38bdf8
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: spin-bento-border 7s linear infinite;
    pointer-events: none;
    z-index: 2;
    opacity: 0.75;
    transition: opacity 0.3s ease;
}

.bento-card-orchestrator:hover::after {
    opacity: 1;
}

/* Grid Layout Spans */
.bento-card-memory   { grid-column: span 3; grid-row: span 1; }
.bento-card-sentinel { grid-column: span 3; grid-row: span 1; }
.bento-card-terminal { grid-column: span 3; grid-row: span 1; }
.bento-card-router   { grid-column: span 3; grid-row: span 1; }
.bento-card-visual   { grid-column: span 5; grid-row: span 1; }
.bento-card-metrics  { grid-column: span 7; grid-row: span 1; }

/* Card Header Components */
.bento-card-head {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.bento-pill-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    background: rgba(241, 245, 249, 0.9);
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bento-pill-tag.accent-blue {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
    color: #0284c7;
}

.bento-pill-tag.accent-purple {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.35);
    color: #7c3aed;
}

.bento-pill-tag.accent-emerald {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #059669;
}

.bento-pill-tag.accent-amber {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #d97706;
}

.bento-head-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: monospace;
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
}

.bento-live-ping {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: bentoPulse 1.5s infinite;
}

.bento-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 6px;
}

.bento-card-desc {
    font-size: 0.86rem;
    color: #64748b;
    line-height: 1.5;
}

/* ==========================================================================
   CARD 01: CORE ORCHESTRATOR & REASONING AGENT (Hero 6x2)
   ========================================================================== */
.orchestrator-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
    position: relative;
    z-index: 4;
}

.orchestrator-hero-info {
    margin-bottom: 18px;
}

.orchestrator-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 16px;
    margin-top: 12px;
}

.orchestrator-status-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0f172a;
}

.orchestrator-status-badge {
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.15);
    color: #0284c7;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.orchestrator-rate {
    font-family: monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: #10b981;
}

/* Interactive Pipeline Loop (Plan -> Act -> Verify -> Iterate) */
.pipeline-stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 14px 0;
}

.pipeline-step-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.pipeline-step-item:hover, .pipeline-step-item.active {
    border-color: #38bdf8;
    background: rgba(240, 249, 255, 0.9);
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.18);
    transform: translateY(-2px);
}

.pipeline-step-item.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    border-radius: 99px;
    background: #2563eb;
}

.step-num {
    font-size: 0.65rem;
    font-family: monospace;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 2px;
}

.step-icon {
    font-size: 1.1rem;
    margin-top: 4px;
}

/* Real-time Thinking & Execution Stream */
.orchestrator-stream-box {
    background: #0f172a;
    border-radius: 14px;
    padding: 14px 18px;
    border: 1px solid #1e293b;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    margin-top: 6px;
}

.stream-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: monospace;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

.stream-terminal-text {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #38bdf8;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.stream-cursor {
    display: inline-block;
    width: 7px;
    height: 13px;
    background: #38bdf8;
    margin-left: 4px;
    animation: blinkCursor 0.9s infinite;
}

@keyframes blinkCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ==========================================================================
   CARD 02: CONTEXT & VECTOR RAG (3x1)
   ========================================================================== */
.rag-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 4;
}

.rag-score-ticker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: monospace;
    font-size: 0.72rem;
}

.rag-label {
    color: #475569;
    font-weight: 700;
    width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rag-track {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.rag-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #38bdf8, #2563eb);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.rag-score {
    font-weight: 800;
    color: #0284c7;
    width: 36px;
    text-align: right;
}

.rag-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.rag-pill {
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.68rem;
    font-family: monospace;
    font-weight: 700;
    color: #334155;
    transition: all 0.2s ease;
}

.rag-pill:hover {
    border-color: #38bdf8;
    color: #0284c7;
    background: #ffffff;
    transform: translateY(-1px);
}

/* ==========================================================================
   CARD 03: SENTINEL GUARDRAILS (3x1)
   ========================================================================== */
.sentinel-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 4;
}

.sentinel-radar-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
}

.sentinel-shield-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    flex-shrink: 0;
}

.sentinel-radar-info {
    flex: 1;
}

.sentinel-radar-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #0f172a;
}

.sentinel-radar-sub {
    font-size: 0.68rem;
    font-family: monospace;
    color: #10b981;
    font-weight: 700;
}

.sentinel-checklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sentinel-check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-family: monospace;
    color: #334155;
    padding: 4px 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.sentinel-check-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.check-icon {
    color: #10b981;
    font-weight: 900;
}

.check-status {
    color: #64748b;
    font-size: 0.65rem;
}

/* ==========================================================================
   CARD 04: LIVE EXECUTION TERMINAL (3x1)
   ========================================================================== */
.terminal-window {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #1e293b;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 4;
}

.terminal-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.terminal-dots {
    display: flex;
    gap: 5px;
}

.terminal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title-text {
    font-family: monospace;
    font-size: 0.65rem;
    color: #94a3b8;
}

.terminal-body {
    padding: 12px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #cbd5e1;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.terminal-cmd-line {
    color: #38bdf8;
    font-weight: 700;
}

.terminal-output-line {
    color: #10b981;
    margin-top: 4px;
}

.terminal-run-btn {
    width: 100%;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: monospace;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.terminal-run-btn:hover {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

/* ==========================================================================
   CARD 05: DYNAMIC MODEL ROUTER (3x1)
   ========================================================================== */
.router-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 4;
}

.router-chips-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.router-chip-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.router-chip-btn:hover, .router-chip-btn.active {
    border-color: #38bdf8;
    background: rgba(240, 249, 255, 0.9);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.12);
}

.router-chip-name {
    font-weight: 800;
    color: #0f172a;
}

.router-chip-tag {
    font-family: monospace;
    font-size: 0.65rem;
    color: #0284c7;
    font-weight: 700;
}

.router-meter-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: monospace;
    font-size: 0.72rem;
}

.meter-val {
    font-weight: 800;
    color: #10b981;
}

/* ==========================================================================
   CARD 06: VISUAL & ASSET GENERATION STUDIO (5x1)
   ========================================================================== */
.visual-studio-wrapper {
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
    z-index: 4;
    height: 100%;
}

.visual-canvas-container {
    flex: 1.2;
    height: 120px;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    border: 1px solid #cbd5e1;
    background: #090d16;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.visual-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.visual-fps-tag {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    font-family: monospace;
    font-size: 0.62rem;
    font-weight: 700;
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.visual-controls-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visual-preset-btn {
    padding: 7px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.visual-preset-btn:hover, .visual-preset-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.visual-preset-btn.active .preset-dot {
    background: #38bdf8;
}

.preset-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
}

/* ==========================================================================
   CARD 07: AGENT METRICS & TELEMETRY (7x1)
   ========================================================================== */
.metrics-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    z-index: 4;
}

.metrics-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.metric-stat-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-stat-box:hover {
    border-color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.12);
}

.metric-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.65rem;
    font-family: monospace;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.metric-tag-badge {
    color: #10b981;
    font-weight: 800;
}

.metric-number-val {
    font-size: 1.45rem;
    font-weight: 900;
    font-family: monospace;
    color: #0f172a;
    margin: 4px 0 2px 0;
    letter-spacing: -0.02em;
}

.metric-desc-text {
    font-size: 0.68rem;
    color: #64748b;
}

/* Sparkline Telemetry Wave Canvas */
.metrics-telemetry-stage {
    position: relative;
    width: 100%;
    height: 52px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.telemetry-sparkline-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1100px) {
    .agent-bento-grid {
        grid-template-columns: repeat(6, 1fr);
        grid-auto-rows: auto;
    }
    .bento-card-orchestrator { grid-column: span 6; grid-row: auto; }
    .bento-card-memory       { grid-column: span 3; }
    .bento-card-sentinel     { grid-column: span 3; }
    .bento-card-terminal     { grid-column: span 3; }
    .bento-card-router       { grid-column: span 3; }
    .bento-card-visual       { grid-column: span 6; }
    .bento-card-metrics      { grid-column: span 6; }
}

@media (max-width: 720px) {
    .agent-bento-grid {
        grid-template-columns: 1fr;
    }
    .agent-bento-grid > div {
        grid-column: span 1 !important;
        grid-row: auto !important;
    }
    .pipeline-stepper {
        grid-template-columns: repeat(2, 1fr);
    }
    .metrics-stats-grid {
        grid-template-columns: 1fr;
    }
    .visual-studio-wrapper {
        flex-direction: column;
    }
    .visual-canvas-container {
        width: 100%;
        height: 100px;
    }
}
