/**
 * LocalLoop Action Drawer v2
 * Mounted on document.body (never inside #map / .map-section-ask-dock —
 * those clip with overflow/transform; see docs/BUG_SOLUTIONS.md).
 * z-index must stay above #map-news-panel (1038).
 */

#ll-action-scrim {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(6, 11, 24, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

#ll-action-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
}

#ll-action-drawer {
    --ll-ad-accent: #38bdf8;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1101;
    display: flex;
    flex-direction: column;
    width: 440px;
    max-width: 90vw;
    height: 100%;
    height: 100dvh;
    background: #0f172a;
    color: #e2e8f0;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#ll-action-drawer.is-open {
    transform: translateX(0);
}

.ll-ad-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ll-ad-kicker {
    margin: 0 0 4px;
    color: var(--ll-ad-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ll-ad-title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.25;
    color: #f8fafc;
}

.ll-ad-sub {
    margin: 6px 0 0;
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1.4;
}

.ll-ad-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.ll-ad-close:hover,
.ll-ad-close:focus-visible {
    background: rgba(148, 163, 184, 0.22);
    outline: 2px solid var(--ll-ad-accent);
    outline-offset: 2px;
}

.ll-ad-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px 24px;
}

.ll-ad-form {
    display: grid;
    gap: 14px;
}

.ll-ad-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.ll-ad-field > span,
.ll-ad-legend {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ll-ad-field input,
.ll-ad-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: #f8fafc;
    font: inherit;
}

.ll-ad-field input:focus,
.ll-ad-field textarea:focus,
.ll-ad-otp:focus {
    outline: 2px solid var(--ll-ad-accent);
    outline-offset: 1px;
    border-color: var(--ll-ad-accent);
}

.ll-ad-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ll-ad-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ll-ad-chip {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.08);
    color: #e2e8f0;
    padding: 7px 12px;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.ll-ad-chip.is-on,
.ll-ad-chip[aria-pressed="true"] {
    border-color: var(--ll-ad-accent);
    background: color-mix(in srgb, var(--ll-ad-accent) 22%, transparent);
    color: #fff;
}

.ll-ad-summary {
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.5;
}

.ll-ad-verify {
    margin-top: 4px;
    padding: 14px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.06);
}

.ll-ad-verify.is-verified {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.08);
}

.ll-ad-verify__title {
    margin: 0 0 10px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #f8fafc;
}

.ll-ad-phone-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
}

.ll-ad-cc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 0.9rem;
    white-space: nowrap;
}

.ll-ad-send,
.ll-ad-resend {
    margin-top: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--ll-ad-accent);
    color: #04121a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.ll-ad-send:disabled,
.ll-ad-resend:disabled {
    background: rgba(148, 163, 184, 0.18);
    color: #64748b;
    cursor: not-allowed;
}

.ll-ad-otp {
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: #f8fafc;
    font: inherit;
    letter-spacing: 0.28em;
    text-align: center;
}

.ll-ad-otp.is-shake {
    animation: ll-ad-shake 0.42s ease;
    border-color: #f87171;
}

@keyframes ll-ad-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.ll-ad-verify__done {
    display: none;
    margin: 8px 0 0;
    color: #4ade80;
    font-size: 0.85rem;
    font-weight: 700;
}

.ll-ad-verify.is-verified .ll-ad-verify__done {
    display: block;
}

.ll-ad-verify.is-verified .ll-ad-verify__idle,
.ll-ad-verify.is-verified .ll-ad-verify__sms,
.ll-ad-verify.is-verified .ll-ad-send,
.ll-ad-verify.is-verified .ll-ad-otp,
.ll-ad-verify.is-verified .ll-ad-resend,
.ll-ad-verify.is-verified .ll-ad-phone-row {
    display: none;
}

.ll-ad-sms-hero {
    position: relative;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
}

.ll-ad-sms-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--ll-ad-accent);
    opacity: 0.45;
    animation: ll-ad-pulse 1.6s ease-out infinite;
}

.ll-ad-sms-glyph {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--ll-ad-accent) 22%, #0f172a);
    color: var(--ll-ad-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ll-ad-sms-to {
    margin: 0 0 12px;
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: center;
}

@keyframes ll-ad-pulse {
    0% { transform: scale(0.86); opacity: 0.55; }
    100% { transform: scale(1.28); opacity: 0; }
}

.ll-ad-success {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding: 12px 4px 8px;
}

.ll-ad-success__mark {
    color: var(--ll-ad-accent);
    animation: ll-ad-pop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.ll-ad-success__mark svg path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: ll-ad-check 0.45s 0.12s ease forwards;
}

@keyframes ll-ad-pop {
    from { transform: scale(0.72); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes ll-ad-check {
    to { stroke-dashoffset: 0; }
}

.ll-ad-success__kicker {
    margin: 8px 0 0;
    color: var(--ll-ad-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ll-ad-success__title {
    margin: 0;
    max-width: 22rem;
    color: #f8fafc;
    font-size: 1.15rem;
    line-height: 1.35;
}

.ll-ad-success__to {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.92rem;
}

.ll-ad-success__to strong {
    color: #f8fafc;
}

.ll-ad-receipt {
    width: 100%;
    margin: 6px 0 0;
    padding: 12px 14px;
    list-style: none;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
    font-size: 0.9rem;
}

.ll-ad-receipt li + li {
    margin-top: 6px;
}

.ll-ad-success__badge-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    color: #94a3b8;
    font-size: 0.85rem;
}

.ll-ad-success__hint {
    margin: 0;
    max-width: 22rem;
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.45;
}

.ll-ad-again {
    margin-top: 6px;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.ll-ad-again:hover,
.ll-ad-again:focus-visible {
    color: #e2e8f0;
}

#ll-action-drawer.is-success .ll-ad-status {
    display: none;
}

.ll-pending-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #fbbf24;
    color: #04121a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 8px;
    line-height: 1.2;
}

.stay-card__badges {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: calc(100% - 56px);
}

.stay-card__badges .stay-card__badge {
    position: static;
}

.stay-card.is-pending {
    outline: 2px solid rgba(251, 191, 36, 0.55);
    outline-offset: -2px;
}

.stay-card__button.is-pending {
    background: #b45309;
}

.category-compact-header .ll-pending-badge {
    margin-left: 8px;
}

.category-compact-header .category-compact-area + .ll-pending-badge {
    margin-left: auto;
}

.category-compact-btn.is-pending {
    filter: saturate(0.85);
}

.ll-ad-hint {
    margin: 8px 0 0;
    color: #94a3b8;
    font-size: 0.8rem;
}

.ll-ad-footer {
    position: sticky;
    bottom: 0;
    display: grid;
    gap: 8px;
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f172a;
    flex-shrink: 0;
}

.ll-ad-submit {
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.18);
    color: #64748b;
    font: inherit;
    font-weight: 800;
    cursor: not-allowed;
}

.ll-ad-submit.is-enabled {
    background: var(--ll-ad-accent);
    color: #04121a;
    cursor: pointer;
}

.ll-ad-submit:disabled {
    background: rgba(148, 163, 184, 0.18);
    color: #64748b;
    cursor: not-allowed;
}

.ll-ad-status {
    min-height: 1.2em;
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.ll-ad-status.is-error {
    color: #f87171;
}

.ll-ad-status.is-ok {
    color: #4ade80;
}

@media (max-width: 640px) {
    #ll-action-drawer {
        width: 100%;
        max-width: 100%;
    }
}
