/* =============================================
   BFL Package Selector Popup
   Version: 2.0.0 — Clean Cards
   ============================================= */

/* === Overlay === */
.bfl-pkg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}
.bfl-pkg-overlay.bfl-pkg-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* === Popup Container === */
.bfl-pkg-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #f6f7f9;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
}
.bfl-pkg-popup.bfl-pkg-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Tablet */
@media (min-width: 768px) {
    .bfl-pkg-popup {
        inset: 3vh 5vw;
        border-radius: 20px;
        transform: translateY(30px);
        box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    }
    .bfl-pkg-popup.bfl-pkg-active {
        transform: translateY(0);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .bfl-pkg-popup {
        inset: 4vh auto;
        left: 50%;
        transform: translate(-50%, 30px);
        width: 920px;
        max-height: 92vh;
        border-radius: 20px;
    }
    .bfl-pkg-popup.bfl-pkg-active {
        transform: translate(-50%, 0);
    }
}

/* === Header === */
.bfl-pkg-header {
    padding: 14px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e8eaef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.bfl-pkg-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.bfl-pkg-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #eef4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a6df5;
}
.bfl-pkg-header-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1e2e;
}
.bfl-pkg-header-sub {
    font-size: 11px;
    color: #8b91a8;
    font-weight: 500;
}
.bfl-pkg-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: #f0f1f5;
    font-size: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5068;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}
.bfl-pkg-close::before,
.bfl-pkg-close::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 2px;
    background: #4a5068;
    border-radius: 2px;
    transition: background 0.2s;
}
.bfl-pkg-close::before { transform: rotate(45deg); }
.bfl-pkg-close::after { transform: rotate(-45deg); }
.bfl-pkg-close:hover {
    background: #e8eaef;
}
.bfl-pkg-close:hover::before,
.bfl-pkg-close:hover::after {
    background: #1a1e2e;
}

/* === Pickup Strip (below header) === */
.bfl-pkg-popup-pickup {
    padding: 10px 20px;
    background: #ecfdf5;
    font-size: 13px;
    font-weight: 600;
    color: #1a1e2e;
    border-bottom: 1px solid #d1fae5;
    flex-shrink: 0;
}
.bfl-pkg-popup-pickup strong {
    color: #059669;
    font-weight: 700;
}

/* === Scroll Area === */
.bfl-pkg-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
    .bfl-pkg-scroll {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        padding: 24px;
        align-content: start;
    }
}

/* === Package Card === */
.bfl-pkg-card {
    background: #ffffff;
    border-radius: 14px;
    border: 2px solid #e8eaef;
    padding: 16px;
    margin-bottom: 14px;
    transition: border-color 0.25s, box-shadow 0.25s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: visible;
}
.bfl-pkg-card:last-child {
    margin-bottom: 0;
}
.bfl-pkg-card:hover {
    border-color: #c5d9fc;
    box-shadow: 0 4px 16px rgba(26,109,245,0.08);
}
.bfl-pkg-card.bfl-pkg-selected {
    border-color: #1a6df5;
    box-shadow: 0 4px 20px rgba(26,109,245,0.15);
}
@media (min-width: 1024px) {
    .bfl-pkg-card {
        margin-bottom: 0;
    }
}

/* Selected check */
.bfl-pkg-check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #1a6df5;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(26,109,245,0.3);
}
.bfl-pkg-card.bfl-pkg-selected .bfl-pkg-check {
    display: flex;
}

/* Name & Caption */
.bfl-pkg-name {
    font-size: 17px;
    font-weight: 700;
    color: #1a1e2e;
    margin-bottom: 2px;
    padding-right: 36px;
}
.bfl-pkg-caption {
    font-size: 13px;
    color: #4a5068;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Chips */
.bfl-pkg-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.bfl-pkg-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #4a5068;
}

/* Route */
.bfl-pkg-route {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f6f7f9;
    border-radius: 8px;
}
.bfl-pkg-stop {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #4a5068;
    white-space: nowrap;
}
.bfl-pkg-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1a6df5;
    margin-right: 5px;
    flex-shrink: 0;
}
.bfl-pkg-arr {
    margin: 0 6px;
    color: #c5d9fc;
    font-size: 10px;
    flex-shrink: 0;
}

/* Includes */
.bfl-pkg-inc-label {
    font-size: 12px;
    font-weight: 700;
    color: #1a1e2e;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.bfl-pkg-inc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 12px;
}
.bfl-pkg-inc {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    font-size: 12px;
    color: #4a5068;
    line-height: 1.4;
}
.bfl-pkg-ic {
    flex-shrink: 0;
    font-size: 11px;
    margin-top: 1px;
}
.bfl-pkg-ic-y { color: #10b981; }
.bfl-pkg-ic-n { color: #ef4444; }

/* Pricing — hidden in Clean Cards */
.bfl-pkg-price-row { display: none !important; }

/* V1 Price Breakdown */
.bfl-pkg-v1 { margin-top: 12px; margin-bottom: 12px; }
.bfl-pkg-v1-top {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: #eff6ff; border-radius: 10px 10px 0 0;
    border: 1px solid #bfdbfe; border-bottom: none;
}
.bfl-pkg-v1-label { font-size: 12px; font-weight: 600; color: #2563eb; }
.bfl-pkg-v1-total { font-size: 20px; font-weight: 800; color: #2563eb; }
/* R5 Best Value Ribbon — Top Drop */
.bfl-pkg-best-ribbon {
    position: absolute;
    top: -1px;
    right: 16px;
    padding: 5px 10px 6px;
    background: #6366f1;
    color: #ffffff;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 700;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 2px 4px rgba(99,102,241,0.25);
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
    letter-spacing: 0.3px;
}
.bfl-pkg-v1-cells {
    display: flex; gap: 0; border: 1px solid #e5e7eb; border-top: none;
    border-radius: 0 0 10px 10px; overflow: hidden;
}
.bfl-pkg-v1-cell {
    flex: 1; text-align: center; padding: 10px 4px;
    background: #ffffff;
}
.bfl-pkg-v1-cell:not(:last-child) { border-right: 1px solid #e5e7eb; }
.bfl-pkg-v1-calc { font-size: 11px; color: #9ca3af; margin-bottom: 3px; }
.bfl-pkg-v1-calc strong { color: #4b5563; font-weight: 600; }
.bfl-pkg-v1-result { font-size: 15px; font-weight: 800; color: #111827; }
.bfl-pkg-v1-result-free { color: #059669 !important; font-size: 13px !important; }
.bfl-pkg-v1-type { font-size: 9px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }
.bfl-pkg-v1-trust {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    margin-top: 8px; font-size: 10px; color: #059669; font-weight: 600;
}

/* Select Button — base */
.bfl-pkg-btn {
    width: 100%;
    margin-top: 12px;
    padding: 11px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}
/* Outline variant (non-best-value) */
.bfl-pkg-btn-outline {
    border: 1.5px solid #1a6df5 !important;
    background: #ffffff !important;
    color: #1a6df5 !important;
}
.bfl-pkg-btn-outline:hover {
    background: #eef4ff !important;
}
/* Filled variant (best value) */
.bfl-pkg-btn-fill {
    border: 1.5px solid #1a6df5 !important;
    background: #1a6df5 !important;
    color: #ffffff !important;
}
.bfl-pkg-btn-fill:hover {
    background: #1557d0 !important;
    border-color: #1557d0 !important;
}
/* Selected state — always filled */
.bfl-pkg-card.bfl-pkg-selected .bfl-pkg-btn {
    background: #1a6df5 !important;
    color: #ffffff !important;
    border-color: #1a6df5 !important;
}

/* === Trust Footer (popup bottom) === */
.bfl-pkg-trust-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background: #ffffff;
    border-top: 1px solid #e8eaef;
    font-size: 12px;
    font-weight: 600;
    color: #059669;
    flex-shrink: 0;
}

/* Pickup chip — hidden in Clean Cards (moved to popup header) */
.bfl-pkg-chips { display: none !important; }
.bfl-pkg-chip-pickup { display: none !important; }

/* Per-card trust — hidden in Clean Cards (moved to popup footer) */
.bfl-pkg-v1-trust { display: none !important; }

/* Package details */
.bfl-pkg-detail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #eef4ff;
    border-radius: 8px;
}
.bfl-pkg-detail-item {
    font-size: 12px;
    font-weight: 600;
    color: #1a6df5;
    white-space: nowrap;
}

/* Mobile: single column (≤600px already default since grid starts at 1024px) */
@media (max-width: 600px) {
    .bfl-pkg-popup-pickup {
        font-size: 12px;
        padding: 8px 16px;
    }
    .bfl-pkg-trust-footer {
        font-size: 11px;
        padding: 10px 16px;
    }
}

/* Card animation */
@keyframes bflPkgCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card {
    animation: bflPkgCardIn 0.4s ease both;
}
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card:nth-child(1) { animation-delay: 0.05s; }
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card:nth-child(2) { animation-delay: 0.1s; }
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card:nth-child(3) { animation-delay: 0.15s; }
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card:nth-child(4) { animation-delay: 0.2s; }
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card:nth-child(5) { animation-delay: 0.25s; }
.bfl-pkg-popup.bfl-pkg-active .bfl-pkg-card:nth-child(6) { animation-delay: 0.3s; }
