/* =============================================================================
   PharmSwift Location Manager — Frontend Styles v1.2.3
   Design: Blinkit-inspired location bar + clean popup
   ============================================================================= */

/* ── Reset & tokens ─────────────────────────────────────────────────────────── */
.pslm-location-selector *,
.pslm-popup-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.pslm-hidden { display: none !important; }

/* =============================================================================
   LOCATION BAR  (Blinkit style)
   ============================================================================= */
.pslm-location-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, box-shadow .15s;
    min-width: 180px;
    max-width: 360px;
}
.pslm-location-bar:hover {
    border-color: #0c831f;
    box-shadow: 0 0 0 3px rgba(12,131,31,.08);
}
.pslm-location-bar:focus-visible {
    outline: none;
    border-color: #0c831f;
    box-shadow: 0 0 0 3px rgba(12,131,31,.18);
}

.pslm-bar-left  { flex: 1; min-width: 0; }
.pslm-bar-right { flex-shrink: 0; color: #0c831f; }

/* Headline: "Delivery in 8 minutes" */
.pslm-delivery-headline {
    font-size: 15px;
    font-weight: 700;
    color: #0c831f;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pslm-delivery-headline--grey {
    color: #333;
}
.pslm-delivery-headline--red {
    color: #c62828;
    font-size: 14px;
}

/* Address line below headline */
.pslm-delivery-address {
    margin-top: 2px;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}
.pslm-delivery-address--empty {
    color: #aaa;
    font-style: italic;
}

/* Pincode pill */
.pslm-pincode-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #0c831f;
    background: #e8f5e9;
    border-radius: 4px;
    padding: 1px 5px;
    flex-shrink: 0;
}

/* Chevron arrow */
.pslm-chevron {
    transition: transform .2s;
}
.pslm-popup-open .pslm-chevron {
    transform: rotate(180deg);
}

/* ── Service status (shown ONLY after JS updates it post-selection) ─────────── */
.pslm-service-status {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    border-radius: 8px;
    padding: 7px 12px;
}
.pslm-service-status.available {
    background: #e8f5e9;
    color: #2e7d32;
}
.pslm-service-status.unavailable {
    background: #fdecea;
    color: #c62828;
}
.pslm-service-status .pslm-available-msg {
    font-weight: 600;
}
.pslm-service-status .pslm-eta {
    font-size: 12px;
    font-weight: 600;
    background: #0c831f;
    color: #fff;
    border-radius: 20px;
    padding: 2px 10px;
    margin-left: auto;
}

/* =============================================================================
   POPUP OVERLAY
   ============================================================================= */
.pslm-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    z-index: 99999;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 12px;
    overflow-y: auto;
}

.pslm-popup-container {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    animation: pslm-slide-up .2s ease;
}

@keyframes pslm-slide-up {
    from { opacity:0; transform: translateY(18px); }
    to   { opacity:1; transform: translateY(0); }
}

/* Popup header */
.pslm-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f0f0f0;
}
.pslm-popup-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
}
.pslm-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.pslm-popup-close:hover { background: #f4f4f4; color: #111; }

/* Search box */
.pslm-search-container {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.pslm-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
/* Icon sits visually on the LEFT using order:-1, but is AFTER input in DOM
   so the CSS sibling selector :not(:placeholder-shown) ~ .pslm-search-icon works */
.pslm-search-icon {
    order: -1;          /* visually first */
    position: absolute;
    left: 13px;
    color: #888;
    pointer-events: none;
    display: flex;
    transition: opacity .1s;
}
/* Hide icon when input has a value (no placeholder shown = text present) */
.pslm-search-input:not(:placeholder-shown) ~ .pslm-search-icon {
    display: none;
}
.pslm-search-input {
    width: 100%;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 11px 40px 11px 40px;
    font-size: 14px;
    color: #222;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fafafa;
}
.pslm-search-input:focus {
    border-color: #0c831f;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(12,131,31,.1);
}
.pslm-search-input::placeholder { color: #aaa; }

.pslm-search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    display: none;
    align-items: center;
    padding: 2px;
}
.pslm-search-clear:hover { color: #333; }

/* GPS button */
.pslm-gps-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #0c831f;
    border-bottom: 1px solid #f0f0f0;
    transition: background .15s;
}
.pslm-gps-btn:hover { background: #f0faf1; }
.pslm-gps-btn svg { flex-shrink: 0; }

/* Search results dropdown */
.pslm-search-results {
    max-height: 260px;
    overflow-y: auto;
    border-bottom: 1px solid #f0f0f0;
}
.pslm-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    cursor: pointer;
    transition: background .12s;
    border-bottom: 1px solid #f7f7f7;
}
.pslm-search-result:last-child { border-bottom: none; }
.pslm-search-result:hover { background: #f7fdf8; }
.pslm-search-result-icon { color: #0c831f; flex-shrink: 0; }
.pslm-search-result-info { flex: 1; min-width: 0; }
.pslm-search-result-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pslm-search-result-subtitle {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pslm-search-result-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 7px;
    text-align: center;
    min-width: 70px;
}
.pslm-search-result-badge.available   { background:#e8f5e9; color:#2e7d32; }
.pslm-search-result-badge.unavailable { background:#fdecea; color:#c62828; }
.pslm-search-result-badge.checking   { background:#f5f5f5; color:#999; }

/* Search states */
.pslm-loading { padding: 24px; text-align: center; }
.pslm-spinner {
    width: 26px; height: 26px;
    border: 3px solid #e8f5e9;
    border-top-color: #0c831f;
    border-radius: 50%;
    animation: pslm-spin .7s linear infinite;
    margin: 0 auto;
}
@keyframes pslm-spin { to { transform: rotate(360deg); } }
.pslm-search-empty, .pslm-search-error { padding: 20px; text-align: center; color: #888; font-size: 13px; }

/* Saved / Recent sections */
.pslm-saved-addresses,
.pslm-recent-searches {
    padding: 14px 20px 0;
}
.pslm-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px;
}
.pslm-saved-list,
.pslm-recent-list {
    padding-bottom: 6px;
}
.pslm-saved-item,
.pslm-recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    cursor: pointer;
    border-bottom: 1px solid #f4f4f4;
    transition: background .12s;
    border-radius: 8px;
    padding-left: 4px;
    padding-right: 4px;
}
.pslm-saved-item:last-child,
.pslm-recent-item:last-child { border-bottom: none; }
.pslm-saved-item:hover,
.pslm-recent-item:hover { background: #f7fdf8; }

.pslm-saved-item-icon,
.pslm-recent-item-icon { color: #bbb; flex-shrink: 0; }

.pslm-saved-item-info,
.pslm-recent-item-info { flex: 1; min-width: 0; }

.pslm-saved-item-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #222;
}
.pslm-saved-item-address,
.pslm-recent-item-address {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pslm-saved-item-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}
.pslm-saved-item-delete:hover { color: #e53935; background: #fdecea; }

/* Popup body scroll */
.pslm-popup-body { max-height: calc(100vh - 120px); overflow-y: auto; padding-bottom: 16px; }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 480px) {
    .pslm-popup-overlay { padding: 0; align-items: flex-end; }
    .pslm-popup-container { border-radius: 16px 16px 0 0; max-width: 100%; }
    .pslm-location-bar { max-width: 100%; }
}

/* =============================================================================
   PRINT
   ============================================================================= */
@media print {
    .pslm-location-selector, .pslm-popup-overlay { display: none !important; }
}

/* =============================================================================
   v1.2.5 ADDITIONS
   ============================================================================= */

/* ── Tabs ── */
.pslm-tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    padding: 0 20px;
    gap: 4px;
}
.pslm-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: #888;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.pslm-tab-btn.active  { color: #0c831f; border-bottom-color: #0c831f; }
.pslm-tab-btn:hover:not(.active) { color: #333; }

/* ── Map tab ── */
.pslm-map-search-wrap {
    padding: 14px 20px 8px;
}
.pslm-map-search-input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.pslm-map-search-input:focus { border-color: #0c831f; }

.pslm-map-container {
    height: 320px;
    background: #e8e8e8;
    margin: 0 20px;
    border-radius: 10px;
    overflow: hidden;
}
@media (max-width: 480px) { .pslm-map-container { height: 260px; margin: 0 12px; } }

.pslm-map-footer {
    padding: 12px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pslm-map-hint {
    font-size: 12px;
    color: #888;
    margin: 0;
    text-align: center;
}
.pslm-map-confirm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    background: #0c831f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.pslm-map-confirm-btn:hover { background: #0a6e19; }

/* ── Service status banner ── */
.pslm-service-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    margin-top: 6px;
    transition: all .2s;
}
.pslm-service-status.available {
    background: #e8f5e9;
    color: #1b5e20;
}
.pslm-service-status.unavailable {
    background: #fdecea;
    color: #b71c1c;
}
.pslm-service-status.pslm-hidden,
.pslm-service-status:empty { display: none; }

/* ── Search result badges — improved ── */
.pslm-search-result-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 60px;
    text-align: center;
}
.pslm-search-result-badge.available   { background: #e8f5e9; color: #1b5e20; }
.pslm-search-result-badge.unavailable { background: #fdecea; color: #b71c1c; }
.pslm-search-result-badge.checking    { background: #f5f5f5; color: #999; }

.pslm-result-unavailable { opacity: .65; }

/* ── Not-serviceable search empty state ── */
.pslm-search-empty.pslm-not-serviceable {
    padding: 28px 20px;
    color: #c0392b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.pslm-search-empty.pslm-not-serviceable svg { color: #e74c3c; }
.pslm-search-empty.pslm-not-serviceable p { margin: 0; text-align: center; }
.pslm-search-empty.pslm-not-serviceable p:last-child { color: #888; font-size: 12px; }
