/* Portfolio Matrix Styles */

/* Portfolio Page Header */
.portfolio-header {
    background: white;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.portfolio-header h1 {
    color: #1e3a8a;
    margin-bottom: 0.5rem;
}

.portfolio-header p {
    color: #64748b;
}

/* Stats Toggle Button */
.stats-toggle-btn {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.stats-toggle-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.stats-toggle-btn.active {
    background: #1e3a8a;
    color: white;
    border-color: #1e3a8a;
}

.stats-toggle-btn.active:hover {
    background: #1e40af;
}

/* Summary Section Collapse Animation */
#matrix-summary {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

#matrix-summary.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin-bottom: 0;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
    white-space: nowrap;
}

.filter-group select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-clear {
    padding: 0.5rem 1rem;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: auto;
    transition: background 0.3s ease;
}

.filter-clear:hover {
    background: #475569;
}

/* Filter Results Count */
.filter-results {
    margin-left: auto;
    font-size: 0.9rem;
    color: #64748b;
}

.filter-results strong {
    color: #1e3a8a;
}

/* Matrix Table Wrapper */
.matrix-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Portfolio Matrix Table */
.portfolio-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.portfolio-matrix thead {
    background: #1e3a8a;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.portfolio-matrix th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 2px solid #1e3a8a;
}

.portfolio-matrix th:hover {
    background: #1e40af;
}

.portfolio-matrix th.sorted-asc::after {
    content: " ↑";
}

.portfolio-matrix th.sorted-desc::after {
    content: " ↓";
}

.portfolio-matrix td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.portfolio-matrix tbody tr:hover {
    background: #f0f9ff;
}

.portfolio-matrix tbody tr:nth-child(even) {
    background: #fafafa;
}

.portfolio-matrix tbody tr:nth-child(even):hover {
    background: #f0f9ff;
}

/* Offer Name Link */
.portfolio-matrix .offer-link {
    color: #1e3a8a;
    text-decoration: none;
    font-weight: 500;
}

.portfolio-matrix .offer-link:hover {
    text-decoration: underline;
    color: #3b82f6;
}

/* Material Status Icons */
.material-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.material-status.complete {
    background: #10b981;
    color: white;
}

.material-status.draft {
    background: #f59e0b;
    color: white;
}

.material-status.spec {
    background: #3b82f6;
    color: white;
}

.material-status.pending {
    background: #e2e8f0;
    color: #64748b;
}

.material-status.none {
    background: transparent;
    color: #cbd5e1;
}

/* Provenance Indicators */
.provenance-badge {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.provenance-badge.nh {
    background: #dbeafe;
    color: #1e40af;
}

.provenance-badge.agentic {
    background: #fef3c7;
    color: #92400e;
}

.provenance-badge.hybrid {
    background: #d1fae5;
    color: #065f46;
}

/* Lifecycle Stage */
.lifecycle-cell {
    font-size: 0.8rem;
    color: #475569;
}

/* Industry Focus */
.industry-cell {
    font-size: 0.8rem;
    color: #64748b;
    max-width: 120px;
}

/* Case Study Count */
.case-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 500;
}

.case-count.has-cases {
    background: #d1fae5;
    color: #065f46;
}

/* Last Updated */
.last-updated {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
}

/* Owner Cell */
.owner-cell {
    font-size: 0.85rem;
    color: #475569;
    max-width: 120px;
}

/* Matrix Summary */
.matrix-summary {
    display: flex;
    gap: 2rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.summary-stat {
    text-align: center;
}

.summary-stat .value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e3a8a;
}

.summary-stat .label {
    font-size: 0.85rem;
    color: #64748b;
}

/* Legend for Matrix */
.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-top: 1rem;
}

.legend-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-group h4 {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.25rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

/* Empty State */
.matrix-empty {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.matrix-empty h3 {
    margin-bottom: 0.5rem;
    color: #475569;
}

/* Responsive Matrix */
@media (max-width: 1200px) {
    .matrix-table-wrapper {
        overflow-x: scroll;
    }

    .portfolio-matrix {
        min-width: 1400px;
    }
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-clear {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .matrix-summary {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Print Styles */
@media print {
    .filter-bar {
        display: none;
    }

    .portfolio-matrix th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
