/* ============================================================
   css/mp/dashboard.css — Stakeholder dashboard grid layout,
                          widget cards, identity card, activity
                          feed, and expand modals
   ============================================================ */

/* ── Dashboard Container ─────────────────────────────────── */
.mp-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 0;
}

/* ── Widget Cards ────────────────────────────────────────── */
.mp-widget-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Widget Header / Section Title ──────────────────────── */
.mp-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.mp-widget-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6B7280;
    margin: 0;
}

.mp-widget-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.mp-widget-expand {
    font-size: 0.75rem;
    color: #88A09A;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
    transition: color 0.2s ease;
}

.mp-widget-expand:hover {
    color: #6D827C;
}

/* ── Identity Card ──────────────────────────────────────– */
.mp-identity-card {
    grid-column: 1 / -1;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.mp-identity-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 15%;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mp-identity-main {
    flex: 1;
}

.mp-identity-main h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.mp-identity-main h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.4rem 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.mp-identity-meta {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Party pill — reuses existing person-party color rules from profile.css */
.mp-identity-party {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    color: white;
    opacity: 0.95;
}

/* Committee tags row */
.mp-identity-committees {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.mp-identity-committee-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
}

/* ── MP info detail rows ──────────────────────────────── */
.mp-identity-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.mp-identity-email {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.mp-identity-email:hover {
    color: #88A09A;
}

.mp-identity-meta-line {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Divider between MP info and assistant */
.mp-identity-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border-default);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

/* Assistant info section — mirrors the MP detail-row pattern */
.mp-assistant-info {
    min-width: 200px;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mp-assistant-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #9CA3AF;
    margin-bottom: 0.25rem;
}

.mp-assistant-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Assistant email inherits the same plain style */
.mp-assistant-info .mp-identity-email {
    font-size: 0.82rem;
}

/* ── Summary Card (between identity and grid) ────────────── */
.mp-summary-card {
    grid-column: 1 / -1;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.mp-summary-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.7;
}

.mp-summary-text .summary-headline {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-top: 0.5rem;
}

.mp-summary-text .summary-headline:first-child {
    margin-top: 0;
}

/* ── Additional Info Card (bottom) ─────────────────────── */
.mp-additional-info-card {
    grid-column: 1 / -1;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.mp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.mp-info-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6B7280;
    margin: 0 0 0.5rem 0;
}

.mp-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mp-info-list li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-subtle);
    line-height: 1.4;
}

.mp-info-list li:last-child {
    border-bottom: none;
}

.mp-info-list .li-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Topics Widget ──────────────────────────────────────– */
.mp-topics-widget {
    display: flex;
    flex-direction: column;
}

.mp-topics-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.mp-topics-filter-select {
    background: white;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.mp-topics-filter-select:focus {
    outline: none;
    border-color: #88A09A;
    box-shadow: 0 0 0 3px rgba(136, 160, 154, 0.15);
}

.mp-topics-chart {
    position: relative;
    height: 250px;
    margin-bottom: 0.75rem;
}

#mp-topics-chart {
    width: 100% !important;
}

/* ── Network Widget ────────────────────────────────────── */
.mp-network-widget {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* Network widget header spans both columns */
.mp-network-widget .mp-widget-header {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.mp-network-list {
    display: flex;
    flex-direction: column;
}

.mp-network-rank-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
}

.mp-network-rank-item:hover {
    background: var(--bg-primary);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 4px;
}

.mp-network-rank-item:last-child {
    border-bottom: none;
}

.mp-network-rank-number {
    font-weight: 600;
    color: var(--text-muted);
    width: 18px;
    text-align: right;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.mp-network-rank-name {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}

.mp-network-rank-party {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    color: white;
    flex-shrink: 0;
}

.mp-network-rank-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    background: var(--bg-primary);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.mp-network-graph-container {
    position: relative;
    height: 250px;
    border-radius: 8px;
    background: var(--bg-primary);
    overflow: hidden;
}

#mp-network-graph-widget {
    width: 100%;
    height: 100%;
}

#mp-network-graph-widget svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Activity Feed ──────────────────────────────────────– */
.mp-activity-feed {
    grid-column: 1 / -1;
}

.mp-activity-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mp-activity-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.mp-activity-secondary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.mp-activity-filter-btn {
    padding: 8px 20px;
    background: white;
    border: 2px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.mp-activity-filter-btn:hover:not(.active) {
    background: var(--hover-bg);
    border-color: var(--gradient-start);
    color: var(--text-primary);
}

.mp-activity-filter-btn.active {
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--gradient-start), var(--gradient-end)) border-box;
    border: 2px solid transparent;
    color: var(--text-primary);
    font-weight: 700;
}

/* Sub-controls: secondary filter row */
.mp-activity-sub-controls {
    display: none;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.mp-activity-sub-controls:not(:empty) {
    display: flex;
}

.mp-activity-sub-filter-btn {
    padding: 6px 16px;
    background: white;
    border: 2px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.mp-activity-sub-filter-btn:hover:not(.active) {
    background: var(--hover-bg);
    border-color: var(--gradient-start);
    color: var(--text-primary);
}

.mp-activity-sub-filter-btn.active {
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--gradient-start), var(--gradient-end)) border-box;
    border: 2px solid transparent;
    color: var(--text-primary);
    font-weight: 700;
}

.mp-activity-search {
    width: min(320px, 100%);
    min-width: 220px;
}

.mp-activity-search::placeholder {
    color: var(--text-muted);
}

.mp-activity-search:focus {
    outline: none;
}

.mp-activity-reset-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    flex-shrink: 0;
}

.mp-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mp-activity-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.mp-activity-item:hover {
    background: var(--bg-primary);
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.mp-activity-item:last-child {
    border-bottom: none;
}

.mp-activity-item-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.mp-activity-item-type-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.mp-activity-item-type-badge.speech {
    background: #eef3f2;
    color: #5a8078;
}

.mp-activity-item-type-badge.initiative {
    background: #eef1f5;
    color: #5a6b82;
}

.mp-activity-role-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
}

.mp-activity-role-badge.aloittanut {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

.mp-activity-role-badge.kannattanut {
    background: rgba(11, 74, 125, 0.08);
    color: #0B4A7D;
}

.mp-activity-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.45;
    margin-bottom: 0;
}

.mp-activity-item-summary {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.mp-activity-load-more {
    background: #88A09A;
    border: 2px solid #88A09A;
    color: white;
    border-radius: 20px;
    padding: 0.65rem 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1.25rem;
    width: 15%;
    min-width: 140px;
    max-width: 180px;
}

.mp-activity-load-more:hover {
    background: #6D827C;
    border-color: #6D827C;
}

/* ── Expand Modal ────────────────────────────────────── */
#mp-expand-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

#mp-expand-modal.active {
    display: flex;
}

.mp-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: min(1200px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 2rem 2.5rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.mp-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 1;
}

.mp-modal-close:hover {
    color: var(--text-primary);
}

.mp-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 1.25rem 0;
    color: var(--text-primary);
    padding-right: 2rem;
}

.mp-modal-topics-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.mp-modal-topics-chart {
    position: relative;
    height: calc(92vh - 170px);
    min-height: 500px;
    margin-bottom: 1rem;
}

.mp-modal-network-graph {
    position: relative;
    height: calc(92vh - 120px);
    min-height: 550px;
    border-radius: 8px;
    background: var(--bg-primary);
    overflow: hidden;
}

#mp-network-graph-modal svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Responsive ─────────────────────────────────────────– */
@media (max-width: 768px) {
    .mp-dashboard {
        grid-template-columns: 1fr;
    }

    .mp-identity-card {
        flex-direction: column;
    }

    .mp-identity-divider {
        width: 100%;
        height: 1px;
        margin: 1rem 0;
    }

    .mp-network-widget {
        grid-template-columns: 1fr;
    }

    .mp-modal-content {
        max-height: 90vh;
        max-width: 95vw;
        padding: 1.5rem;
    }

    .mp-activity-search {
        width: 100%;
        min-width: 0;
    }

    .mp-activity-load-more {
        width: 100%;
        max-width: none;
    }
}
