.pill-dropdown {
    border-radius: 50px !important;
    background-color: #fff !important;
    border: 1px solid #e9ecef !important;
    height: 40px !important;
    display: flex;
    align-items: center;
}

.filter-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 5px;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-scroll-container::-webkit-scrollbar {
    display: none;
}

.filter-wrap-container {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
    padding: 10px 5px;
    gap: 12px;
}

.filter-item {
    flex: 0 0 auto;
    min-width: 100px;
}

.filter-item:last-child {
    padding-right: 80px;
}

.filter-item-wide {
    flex: 0 0 auto;
    min-width: 200px;
}

/* Refined timeline logic for dynamic colors */
.timeline-container {
    position: relative;
    padding-left: 0;
    /* Remove padding to allow precise line placement */
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Remove old global line */
.timeline-line-global {
    display: none;
}

.timeline-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 8px 0;
    margin-left: 40px;
    /* Maintain item indentation */
    flex-shrink: 0;
    flex-grow: 1; /* Stretch to fill container vertically */
    flex-basis: 0; /* Ensure equal height distribution */
}

/* The connecting line from previous item to this item */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px; /* Align with dot center */
    top: -50%;   /* Reach up to previous item's center */
    bottom: 50%; /* End at this item's center */
    width: 2px;
    border-left: 2px dashed #1cb09a;
    z-index: 1;
}

/* Apply yellow color when zero */
.timeline-item.zero::before {
    border-left-style: solid !important;
    border-left-color: #f1c40f !important;
}

/* The final line from the last item down to the truck */
.timeline-item:last-of-type::after {
    content: '';
    position: absolute;
    left: -29px;
    top: 50%; /* Start at the center of this item (the dot) */
    bottom: -20px; /* Stretch down far enough to reach the truck */
    width: 2px;
    border-left: 2px dashed #1cb09a;
    z-index: 1;
}

.timeline-item.zero:last-of-type::after {
    border-left-style: solid !important;
    border-left-color: #f1c40f !important;
}

.timeline-connector {
    display: none !important; /* Hide original separate connectors */
}

.timeline-connector.zero {
    display: none !important;
}

.timeline-item.zero .timeline-dot {
    background-color: #f1c40f !important;
}

.timeline-icon-bottom.zero {
    color: #f1c40f !important;
}

.timeline-dot {
    position: absolute;
    left: -34px;
    width: 12px;
    height: 12px;
    background-color: #1cb09a;
    border-radius: 50%;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
}

.timeline-dot-main {
    position: relative;
    left: -40px;
    width: 24px;
    height: 24px;
    background-color: #1cb09a;
    border: 3px solid #d1efea;
    animation: pulse 2s infinite;
    border-radius: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-icon-bottom {
    position: relative;
    left: 2px;
    margin-left: 0;
    color: #1cb09a;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align icon start at 2px */
    min-height: 24px;
    background-color: #ffffff; /* Hide the line passing behind it */
    box-shadow: 0 0 0 10px #ffffff; /* White halo to hide the line end */
    border-radius: 50%;
}

/* Dots and Icons z-index fix */
.timeline-dot,
.timeline-dot-main,
.timeline-icon-bottom i {
    z-index: 3;
}

.timeline-dot-wrapper {
    position: relative;
    margin-left: 40px;
    /* Align with items */
    z-index: 2;
    flex-grow: 1;
    flex-basis: 0; /* Ensure equal height distribution */
    display: flex;
    align-items: center;
}

.timeline-line-segment {
    position: absolute;
    left: 11px;
    width: 2px;
    border-left: 2px dashed #1cb09a;
    z-index: 1;
}


.filter-mobile-popup {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
}

/* Ensure Radzen and AntDesign panels are on top of our mobile popup */
.rz-dropdown-panel,
.rz-datepicker-panel,
.rz-autocomplete-panel,
.rz-multiselect-panel,
.ant-picker-dropdown,
.ant-select-dropdown {
    z-index: 10005 !important;
}

/* AntDesign RangePicker: Fit side-by-side if screen permits, otherwise stack on top */
.ant-picker-panels {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

.ant-picker-panel {
    flex: 0 0 auto !important;
}

.ant-picker-dropdown {
    max-width: 98vw !important;
}

/* Fix dropdown panels on mobile to position at bottom-left */
@media (max-width: 768px) {

    .ant-picker-dropdown,
    .ant-select-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 1.5rem !important;
        left: 1rem !important;
        right: auto !important;
        width: auto !important;
        max-width: calc(100vw - 2rem) !important;
        transform: none !important;
    }

    .ant-picker-panel-container {
        width: auto !important;
        min-width: min-content !important;
        max-width: 100vw !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .ant-picker-range-arrow {
        display: none !important;
    }

    .ant-picker-panels {
        flex-direction: column !important;
    }
}

.filter-mobile-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* Prevents header from shrinking */
}

.filter-mobile-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    padding: 1.5rem 1rem;
    touch-action: pan-y;
}

.filter-mobile-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    /* Prevents footer from shrinking */
}

/* Visibility classes */
@media (max-width: 991.98px) {
    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .hide-on-mobile {
        display: block !important;
    }

    .show-on-mobile {
        display: none !important;
    }
}

.bg-gray-50 {
    background-color: #fcfcfc;
}

.shadow-inner {
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.03);
}

.pointer-events-none {
    pointer-events: none;
}

/* RadzenTabs pill styling */
.log-transaksi-tabs .rz-tabview-nav {
    background: transparent !important;
    border-bottom: none !important;
    padding: 0;
    gap: 4px;
}

.log-transaksi-tabs .rz-tabview-nav>li {
    border: none !important;
    margin-bottom: 0;
}

.log-transaksi-tabs .rz-tabview-nav>li>a {
    border: none !important;
    border-radius: 50px !important;
    font-weight: 700 !important;
    padding: 0.45rem 1.25rem !important;
    color: #6c757d !important;
    background: #ffffff !important;
    transition: all 0.2s;
}

.log-transaksi-tabs .rz-tabview-nav>li.rz-tabview-selected>a {
    background-color: #1BAA9B !important;
    color: #fff !important;
}

.log-transaksi-tabs .rz-tabview-panels {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Chart content row transition */
.chart-content-row {
    transition: opacity 0.4s ease;
}

/* Inventory map tooltips */
.inv-map-tooltip .leaflet-tooltip {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.inv-map-tooltip {
    background: #fff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10) !important;
    pointer-events: none;
}

.inv-map-tooltip-inner {
    min-width: 170px;
    font-family: inherit;
}

.inv-map-tooltip-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
    color: #212529;
    border-bottom: 1px solid #f1f3f5;
    padding-bottom: 6px;
}

.inv-map-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 12px;
}

.inv-map-tooltip-label {
    font-size: 11px;
    color: #6c757d;
    white-space: nowrap;
}

.inv-map-tooltip-value {
    font-size: 12px;
    font-weight: 700;
    color: #212529;
}

.inv-map-tooltip-value.text-danger-soft {
    color: #dc3545;
}

.inv-map-tooltip-value.text-success-soft {
    color: #1baa9b;
}

/* Mobile responsive overrides for Kadar Penggunaan Stok dashboard */
@media (max-width: 991.98px) {
    #map-inventory {
        min-height: 320px !important;
    }

    .chart-canvas-container {
        height: 300px !important;
    }

    .map-middle-label {
        font-size: 0.85rem;
        padding: 12px 18px;
        max-width: calc(100vw - 3rem);
        width: auto;
    }
}