/* =========================================================
   bmanager.io ShopFinder – Complete CSS (Modal + List + Map)
   Goals:
   - Confirm button always visible (sticky footer)
   - Correct height on real phones (use dvh with fallbacks)
   - Mobile map not too tall
   - GLS icons centered + larger
   ========================================================= */

/* -----------------------------
   Modal backdrop
----------------------------- */
.bmanager-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    inset: 0;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Utility */
button.shopfinder-btn {
    border-radius: 30px !important;
}

/* -----------------------------
   Modal content wrapper
   Use dvh to avoid "too tall" on real phones
----------------------------- */
.bmanager-modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 1000px;

    /* Center with safe margins */
    margin: 16px auto;

    border-radius: 16px;
    box-shadow:
            0 25px 50px -12px rgba(0, 0, 0, 0.25),
            0 0 0 1px rgba(0, 0, 0, 0.05);

    display: flex;
    flex-direction: column;

    /* Never let modal content overflow weirdly */
    overflow: hidden;

    /* Height – robust across mobile address bars */
    height: 90vh;   /* fallback */
    height: 90dvh;  /* modern mobile */
    max-height: calc(100dvh - 24px);
}

/* iOS safe areas (top/bottom) */
@supports (padding: max(0px)) {
    .bmanager-modal-content {
        max-height: calc(
                100dvh
                - env(safe-area-inset-top)
                - env(safe-area-inset-bottom)
                - 16px
        );
    }
}

/* -----------------------------
   Header
----------------------------- */
.bmanager-modal-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

/* Close button */
.bmanager-close {
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    margin-top: -4px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bmanager-close:hover {
    color: #0f172a;
}

/* -----------------------------
   Body layout area (fills remaining height)
   Scroll happens inside list/map (not whole modal)
----------------------------- */
.bmanager-layout {
    flex: 1 1 auto;
    display: flex;
    gap: 18px;

    padding: 18px 20px;
    overflow: hidden;
    background: #ffffff;
}

/* -----------------------------
   List column
----------------------------- */
.bmanager-list-view {
    flex: 1 1 0;
    overflow: auto;

    background: #f7f5f5;
    padding: 14px;
    border-radius: 18px;

    -webkit-overflow-scrolling: touch;
}

/* Subtle scrollbar */
.bmanager-list-view::-webkit-scrollbar { width: 6px; }
.bmanager-list-view::-webkit-scrollbar-track { background: transparent; }
.bmanager-list-view::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

/* -----------------------------
   Map column
----------------------------- */
.bmanager-map-view {
    flex: 1.5 1 0;
    overflow: hidden;
    border-radius: 12px;
}

#bmanager-map {
    width: 100%;
    height: 100%;
    min-height: 420px; /* desktop baseline */
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* -----------------------------
   List styling
----------------------------- */
#bmanager-shop-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#bmanager-shop-list li {
    display: flex;
    align-items: center; /* vertical center icon */
    gap: 12px;
    padding: 12px;

    border: 1px solid #f1f5f9;
    border-radius: 14px;
    background: #ffffff;
    margin-bottom: 12px;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;

    box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.08),
            0 1px 2px rgba(0, 0, 0, 0.06);

    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

#bmanager-shop-list li:hover {
    border-color: #cbd5e1;
    box-shadow:
            0 10px 15px -3px rgba(0, 0, 0, 0.08),
            0 4px 6px -4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* Active */
#bmanager-shop-list li.active {
    box-shadow: 0 0 0 2px #21a701;
    border-color: transparent;
    transform: none;
}

/* Icon wrapper */
.bmanager-shop-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: transparent;
    line-height: 0;
}

.bmanager-shop-icon svg {
    width: 40px;
    height: 40px;
    display: block;
}

/* Text block */
.bmanager-shop-info {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.bmanager-shop-info strong {
    font-size: 15px;
    color: #0f172a;
    margin-bottom: 2px;
    line-height: 1.3;
}

.bmanager-shop-info span {
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

/* Distance pill */
.bmanager-distance {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    background-color: #f1f5f9;
    color: #64748b;
    padding: 3px 10px;
    border-radius: 999px;
    align-self: flex-start;
}

#bmanager-shop-list li.active .bmanager-distance {
    background-color: #e7f7ec;
    color: #16803d;
}

/* -----------------------------
   Sticky footer (always visible)
   Wrap your button in:
   <div class="bmanager-modal-footer"> ...button... </div>
----------------------------- */
.bmanager-modal-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;

    padding: 14px 16px 16px 16px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;

    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.04);
    z-index: 20;
}

/* Safe area bottom padding */
@supports (padding: max(0px)) {
    .bmanager-modal-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* Confirm button */
#bmanager-confirm-shop.button,
#bmanager-confirm-shop.button.alt,
#bmanager-confirm-shop {
    width: 100%;
    border: none !important;

    border-radius: 999px !important;
    background: black !important;
    color: #ffffff !important;

    font-weight: 700;
    font-size: 15px;

    padding: 16px 18px !important;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 10px 20px rgba(33, 167, 1, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#bmanager-confirm-shop:disabled,
#bmanager-confirm-shop.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* -----------------------------
   Under-method selected box
----------------------------- */
.bmanager-under-method-text {
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bmanager-selected-shop-under-method {
    margin: 0;
    margin-top: 10px;
    text-align: center;
    padding: 10px;
    border: 1px solid #e7e7e7;
    border-radius: 8px;
    background: #ffffff;
}

svg.bmanager-check-icon {
    width: 15px;
    height: 15px;
    position: relative;
    top: 1px;
}

/* -----------------------------
   Responsive (phones/tablets)
----------------------------- */
@media (max-width: 900px) {
    .bmanager-modal-content {
        width: 95%;
        margin: 12px auto;

        /* slightly smaller on real devices */
        height: 88vh;   /* fallback */
        height: 88dvh;  /* modern */
        max-height: calc(100dvh - 16px);
    }

    .bmanager-layout {
        gap: 14px;
        padding: 14px;
    }

    .bmanager-layout {
        flex-direction: column;
    }

    /* Force map to be first on mobile */
    .bmanager-map-view { order: 1; }
    .bmanager-list-view { order: 2; }

    /* Map height controlled on mobile */
    .bmanager-map-view {
        flex: 0 0 auto;
    }

    #bmanager-map {
        height: 200px !important;
        min-height: 200px !important;
    }

    /* List takes remaining space */
    .bmanager-list-view {
        flex: 1 1 auto;
    }

    .bmanager-modal-header {
        padding: 16px 16px;
    }

    .bmanager-modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* Extra small phones */
@media (max-width: 420px) {
    #bmanager-map {
        height: 180px !important;
        min-height: 180px !important;
    }

    #bmanager-shop-list li {
        padding: 10px;
        gap: 10px;
    }

    .bmanager-shop-icon {
        width: 52px;
        height: 52px;
    }

    .bmanager-shop-icon svg {
        width: 38px;
        height: 38px;
    }
}