/*
================================================================================
Broker/Branch Dashboard CSS Styles
Covers both empty state (onboarding incomplete) and full state (onboarding
complete). Greeting and Welcome Banner reuse shared classes from dashboard.css
and borrower-onboarding-hub.css. This file contains broker-specific dashboard
card styles (context bar, cards, table, list items, badges, analytics).
================================================================================
*/

/* ============================================================================
   CONTEXT BAR
   ============================================================================ */

.broker-dashboard__context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: #FFFFFF;
    border: 1px solid #D8DCEB;
    border-radius: 8px;
    margin-bottom: 24px;
}

.broker-dashboard__context-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.broker-dashboard__context-label {
    font-family: 'Wavehaus', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #13151A;
}

.broker-dashboard__context-link {
    font-family: 'Wavehaus', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #002BC6;
    text-decoration: underline;
    cursor: pointer;
}

.broker-dashboard__context-link:hover {
    color: #001d8a;
    text-decoration: underline;
}

.broker-dashboard__context-divider {
    width: 1px;
    height: 20px;
    background: #C7CBD9;
    flex-shrink: 0;
}

/* ============================================================================
   DASHBOARD CARDS
   ============================================================================ */

.broker-dashboard__card {
    background: #FFFFFF;
    border: 1px solid #E4E8F7;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

/* ============================================================================
   FEES CARD
   ============================================================================ */

.broker-dashboard__card-header--fees {
    align-items: flex-start;
}

.broker-dashboard__fees-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.broker-dashboard__fees-subtitle {
    font-family: 'Wavehaus', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #13151A;
    margin: 0;
    line-height: 1.4;
}

.broker-dashboard__card-see-all--underline {
    text-decoration: underline;
    font-size: 16px;
    flex-shrink: 0;
    align-self: flex-start;
}

.broker-dashboard__fees-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Blue origination section */
.broker-dashboard__fees-lender {
    background: #002BC6;
    border-radius: 8px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.broker-dashboard__fees-lender-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.broker-dashboard__fees-lender-icon {
    flex-shrink: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.broker-dashboard__fees-lender-label {
    font-family: 'Wavehaus', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
}

.broker-dashboard__fees-lender-value-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-left: 33px;
}

.broker-dashboard__fees-lender-value {
    font-family: 'Wavehaus', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.23;
}

.broker-dashboard__fees-lender-subtotal {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    color: #C7CBD9;
    margin-bottom: 3px;
}

.broker-dashboard__fees-lender-subtotal-hi {
    color: #FFFFFF;
}

/* Broker / Branches section */
.broker-dashboard__fees-branches {
    padding: 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.broker-dashboard__fees-branches-title {
    font-family: 'Wavehaus', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #13151A;
    margin: 0;
    line-height: 1.23;
}

.broker-dashboard__fees-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 32px;
}

.broker-dashboard__fees-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.broker-dashboard__fees-item-value {
    font-family: 'Wavehaus', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #393E4D;
    line-height: 1.23;
}

.broker-dashboard__fees-item-label {
    font-family: 'Wavehaus', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #73788C;
    line-height: 1.4;
}

.broker-dashboard__card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E4E8F7;
}

.broker-dashboard__card-title {
    font-family: 'Wavehaus', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #13151A;
    margin: 0;
}

.broker-dashboard__card-see-all {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #002BC6;
    text-decoration: underline;
    cursor: pointer;
}

.broker-dashboard__card-see-all:hover {
    color: #001d8a;
    text-decoration: underline;
}

.broker-dashboard__card-share-link {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #002BC6;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.broker-dashboard__card-share-link:hover {
    text-decoration: underline;
    color: #002BC6;
}

/* Card Empty State */
.broker-dashboard__card-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    background: #F8F9FC;
    border-radius: 8px;
}

.broker-dashboard__card-empty--compact {
    padding: 24px 16px;
}

.broker-dashboard__card-empty-title {
    font-family: 'Wavehaus', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #002BC6;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.broker-dashboard__card-empty-text {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #535766;
    margin: 0 0 16px 0;
    line-height: 1.5;
    max-width: 400px;
}

.broker-dashboard__card-empty-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: transparent;
    color: #002BC6;
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #002BC6;
    border-radius: 45px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.broker-dashboard__card-empty-cta:hover {
    background: #002BC6;
    color: #FFFFFF;
}

.broker-dashboard__card-empty-cta--small {
    padding: 8px 20px;
    font-size: 13px;
}

.broker-dashboard__card-empty-cta--outline {
    background: transparent;
    color: #002BC6;
    border: 2px solid #002BC6;
}

.broker-dashboard__card-empty-cta--outline:hover {
    background: #002BC6;
    color: #FFFFFF;
}

/* Elevated card (box-shadow for full-state cards) */
.broker-dashboard__card--elevated {
    box-shadow: 6px 6px 54px rgba(0, 0, 0, 0.05);
}

/* Grid Row (Messages + Team side by side) */
.broker-dashboard__grid-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.broker-dashboard__card--half {
    flex: 1;
    margin-bottom: 0;
}

.broker-dashboard__grid-row > .broker-dashboard__card:not(.broker-dashboard__card--half) {
    flex: 1 1 100%;
    width: 100%;
    margin-bottom: 0;
}

/* ============================================================================
   ANALYTICS SNAPSHOT
   ============================================================================ */

.broker-dashboard__analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.broker-dashboard__analytics-item {
    background: #F8F9FC;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.broker-dashboard__analytics-value {
    display: flex;
    align-items: center;
    gap: 6px;
}

.broker-dashboard__analytics-number {
    font-family: 'Wavehaus', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #13151A;
    line-height: 1;
}

.broker-dashboard__analytics-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.broker-dashboard__analytics-icon--green {
    color: #14AE5C;
}

.broker-dashboard__analytics-icon--blue {
    color: #002BC6;
}

.broker-dashboard__analytics-label {
    font-family: 'Wavehaus', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #535766;
    line-height: 1.3;
}

/* ============================================================================
   CARD HEADER META (e.g. "10 loan officers plan")
   ============================================================================ */

.broker-dashboard__card-header-meta {
    font-family: 'Wavehaus', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #535766;
    margin-left: 8px;
    flex: 1;
}

/* ============================================================================
   APPLICATIONS TABLE (Full State)
   ============================================================================ */

.broker-dashboard__table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.broker-dashboard__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
}

.broker-dashboard__table thead th {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #13151A;
    background: #F5F7FC;
    padding: 8px 8px;
    line-height: 30px;
    white-space: nowrap;
    text-align: left;
    border: none;
}

.broker-dashboard__table tbody td {
    padding: 8px 8px;
    white-space: nowrap;
}

/* Column widths: Name gets the most space, rest fits content */
.broker-dashboard__table thead th:nth-child(1),
.broker-dashboard__table tbody td:nth-child(1) { width: 14%; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.broker-dashboard__table thead th:nth-child(2),
.broker-dashboard__table tbody td:nth-child(2) { width: 8%; }
.broker-dashboard__table thead th:nth-child(3),
.broker-dashboard__table tbody td:nth-child(3) { width: 10%; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.broker-dashboard__table thead th:nth-child(4),
.broker-dashboard__table tbody td:nth-child(4) { width: 6%; }
.broker-dashboard__table thead th:nth-child(5),
.broker-dashboard__table tbody td:nth-child(5) { width: 7%; }
.broker-dashboard__table thead th:nth-child(6),
.broker-dashboard__table tbody td:nth-child(6) { width: 8%; }
.broker-dashboard__table thead th:nth-child(7),
.broker-dashboard__table tbody td:nth-child(7) { width: 9%; text-align: left; }
.broker-dashboard__table thead th:nth-child(8),
.broker-dashboard__table tbody td:nth-child(8) { width: 7%; text-align: left; }
.broker-dashboard__table thead th:nth-child(9),
.broker-dashboard__table tbody td:nth-child(9) { width: 7%; text-align: left; }
.broker-dashboard__table thead th:nth-child(10),
.broker-dashboard__table tbody td:nth-child(10) { width: 18%; }

.broker-dashboard__table thead th:first-child {
    border-radius: 8px 0 0 8px;
}

.broker-dashboard__table thead th:last-child {
    border-radius: 0 8px 8px 0;
}

.broker-dashboard__table tbody tr {
    background: #FFFFFF;
    transition: background 0.15s ease;
}

.broker-dashboard__table tbody tr:nth-child(odd) {
    background: #F5F7FC;
}

.broker-dashboard__table tbody tr:nth-child(even) {
    background: #FFFFFF;
}

/* Hover / selected row: grey bg + blue right border */
.broker-dashboard__table tbody tr:hover,
.broker-dashboard__table tbody tr.broker-dashboard__table-row--hover {
    background: #D8DCEB;
}

.broker-dashboard__table tbody tr:hover td:last-child,
.broker-dashboard__table tbody tr.broker-dashboard__table-row--hover td:last-child {
    border-right: 3px solid #002BC6;
}

.broker-dashboard__table tbody td {
    padding: 8px 16px;
    line-height: 30px;
    color: #535766;
    font-weight: 500;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid #F5F7FC;
    white-space: nowrap;
}

.broker-dashboard__table-name {
    width: 130px;
    min-width: 130px;
}

.broker-dashboard__table-address {
    width: 205px;
    min-width: 180px;
    white-space: normal !important;
    line-height: 1.3 !important;
}

.broker-dashboard__table-amount,
.broker-dashboard__table-rate {
    text-align: right;
}

/* Status Frame (badge + chevron) */
.broker-dashboard__status-frame {
    display: flex;
    align-items: center;
    gap: 4px;
}

.broker-dashboard__status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border-radius: 16px;
    font-family: 'Wavehaus', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
    min-width: 110px;
    height: 24px;
    box-sizing: border-box;
}

/* SUBMITTED — Blue/Green */
.broker-dashboard__status--submitted {
    background: rgba(223, 236, 226, 0.6);
    border: 1px solid #14AE5C;
    color: #005337;
}

/* IN REVIEW — Orange */
.broker-dashboard__status--in-review {
    background: #FFFAEB;
    border: 1px solid #B54708;
    color: #B54708;
}

/* APPROVED — Green */
.broker-dashboard__status--approved {
    background: rgba(223, 236, 226, 0.6);
    border: 1px solid #14AE5C;
    color: #005337;
}

/* FUNDED — Grey */
.broker-dashboard__status--funded {
    background: #C7CBD9;
    border: 1px solid #73788C;
    color: #535766;
}

/* DENIED */
.broker-dashboard__status--denied {
    background: #FEE4E2;
    border: 1px solid #D92D20;
    color: #B42318;
}

.broker-dashboard__row-action {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

/* Mobile applications (hidden on desktop) */
.broker-dashboard__mobile-apps {
    display: none;
}

/* ============================================================================
   LIST ITEMS (Messages + Team Collaboration)
   ============================================================================ */

.broker-dashboard__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.broker-dashboard__list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border-radius: 0;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    min-height: 46px;
    border-bottom: 1px solid #F5F7FC;
}

.broker-dashboard__list-item:hover,
.broker-dashboard__list-item.broker-dashboard__list-item--hover {
    background: #D8DCEB;
    border-right: 3px solid #002BC6;
}

.broker-dashboard__list-item:hover {
    text-decoration: none;
    color: inherit;
}

.broker-dashboard__list-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.broker-dashboard__list-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.broker-dashboard__list-name {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #13151A;
    white-space: nowrap;
}

.broker-dashboard__list-meta {
    font-family: 'Wavehaus', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #13151A;
    white-space: nowrap;
}

.broker-dashboard__list-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Badges */
.broker-dashboard__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 16px;
    font-family: 'Wavehaus', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.4;
}

.broker-dashboard__badge--new {
    background: rgba(223, 236, 226, 0.6);
    border: 1px solid #005337;
    color: #005337;
}

.broker-dashboard__badge--active {
    background: rgba(223, 236, 226, 0.6);
    border: 1px solid #14AE5C;
    color: #005337;
}

/* ============================================================================
   FLOATING BUTTON — Override position to avoid overlap with borrower button
   ============================================================================ */

#broker-onboarding-progress-btn-floating {
    display: inline-flex !important;
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
}

#broker-onboarding-progress-btn-floating.is-ready {
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
}

/* ============================================================================
   RESPONSIVE — TABLET (max-width: 992px)
   ============================================================================ */

@media (max-width: 992px) {
    .broker-dashboard__context-bar {
        flex-wrap: wrap;
        gap: 12px 24px;
    }

    .broker-dashboard__grid-row {
        flex-direction: column;
        gap: 16px;
    }

    .broker-dashboard__analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .broker-dashboard__table-wrap {
        overflow-x: auto;
    }
}

/* ============================================================================
   RESPONSIVE — MOBILE (max-width: 768px)
   ============================================================================ */

@media (max-width: 768px) {
    .broker-dashboard__context-bar {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .broker-dashboard__context-divider {
        width: 100%;
        height: 1px;
    }

    .broker-dashboard__card {
        padding: 16px;
    }

    .broker-dashboard__card-empty {
        padding: 24px 16px;
    }

    .broker-dashboard__analytics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Hide desktop table, show mobile cards */
    .broker-dashboard__table-wrap {
        display: none;
    }

    .broker-dashboard__mobile-apps {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .broker-dashboard__mobile-app-card {
        background: #F5F7FC;
        border-radius: 8px;
        padding: 16px;
    }

    .broker-dashboard__mobile-app-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
    }

    .broker-dashboard__mobile-app-name {
        font-family: 'Wavehaus', sans-serif;
        font-size: 14px;
        font-weight: 600;
        color: #13151A;
    }

    .broker-dashboard__mobile-app-details {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .broker-dashboard__mobile-app-row {
        display: flex;
        justify-content: space-between;
        font-family: 'Montserrat', sans-serif;
        font-size: 13px;
        color: #535766;
    }

    .broker-dashboard__mobile-app-row span:first-child {
        font-weight: 600;
        color: #13151A;
    }

    /* List items stack better on mobile */
    .broker-dashboard__list-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .broker-dashboard__list-meta {
        font-size: 12px;
    }

    .broker-dashboard__card-header-meta {
        display: none;
    }

    /* Fees card — tighter on mobile */
    .broker-dashboard__fees-lender {
        padding: 16px 12px;
    }

    .broker-dashboard__fees-lender-value-row {
        padding-left: 0;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }

    .broker-dashboard__fees-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px 16px;
    }

    /* Team Collaboration card — stack name + badge on mobile */
    .broker-dashboard__list-item {
        flex-wrap: wrap;
        gap: 6px;
        min-height: auto;
        padding: 10px 12px;
    }

    .broker-dashboard__list-actions {
        width: 100%;
        justify-content: space-between;
    }

    .broker-dashboard__badge {
        font-size: 11px;
        white-space: normal;
        text-align: left;
    }
}

/* ============================================================================
   RESPONSIVE — SMALL MOBILE (max-width: 480px)
   ============================================================================ */

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

    .broker-dashboard__analytics-number {
        font-size: 24px;
    }
}
