/* ============================================================
   dashboard.css — Dashboard Layout & Component Styles
   ============================================================ */

/* ── App Layout ── */
.app {
    position: relative;
    z-index: var(--z-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top Bar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-8);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(6, 9, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-payment), #0077b3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    box-shadow: var(--shadow-glow-cyan);
}

.topbar-title {
    font-size: var(--text-lg);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-payment) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topbar-subtitle {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    background: var(--color-success-bg);
    border: 1px solid rgba(46, 213, 115, 0.15);
    border-radius: var(--radius-full);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse-dot 2s infinite;
}

/* ── Main Content Area ── */
.main-content {
    flex: 1;
    padding: var(--space-6) var(--space-8);
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ── Stats Row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card[data-accent="cyan"]::before { background: linear-gradient(90deg, var(--color-payment), transparent); }
.stat-card[data-accent="green"]::before { background: linear-gradient(90deg, var(--color-success), transparent); }
.stat-card[data-accent="amber"]::before { background: linear-gradient(90deg, var(--color-fraud), transparent); }
.stat-card[data-accent="red"]::before { background: linear-gradient(90deg, var(--color-error), transparent); }

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.stat-card-label {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    font-weight: 500;
}

.stat-card-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-md);
}

.stat-card-icon.cyan { background: var(--color-payment-bg); color: var(--color-payment); }
.stat-card-icon.green { background: var(--color-success-bg); color: var(--color-success); }
.stat-card-icon.amber { background: var(--color-fraud-bg); color: var(--color-fraud); }
.stat-card-icon.red { background: var(--color-error-bg); color: var(--color-error); }

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-card-sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ── Main Grid Layout ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

/* ── Section Headers ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--text-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-title-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.section-title-icon.cyan { background: var(--color-payment); box-shadow: 0 0 8px var(--color-payment-glow); }
.section-title-icon.amber { background: var(--color-fraud); box-shadow: 0 0 8px var(--color-fraud-glow); }
.section-title-icon.green { background: var(--color-support); box-shadow: 0 0 8px var(--color-support-glow); }

/* ── Transaction Feed ── */
.transaction-feed {
    padding: var(--space-4);
    max-height: 500px;
    overflow-y: auto;
}

.txn-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all var(--transition-base);
    cursor: pointer;
    margin-bottom: var(--space-2);
}

.txn-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-subtle);
}

.txn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-md);
    flex-shrink: 0;
}

.txn-icon.approved { background: var(--color-success-bg); }
.txn-icon.blocked { background: var(--color-error-bg); }
.txn-icon.pending { background: var(--color-warning-bg); }
.txn-icon.review { background: var(--color-info-bg); }

.txn-details {
    flex: 1;
    min-width: 0;
}

.txn-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-subtitle {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.txn-amount {
    text-align: right;
    flex-shrink: 0;
}

.txn-amount-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.txn-amount-status {
    font-size: var(--text-xs);
}

.txn-empty {
    text-align: center;
    padding: var(--space-10) var(--space-4);
    color: var(--text-muted);
}

.txn-empty-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

/* ── Pipeline / Agent Panels Area ── */
.pipeline-area {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ── Pipeline Step Indicator ── */
.pipeline-steps {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-base);
    white-space: nowrap;
}

.pipeline-step.active {
    border-color: var(--color-payment-border);
    color: var(--color-payment);
    background: var(--color-payment-bg);
    box-shadow: var(--shadow-glow-cyan);
}

.pipeline-step.active[data-agent="fraud"] {
    border-color: var(--color-fraud-border);
    color: var(--color-fraud);
    background: var(--color-fraud-bg);
    box-shadow: var(--shadow-glow-amber);
}

.pipeline-step.active[data-agent="support"] {
    border-color: var(--color-support-border);
    color: var(--color-support);
    background: var(--color-support-bg);
    box-shadow: var(--shadow-glow-green);
}

.pipeline-step.completed {
    border-color: rgba(46, 213, 115, 0.25);
    color: var(--color-success);
    background: var(--color-success-bg);
}

.pipeline-arrow {
    color: var(--text-muted);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.pipeline-arrow.active {
    color: var(--color-payment);
}

/* ── Bottom Section ── */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

/* ── Scenarios Panel ── */
.scenarios-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-2);
}

.scenario-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-base);
    width: 100%;
}

.scenario-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.scenario-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.scenario-desc {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .bottom-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .topbar {
        padding: var(--space-3) var(--space-4);
    }
    .main-content {
        padding: var(--space-4);
    }
    .pipeline-steps {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}
