/*
 * LastMily on the cart and the classic checkout: «Choose a point» button, the
 * selected point and the pickup points window (built by lastmily-pickup.js).
 * Loaded on both pages (WC_LastMily_Checkout::enqueue_pickup_assets); before
 * 1.0.34 only on the checkout, so the window opened unstyled on the cart.
 */

/* Pickup Selection Button */
.lastmily-select-pickup-point,
#lastmily-select-pickup-btn {
    background: #007cba !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    border-radius: 4px !important;
    border: none !important;
    cursor: pointer !important;
    margin-top: 10px;
    pointer-events: auto !important;
    display: inline-block !important;
    text-decoration: none !important;
    line-height: normal !important;
}

.lastmily-select-pickup-point:hover,
#lastmily-select-pickup-btn:hover {
    background: #005a87 !important;
    color: white !important;
}

.lastmily-select-pickup-point:disabled,
#lastmily-select-pickup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/*
 * No z-index on the button or the panel (1.0.34 had 1000/999 there). Nothing in the
 * cart totals or the order review creates a stacking context in common themes, so
 * those values painted the panel above the theme's sticky header, menus, side
 * panels and their dark overlay (WoodMart: header 390, overlay 400, side menu 500,
 * mobile toolbar 350). The panel now stays in the page flow, under the theme chrome.
 * Only the pickup points window is above everything, and only while it is open
 * (.lastmily-modal, display:none when closed).
 */

/* Selected Point Info */
.lastmily-selected-point-info {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #007cba;
    margin-top: 10px;
}

.lastmily-no-point-selected {
    color: #666;
    font-style: italic;
    padding: 10px 0;
}

/* === Pickup points window (fixed overlay, centred card; above theme chrome while open) === */
.lastmily-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .55);
    box-sizing: border-box;
    overflow: auto;
}

.lastmily-modal .lastmily-modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 760px;
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    background: #fff;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
    box-sizing: border-box;
    text-align: left;
}

.lastmily-modal .lastmily-modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 26px 18px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.lmpp-header-text { flex: 1; min-width: 0; }
.lmpp-header-row { display: flex; align-items: center; gap: 10px; }
.lmpp-pin-icon { flex: none; color: #01aeba; }
.lastmily-modal .lmpp-title { margin: 0; padding: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: #0f172a; text-transform: none; letter-spacing: 0; }
.lmpp-subtitle { margin: 6px 0 0; color: #64748b; font-size: 13px; line-height: 1.4; }

.lastmily-modal .lastmily-modal-close {
    flex: none;
    margin: -6px -8px 0 0;
    padding: 2px 8px;
    background: none;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    color: #94a3b8;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.lastmily-modal .lastmily-modal-close:hover,
.lastmily-modal .lastmily-modal-close:focus {
    background: #f1f5f9;
    color: #0f172a;
}

.lastmily-modal .lastmily-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px 24px;
    overflow-y: auto;
    background: #fff;
}

.lmpp-loading { text-align: center; color: #64748b; padding: 40px 20px; }
.lmpp-empty { text-align: center; color: #64748b; padding: 60px 20px; font-size: 14px; }

.lmpp-list { display: flex; flex-direction: column; gap: 12px; }
.lmpp-item { display: flex; gap: 16px; padding: 18px 20px; border: 1.5px solid #e5e7eb; border-radius: 12px; background: #fff; transition: border-color 120ms, background 120ms, box-shadow 120ms; }
.lmpp-item:hover { border-color: #7fdce2; }
.lmpp-item.is-selected { border-color: #01aeba; background: #e6f8f9; box-shadow: 0 0 0 3px rgba(1, 174, 186, .12); }
.lmpp-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lmpp-item-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.lmpp-item-address { font-size: 13px; color: #64748b; }
.lmpp-item-hours { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.lmpp-item-badges { display: flex; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.lmpp-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.lmpp-badge-parking { color: #16a34a; }
.lmpp-badge-parking .lmpp-badge-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: #dcfce7; color: #16a34a; border-radius: 4px; font-weight: 700; font-size: 11px; }
.lmpp-badge-cod { color: #ca8a04; }

.lmpp-item-action { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; min-width: 110px; }
.lmpp-check { flex: none; color: #01aeba; }
.lastmily-modal .lmpp-btn { display: inline-block; margin: 0; padding: 8px 18px; border: 1.5px solid #01aeba; background: #fff; color: #01aeba; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; line-height: 1.2; text-transform: none; letter-spacing: 0; text-decoration: none; box-shadow: none; transition: background 120ms, color 120ms; }
.lastmily-modal .lmpp-btn:hover,
.lastmily-modal .lmpp-btn:focus { background: #01aeba; color: #fff; border-color: #01aeba; }
.lastmily-modal .lmpp-btn-selected { background: #01aeba; color: #fff; border-color: #01aeba; }
.lastmily-modal .lmpp-btn-selected:hover,
.lastmily-modal .lmpp-btn-selected:focus { background: #018a93; color: #fff; border-color: #018a93; }

.lmpp-footer { display: flex; flex-shrink: 0; align-items: center; gap: 10px; padding: 14px 24px; background: #f8fafc; border-top: 1px solid #f1f5f9; color: #64748b; font-size: 12.5px; }
.lmpp-footer .lmpp-shield-icon { flex: none; color: #94a3b8; }

/* Phones: full-width card, point and button stacked */
@media (max-width: 600px) {
    .lastmily-modal { padding: 8px; align-items: flex-end; }
    .lastmily-modal .lastmily-modal-content { max-height: calc(100vh - 16px); border-radius: 14px 14px 10px 10px; }
    .lastmily-modal .lastmily-modal-header { padding: 16px 16px 12px; }
    .lastmily-modal .lastmily-modal-body { padding: 12px; }
    .lmpp-footer { padding: 12px 16px; }
    .lmpp-item { flex-direction: column; gap: 10px; padding: 14px; }
    .lmpp-item-action { flex-direction: row; align-items: center; justify-content: flex-end; min-width: 0; }
}

/* States inside the window: loading, error (with «Try again»), no points */
/* Scroll lock while the window is open: on <html> too, which is the scroller in themes
   such as WoodMart (html { overflow-y: scroll }), where body { overflow: hidden } alone
   left the page scrolling behind the window */
html.lastmily-modal-open,
body.lastmily-modal-open { overflow: hidden !important; }
.lastmily-modal,
.lastmily-modal .lastmily-modal-body { overscroll-behavior: contain; }
/* Status line for screen readers (count, loading, error), visually hidden */
.lastmily-modal .lmpp-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.lmpp-state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: #64748b; font-size: 14px; }
.lmpp-state p { margin: 0; }
.lmpp-state .lmpp-state-detail { font-size: 12.5px; color: #94a3b8; }
.lmpp-error .lmpp-state-text { color: #b91c1c; }
.lmpp-error { padding: 40px 20px; }
.lmpp-spinner { width: 26px; height: 26px; border: 3px solid #e2e8f0; border-top-color: #01aeba; border-radius: 50%; animation: lmpp-spin .8s linear infinite; }
@keyframes lmpp-spin { to { transform: rotate(360deg); } }
.lastmily-modal .lmpp-retry { margin-top: 4px; }
.lastmily-modal .lmpp-btn.is-busy { opacity: .6; cursor: progress; }
.lastmily-modal .lmpp-btn:disabled { cursor: default; }
.lmpp-notice { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: #fef2f2; color: #b91c1c; font-size: 13px; }
.lastmily-pickup-notice { margin: 8px 0 0; color: #b91c1c; font-size: 13px; }
