/* ═══════════════════════════════════════════════════════════════════
   Unified Global Styles for Agent Overview / SalesPortal
   File: _content/SalesOffice.Components/css/agent-overview.css
   ═══════════════════════════════════════════════════════════════════ */

/* ── Container ──────────────────────────────────────────────────── */
.sales-dashboard-container {
    padding: 1.5rem 2rem 5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100%;
}

.sales-dashboard-container.page-container {
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ── Header ─────────────────────────────────────────────────────── */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.agent-list-header {
    justify-content: flex-start;
}

.header-breadcrumb {
    font-size: 0.78rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.15rem 0 0 0;
    color: #111;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Period Pill Selector ───────────────────────────────────────── */
.custom-period-select {
    display: flex;
    background: #e4e6ea;
    padding: 3px;
    border-radius: 9px;
}

.period-btn {
    border: none;
    background: none;
    padding: 6px 15px;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 7px;
    cursor: pointer;
    color: #555;
    transition: all 0.18s ease;
}

    .period-btn.active {
        background: #fff;
        color: #1E88E5;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }

    .period-btn:hover:not(.active) {
        background: rgba(255, 255, 255, 0.5);
    }

.active-date-label {
    font-size: 0.88rem;
    color: #777;
    font-weight: 500;
}

/* ── KPI Grid ───────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
}

.kpi-card-modern {
    background: #fff;
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid #eef0f4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s ease;
    cursor: pointer;
    user-select: none;
}

    .kpi-card-modern:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
        transform: translateY(-1px);
    }

    .kpi-card-modern.kpi-active {
        border-color: #1E88E5;
        box-shadow: 0 0 0 2.5px rgba(30, 136, 229, 0.18), 0 4px 16px rgba(0, 0, 0, 0.07);
    }

.kpi-caption {
    font-size: 0.82rem;
    color: #888;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: capitalize;
}

.card-cap-icon {
    font-size: 1.05rem;
    color: #90a4ae;
}

.kpi-value-modern {
    font-size: 2rem;
    font-weight: 800;
    color: #111;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.kpi-delta-text {
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

    .kpi-delta-text.pos {
        color: #2e7d32;
    }

    .kpi-delta-text.neg {
        color: #c62828;
    }

.delta-arrow {
    font-size: 0.95rem;
}

.kpi-subtext {
    font-size: 0.78rem;
    color: #aaa;
    margin-top: 2px;
}

/* ── Split Grids (60/40) ────────────────────────────────────────── */
.dashboard-split-grid,
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 60% 1fr;
    gap: 1.1rem;
}

/* Responsive side-by-side tables for Agent Specific bottom */
.agent-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ── Dashboard Panels ───────────────────────────────────────────── */
.dashboard-panel {
    background: #fff;
    border-radius: 14px;
    padding: 1.4rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 1px solid #eef0f4;
    display: flex;
    flex-direction: column;
}

.panel-agents {
    padding-bottom: 1.8rem;
}

.panel-trends {
    padding-bottom: 2rem;
}

.panel-live {
    padding-bottom: 2rem;
}

.agent-list-panel {
    padding: 0;
    margin-top: 20px;
    overflow: hidden;
}

.panel-header-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title-icon {
    color: #aaa;
    font-size: 1.15rem;
}

    .panel-title-icon.yellow {
        color: #fbc02d;
    }

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

    .panel-header-row .panel-header-title {
        margin-bottom: 0;
    }

/* ── Buttons ────────────────────────────────────────────────────── */
.view-all-btn {
    background: none;
    border: 1.5px solid #1E88E5;
    color: #1E88E5;
    padding: 4px 12px;
    border-radius: 7px;
    font-size: 0.79rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

    .view-all-btn:hover {
        background: #e3f2fd;
        border-color: #1565C0;
        color: #1565C0;
    }

.view-btn-small {
    padding: 4px 12px;
    font-size: 0.8rem;
}

/* ── Agent List on Dashboard ────────────────────────────────────── */
.agent-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

    .agent-list-wrapper::-webkit-scrollbar {
        width: 4px;
    }

    .agent-list-wrapper::-webkit-scrollbar-thumb {
        background: #ddd;
        border-radius: 2px;
    }

.agent-list-item {
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border-radius: 10px;
    transition: background 0.15s;
    cursor: pointer;
    gap: 12px;
}

    .agent-list-item:hover {
        background: #f5f7fb;
    }

.agent-avatar-circle {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.agent-avatar-small {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.88rem;
}

.agent-cell-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agent-info-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.agent-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-name-text {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-badge {
    background: #e3f2fd;
    color: #0d47a1;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Progress Bar ───────────────────────────────────────────────── */
.agent-bar-track {
    width: 100%;
    background-color: #f0f1f4;
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
}

.agent-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-stats-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 2px;
}

.agent-val-text {
    font-weight: 700;
    color: #111;
    font-size: 0.9rem;
    white-space: nowrap;
}

.agent-sub-text {
    font-size: 0.76rem;
    color: #aaa;
    white-space: nowrap;
}

/* ── Charts (Donut & Trend) ─────────────────────────────────────── */
.dashboard-donut-chart {
    width: 100%;
    height: 240px;
}

.agent-donut-chart {
    width: 100%;
    height: 260px;
}

.dashboard-line-chart {
    width: 100%;
    height: 240px;
}

.donut-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    flex: 1;
    min-height: 220px;
}

.donut-center-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.donut-center-value {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
    color: #111;
}

.donut-center-caption {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: 0.05em;
    color: #888;
}

.donut-empty-dash {
    font-size: 1.1rem;
    font-weight: 600;
    color: #bbb;
}

.donut-empty-text {
    font-size: 0.7rem;
    color: #ccc;
    margin-top: 3px;
}

.donut-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.4rem;
    margin-top: 0.9rem;
    justify-content: center;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.83rem;
    color: #555;
}

.donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend-label {
    font-weight: 500;
    text-transform: capitalize;
}

.donut-legend-val {
    font-weight: 700;
    color: #222;
    margin-left: 2px;
}

.trends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trends-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    font-size: 0.82rem;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

    .legend-dot.blue {
        background: #1E88E5;
    }

    .legend-dot.orange {
        background: #FB8C00;
    }

    .legend-dot.dashed {
        border-radius: 2px;
    }

.trend-chart-container {
    flex: 1;
    position: relative;
    min-height: 200px;
}

/* ── Live Activity ──────────────────────────────────────────────── */
.live-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-height: 300px;
    overflow-y: auto;
    padding-left: 2px;
    padding-right: 4px;
}

    .live-activity-list::-webkit-scrollbar {
        width: 4px;
    }

    .live-activity-list::-webkit-scrollbar-thumb {
        background: #e0e0e0;
        border-radius: 2px;
    }

.live-activity-item {
    display: flex;
    gap: 10px;
    position: relative;
}

    .live-activity-item::before {
        content: '';
        position: absolute;
        left: 5px;
        top: 14px;
        bottom: -18px;
        width: 2px;
        background: #f0f0f0;
    }

    .live-activity-item:last-child::before {
        display: none;
    }

.live-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    margin-top: 4px;
    z-index: 1;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.live-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.live-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.live-description {
    font-size: 0.86rem;
    color: #333;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.live-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

    .live-badge.order {
        background: #e3f2fd;
        color: #0d47a1;
    }

    .live-badge.offer {
        background: #fff3e0;
        color: #e65100;
    }

.live-time {
    font-size: 0.73rem;
    color: #bbb;
    margin-top: 2px;
}

.chart-empty-state,
.live-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #ccc;
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
    text-align: center;
}

/* ── Agent Specific Bottom Panels ───────────────────────────────── */
.agent-detail-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100%;
}

.agent-section-panel {
    background: #fff;
    border-radius: 14px;
    padding: 1.3rem 1.5rem 0.8rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 1px solid #eef0f4;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.agent-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.agent-section-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #222;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-section-badge {
    background: #e8f0fe;
    color: #1557b0;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: 6px;
}

.icon-assigned-customers {
    color: #1E88E5;
}

.icon-orders-offers {
    color: #FB8C00;
}

.agent-bottom-tables-column {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.dashboard-bottom-spacer {
    height: 60px;
    flex-shrink: 0;
    width: 100%;
}

/* ── Dialog & DataGrid Typography & Full Column Expansion ──────── */
.kpi-dialog-window {
    max-width: 95vw !important;
    max-height: 92vh !important;
    width: 1100px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
}

.kpi-dialog-window .rz-dialog-title-bar {
    padding: 1.1rem 1.6rem !important;
    border-bottom: 1px solid #edf0f5 !important;
}

.kpi-dialog-window .rz-dialog-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #111 !important;
}

.kpi-dialog-window .rz-dialog-content {
    padding: 1.25rem 1.75rem !important;
    max-height: calc(92vh - 80px) !important;
    overflow-y: auto !important;
}

.dialog-body-container {
    padding: 0.5rem 0;
    width: 100%;
}

.detail-datagrid {
    border: none !important;
    border-top: 1px solid #f0f0f0 !important;
    width: 100%;
}

/* Critical fix for "Be..." truncation: allow header title to never truncate */
.detail-datagrid th .rz-column-title {
    overflow: visible !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
}

.detail-datagrid .rz-cell-data {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-text-sales {
    color: #1E88E5 !important;
    font-weight: 700;
}

.kpi-text-orders {
    color: #1E88E5 !important;
    font-weight: 700;
}

.kpi-text-offers {
    color: #FB8C00 !important;
    font-weight: 700;
}

/* ── Responsive Breakpoints ─────────────────────────────────────── */
@media (min-width: 1400px) {
    .agent-tables-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .agent-tables-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sales-dashboard-container {
        padding: 1rem 1.2rem 5rem 1.2rem;
    }

    .dashboard-split-grid,
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }

    .agent-list-wrapper {
        max-height: 260px;
    }

    .live-activity-list {
        max-height: 220px;
    }

    .donut-chart-container {
        min-height: 180px;
    }
}

@media (max-width: 660px) {
    .sales-dashboard-container {
        padding: 0.75rem 0.9rem 5rem 0.9rem;
        gap: 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .custom-period-select {
        width: 100%;
    }

    .period-btn {
        flex: 1;
        text-align: center;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-title {
        font-size: 1.4rem;
    }

    .kpi-value-modern {
        font-size: 1.7rem;
    }

    .trends-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
