/**
 * SCAN_TO_DELIVER v3 — warm comic bubble + floating select.
 * @package ParcelSelector
 * @since   3.5.0
 */

/* ======================= PIN HIGHLIGHT — PULSE + RAYS ======================= */

/* Gentle pin glow — scale 1→1.25, NEVER hides the pin */
.std-pin-highlight {
    z-index: 700 !important;
    transform-origin: bottom center !important;
}

@keyframes std-pin-glow {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 8px rgba(249,115,22,0.5)); }
    50%      { transform: scale(1.25); filter: drop-shadow(0 0 20px rgba(249,115,22,0.8)) drop-shadow(0 0 40px rgba(249,115,22,0.3)); }
}

.std-rays {
    position: absolute;
    width: 100px;
    height: 50px;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 600;
    background: radial-gradient(ellipse at center, rgba(249,185,22,0.5) 0%, rgba(249,115,22,0.2) 40%, rgba(249,115,22,0) 70%);
    animation: std-rays-pulse 2s ease-in-out infinite;
}

@keyframes std-rays-pulse {
    0%   { transform: translateX(-50%) scaleX(1) scaleY(1);    opacity: 0.9; }
    50%  { transform: translateX(-50%) scaleX(4) scaleY(3);    opacity: 0; }
    100% { transform: translateX(-50%) scaleX(1) scaleY(1);    opacity: 0.9; }
}

/* ======================= SUCCESS STATE ======================= */

.std-pin-success {
    animation: std-pin-success-bounce 1.5s ease-in-out infinite !important;
    z-index: 700 !important;
    filter: drop-shadow(0 6px 20px rgba(34,197,94,0.6)) !important;
    transform-origin: bottom center !important;
}

@keyframes std-pin-success-bounce {
    0%, 100% { transform: scale(1) translateY(0); }
    50%      { transform: scale(1.2) translateY(-8px); }
}

.std-success-ring {
    position: absolute;
    width: 70px;
    height: 70px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 590;
    border: 4px solid #22c55e;
    box-shadow: 0 0 24px rgba(34,197,94,0.5), 0 0 80px rgba(34,197,94,0.15);
    animation: std-success-glow 2s ease-in-out infinite;
}

@keyframes std-success-glow {
    0%, 100% { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
    50%      { transform: translate(-50%,-50%) scale(1.6); opacity: 0.3; }
}

/* ======================= FIREWORKS ======================= */

.std-firework {
    position: absolute;
    pointer-events: none;
    z-index: 999999;
}

.std-firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: std-particle-fly 1.2s ease-out forwards;
}

@keyframes std-particle-fly {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ======================= BUTTON PULSE — continuous until clicked ======================= */

@keyframes std-btn-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 16px rgba(139,92,246,0.35);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 28px rgba(139,92,246,0.55), 0 0 0 4px rgba(139,92,246,0.12);
    }
}

/* ======================= SHARED CARD ======================= */

.std-card {
    pointer-events: auto;
    font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

/* ======================= QR CARD (ABOVE PIN) ======================= */

.std-qr-card {
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(160deg, #fff7ed 0%, #ffedd5 40%, #fed7aa 100%);
    border: 2.5px solid #f97316;
    border-radius: 20px;
    padding: 12px 16px 14px;
    text-align: center;
    min-width: 196px;
    box-shadow:
        0 16px 40px rgba(249,115,22,0.25),
        0 4px 12px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.8);
    animation: std-card-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes std-card-pop {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-100%) scale(0.7); }
    100% { opacity: 1; transform: translateX(-50%) translateY(-100%) scale(1); }
}

.std-qr-card::after {
    content: "";
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, transparent 50%, #fed7aa 50%);
    border-right: 2.5px solid #f97316;
    border-bottom: 2.5px solid #f97316;
}

.std-qr-title {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #fff;
    background: linear-gradient(135deg, #f97316, #ea580c);
    padding: 5px 18px;
    border-radius: 100px;
    margin: 0 auto 10px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(249,115,22,0.3);
}

.std-qr-frame {
    position: relative;
    display: inline-block;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #f97316;
    box-shadow: 0 4px 16px rgba(249,115,22,0.2);
    background: #fff;
}

.std-qr-frame canvas {
    display: block;
}

.std-qr-scanner {
    position: absolute;
    left: 6px;
    right: 6px;
    height: 8px;
    background: linear-gradient(90deg, transparent, rgba(249,115,22,0.6), transparent);
    border-radius: 4px;
    top: 6px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 14px rgba(249,115,22,0.5), 0 0 4px rgba(249,115,22,0.3);
    animation: std-scanner-sweep 2.5s ease-in-out infinite;
}

@keyframes std-scanner-sweep {
    0%   { top: 4px;  opacity: 0; }
    10%  { opacity: 0.9; }
    50%  { opacity: 1; }
    90%  { opacity: 0.9; }
    100% { top: calc(100% - 12px); opacity: 0; }
}

/* ======================= COMIC SPEECH BUBBLE (BELOW PIN) ======================= */

.std-bubble {
    transform: translateX(-50%);
    background: #fff;
    border: 2.5px solid #fbbf24;
    border-radius: 22px;
    padding: 14px 18px 12px;
    min-width: 220px;
    max-width: 300px;
    box-shadow:
        0 8px 28px rgba(251,191,36,0.2),
        0 2px 8px rgba(0,0,0,0.06);
    animation: std-bubble-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: text;
    cursor: text;
    position: relative;
}

@keyframes std-bubble-pop {
    0%   { opacity: 0; transform: translateX(-50%) scale(0.7) translateY(10px); }
    100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

/* Comic arrow pointing UP to pin */
.std-bubble::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 14px solid #fbbf24;
    filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.04));
}

.std-bubble::after {
    content: "";
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #fff;
}

/* Carrier pin icon inside bubble */
.std-bubble-pin {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 2px solid #f97316;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    box-shadow: 0 2px 8px rgba(249,115,22,0.2);
}

.std-bubble-pin img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.std-bubble-name {
    font-size: 17px;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
    line-height: 1.2;
    text-align: center;
}

.std-bubble-address {
    font-size: 12.5px;
    color: #475569;
    margin: 0 0 1px;
    line-height: 1.4;
    text-align: center;
}

.std-bubble-city {
    font-size: 12.5px;
    color: #475569;
    margin: 0 0 6px;
    line-height: 1.4;
    text-align: center;
}

.std-bubble-carrier {
    font-size: 10.5px;
    font-weight: 700;
    color: #f97316;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

/* ======================= FLOATING SELECT BUTTON (bottom-right) ======================= */

.std-select-float {
    padding: 14px 28px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
    cursor: pointer;
    box-shadow:
        0 6px 24px rgba(249,115,22,0.4),
        0 2px 8px rgba(0,0,0,0.1);
    animation: std-select-pulse 1.5s ease-in-out infinite;
    transition: transform 0.2s;
    letter-spacing: 0.02em;
}

.std-select-float:hover {
    transform: scale(1.05);
    box-shadow:
        0 8px 32px rgba(249,115,22,0.5),
        0 4px 12px rgba(0,0,0,0.15);
}

/* Purple pulse — synced 1.5s with pin glow */
@keyframes std-select-pulse {
    0%, 100% {
        box-shadow: 0 6px 24px rgba(139,92,246,0.4), 0 2px 8px rgba(0,0,0,0.1);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 36px rgba(139,92,246,0.6), 0 0 24px rgba(139,92,246,0.3);
        transform: scale(1.06);
    }
}

/* ======================= RESPONSIVE ======================= */

@media (max-width: 480px) {
    .std-qr-card {
        min-width: 170px;
        padding: 10px 12px;
    }

    .std-qr-title {
        font-size: 9px;
        padding: 4px 12px;
    }

    .std-bubble {
        min-width: 180px;
        max-width: 240px;
        padding: 10px 14px 8px;
    }

    .std-bubble-name {
        font-size: 14px;
    }

    .std-select-float {
        font-size: 13px;
        padding: 12px 20px;
    }
}
