/* ============================================================================
   PROJECT PULSE AI PANEL
   ============================================================================ */

/* Button */
.project-pulse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.1), rgba(74, 144, 217, 0.05));
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-blue);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-slow) var(--ease-in-out);
    white-space: nowrap;
    min-height: 32px;
}

.project-pulse-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.project-pulse-btn:hover {
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.18), rgba(74, 144, 217, 0.1));
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.15);
}

.project-pulse-btn:active { transform: translateY(0); }

/* Backdrop */
.project-pulse-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay-bg);
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-slow) var(--ease-in-out);
}

.project-pulse-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Panel */
.project-pulse-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border-light);
    box-shadow: none;
    z-index: calc(var(--z-modal) + 1);
    transform: translateX(100%);
    transition: transform var(--duration-slow) var(--ease-in-out),
                box-shadow var(--duration-slow) var(--ease-in-out);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-pulse-panel.active { transform: translateX(0); box-shadow: var(--shadow-2xl); }

/* Shared phase container */
.pp-phase { display: flex; flex-direction: column; height: 100%; }

/* Header */
.pp-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.pp-header-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.15), rgba(53, 122, 189, 0.1));
    border-radius: var(--radius-md);
    color: var(--accent-blue);
}

.pp-header-icon svg { width: 16px; height: 16px; }

.pp-header-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.pp-header-actions { display: flex; gap: 4px; }

.pp-close-btn,
.pp-refresh-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-in-out);
}

.pp-close-btn:hover,
.pp-refresh-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.pp-close-btn svg,
.pp-refresh-btn svg { width: 16px; height: 16px; }

/* Loading */
.pp-loading-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px;
}

.pp-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-blue);
    border-radius: var(--radius-circle);
    animation: dp-spin 0.8s linear infinite;
}

.pp-loading-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Error */
.pp-error-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px;
}

.pp-error-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-align: center;
}

/* Empty */
.pp-empty-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.pp-empty-text {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    text-align: center;
}

/* Buttons */
.pp-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--duration-normal) var(--ease-in-out);
}

.pp-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.pp-btn-secondary:hover { background: var(--bg-hover); }

/* Summary bar */
.pp-summary-bar {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.pp-stat {
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
}

.pp-stat-on-track { background: rgba(16, 185, 129, 0.1); color: var(--color-green-text); }
.pp-stat-at-risk { background: rgba(245, 158, 11, 0.1); color: var(--color-amber-text); }
.pp-stat-blocked { background: rgba(239, 68, 68, 0.1); color: var(--color-red-text); }

/* Card grid */
.pp-card-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Card */
.pp-card {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-in-out);
}

.pp-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.1);
}

.pp-card-selected {
    border-color: var(--accent-blue);
    background: rgba(74, 144, 217, 0.04);
}

.pp-card-at_risk { border-left: 3px solid var(--color-amber); }
.pp-card-blocked { border-left: 3px solid var(--color-red); }
.pp-card-on_track { border-left: 3px solid var(--color-green); }

/* Card header */
.pp-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pp-card-name {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status badge */
.pp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-2xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pp-status-on_track { background: rgba(16, 185, 129, 0.1); color: var(--color-green-text); }
.pp-status-at_risk { background: rgba(245, 158, 11, 0.1); color: var(--color-amber-text); }
.pp-status-blocked { background: rgba(239, 68, 68, 0.1); color: var(--color-red-text); }
.pp-status-completed { background: rgba(74, 144, 217, 0.1); color: var(--accent-blue); }

/* Velocity indicators */
.pp-velocity { font-size: var(--font-size-12); line-height: 1; }
.pp-velocity-up { color: var(--color-green-text); }
.pp-velocity-down { color: var(--color-red-text); }
.pp-velocity-stable { color: var(--text-tertiary); }
.pp-velocity-na { color: var(--text-tertiary); font-size: var(--font-size-2xs); }

/* Metrics row */
.pp-metrics-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pp-metric {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pp-metric-value {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-primary);
}

.pp-metric-label {
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
}

.pp-metric-warn .pp-metric-value { color: var(--color-red-text); }

/* Progress bar */
.pp-progress-bar {
    width: 48px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.pp-progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: var(--radius-sm);
    transition: width var(--duration-slow) var(--ease-in-out);
}

/* Status reason */
.pp-card-reason {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin: 0 0 6px;
    line-height: 1.4;
}

/* Blockers */
.pp-blockers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pp-blocker-chip {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(239, 68, 68, 0.08);
    color: var(--color-red-text);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-2xs);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keyboard hints */
.pp-keyboard-hints {
    padding: 8px 16px;
    display: flex;
    gap: 12px;
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.pp-keyboard-hints kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-2xs);
    font-family: inherit;
    color: var(--text-secondary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .project-pulse-panel {
        width: 100%;
        max-width: 100%;
        top: auto;
        bottom: 0;
        height: auto;
        max-height: 85vh;
        border-left: none;
        border-top: 1px solid var(--border-light);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
    }

    .project-pulse-panel.active { transform: translateY(0); }
    .project-pulse-btn span { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .project-pulse-backdrop,
    .project-pulse-panel,
    .pp-card,
    .project-pulse-btn {
        transition: none;
    }
    .pp-spinner { animation-duration: 1.5s; }
}
