/* ==========================================================================
   SALES PORTAL SPECIFIC STYLES
   ========================================================================== */

/* --- Apple-style Segmented Capsule Controls --- */
.segmented-control {
    display: flex;
    background: #F1F5F9; /* Clean soft slate background */
    padding: 3px 3px 7px 3px; /* extra 4px bottom space for the scroll track */
    border-radius: 18px; /* Slightly reduced radius */
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.03);
    align-items: center;
    gap: 2px;
    position: relative;     /* required: track is positioned absolute inside */
    overflow-x: auto;       /* creates scroll context on ALL screen sizes so JS can measure scrollWidth */
    white-space: nowrap;    /* prevent tabs from wrapping */
    scrollbar-width: none;  /* Firefox: hide native scrollbar */
    -webkit-overflow-scrolling: touch;
}

.segmented-control::-webkit-scrollbar {
    display: none; /* Chrome/Safari: hide native scrollbar */
}

/* --- Inline Scroll Progress Track (inside the pill, bottom edge) --- */
.segmented-scroll-track {
    position: absolute;
    bottom: 3px;           /* sits inside the bottom padding zone */
    left: 10px;            /* inset from the rounded pill edges */
    right: 10px;
    height: 2px;
    background: rgba(15, 23, 42, 0.07); /* faint track rail */
    border-radius: 2px;
    overflow: hidden;
    /* Hidden by default — JS adds .has-scroll-overflow when needed */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Only show the track when content actually overflows */
.segmented-control.has-scroll-overflow .segmented-scroll-track {
    opacity: 1;
}

.segmented-scroll-thumb {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--accent-purple);
    border-radius: 2px;
    opacity: 0.55;
    /* left and width driven by JS — no CSS transition on left for instant response */
    transition: width 0.12s ease;
}

.segmented-btn {
    padding: 4px 10px; /* Super compact fit to stay inline with titles perfectly */
    font-size: 0.72rem; /* Slightly reduced to optimize space and visual weight */
    font-weight: 700;
    border-radius: 14px; /* Matches capsule outer curve */
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--text-sub);
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -0.15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.segmented-btn i {
    font-size: 0.8rem;
    transition: transform 0.25s ease;
}

.segmented-btn:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.04); /* Soft background hint on hover */
}

.segmented-btn:hover i {
    transform: scale(1.1);
}

.segmented-btn.active {
    background: #FFFFFF;
    color: var(--accent-purple);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12), 0 1px 3px rgba(0, 0, 0, 0.02);
}

.segmented-btn.active:hover {
    background: #FFFFFF;
    color: var(--accent-purple);
    transform: translateY(-0.5px) scale(1.01);
}

/* Alert styling for Unassigned Inbound Leads */
.command-card-orange.alert-pulse {
    background: rgba(249, 115, 22, 0.04);
    border-color: rgba(249, 115, 22, 0.35);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.08);
    animation: cardGlowAlert 2s infinite ease-in-out;
}

.command-card-orange.alert-pulse .command-card-value {
    color: var(--accent-orange);
}

@keyframes cardGlowAlert {
    0% { border-color: rgba(249, 115, 22, 0.35); box-shadow: 0 0 15px rgba(249, 115, 22, 0.08); }
    50% { border-color: rgba(249, 115, 22, 0.6); box-shadow: 0 0 25px rgba(249, 115, 22, 0.18); }
    100% { border-color: rgba(249, 115, 22, 0.35); box-shadow: 0 0 15px rgba(249, 115, 22, 0.08); }
}

/* --- Sales Donut Chart Card --- */
.sales-donut-card {
    height: 500px !important; /* Restored to 500px for absolute grid balance */
}

/* --- Admin Funnel 2-Column Grid adapter --- */
.admin-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* --- RESPONSIVE MEDIA QUERIES FOR SALES SPECIFICS --- */

/* === STICKY FIRST COLUMN — Team Summary Table ===
   Enables horizontal scroll on the sparkline table wrapper while keeping
   the Telecaller name column always visible (sticky left).
*/
#sales-perf-sparkline-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#sales-perf-sparkline-table-wrapper .premium-table th:first-child,
#sales-perf-sparkline-table-wrapper .premium-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--dash-card);
    z-index: 2;
    border-right: 1px solid var(--dash-border);
}

@media (max-width: 550px) {
    .admin-chart-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    /* Reduce map card minimum height on mobile */
    .sales-leads-map-container {
        min-height: 400px !important;
    }

    /* Reduce page header font on smaller screens */
    .page-header-title {
        font-size: 1.25rem !important;
    }

    .page-header-subtitle {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 991px) {
    .segmented-control {
        max-width: 100% !important;
        padding: 4px 8px 9px 8px !important; /* preserve bottom space for track on mobile */
    }

    .segmented-btn {
        flex: 0 0 auto !important;
    }
}
