/* Analiz Raporu arka plan işi: buton durumu, ilerleme tepsisi, paylaş menüsü */

:root {
    --report-accent: #118573;
    --report-accent-strong: #0d7868;
    --report-accent-soft: #e6f4f1;
    --report-surface: #ffffff;
    --report-text: #0f172a;
    --report-muted: #64748b;
    --report-border: #e2e8f0;
    --report-danger: #b42318;
    --report-danger-soft: #fef3f2;
    --report-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.28), 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* --- Buton: hazırlanırken kendi içinde dolan ilerleme --- */
.parcel-report-btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.parcel-report-btn.is-report-busy {
    cursor: progress;
}

.parcel-report-btn.is-report-busy::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    width: var(--report-progress, 0%);
    background: rgba(255, 255, 255, 0.22);
    transition: width 0.35s ease;
}

.parcel-report-btn.is-report-busy span {
    font-variant-numeric: tabular-nums;
}

.parcel-report-btn.is-report-ready {
    box-shadow: 0 0 0 3px rgba(17, 133, 115, 0.25);
}

/* --- İlerleme tepsisi --- */
.map-report-tray {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.map-report-card {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px 40px 14px 14px;
    color: var(--report-text);
    background: var(--report-surface);
    border: 1px solid var(--report-border);
    border-radius: 16px;
    box-shadow: var(--report-shadow);
    pointer-events: auto;
    animation: map-report-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.map-report-card[hidden] {
    display: none;
}

.map-report-card.is-attention {
    animation: map-report-attention 0.6s ease;
}

.map-report-card__icon {
    flex: 0 0 40px;
    height: 40px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: var(--report-accent);
    background: var(--report-accent-soft);
    border-radius: 12px;
}

.map-report-card.is-done .map-report-card__icon {
    color: #fff;
    background: var(--report-accent);
}

.map-report-card.is-failed .map-report-card__icon {
    color: var(--report-danger);
    background: var(--report-danger-soft);
}

.map-report-card__body {
    flex: 1 1 auto;
    min-width: 0;
}

.map-report-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.map-report-card__title {
    font-size: 0.92rem;
    font-weight: 700;
}

.map-report-card__pct {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--report-accent);
    font-variant-numeric: tabular-nums;
}

.map-report-card__meta {
    margin-top: 1px;
    font-size: 0.76rem;
    color: var(--report-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-report-card__bar {
    position: relative;
    height: 6px;
    margin: 10px 0 8px;
    overflow: hidden;
    background: #edf2f7;
    border-radius: 999px;
}

.map-report-card__bar span {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--report-progress, 0%);
    background: linear-gradient(90deg, #22a58f, var(--report-accent));
    border-radius: inherit;
    transition: width 0.35s ease;
}

.map-report-card.is-running .map-report-card__bar span::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: map-report-shimmer 1.4s linear infinite;
}

.map-report-card.is-done .map-report-card__bar,
.map-report-card.is-failed .map-report-card__bar {
    display: none;
}

.map-report-card__stage {
    font-size: 0.8rem;
    color: #334155;
}

.map-report-card.is-done .map-report-card__stage {
    margin-top: 6px;
    font-weight: 600;
    color: var(--report-accent-strong);
}

.map-report-card.is-failed .map-report-card__stage {
    margin-top: 6px;
    color: var(--report-danger);
}

.map-report-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.map-report-card__actions:empty {
    display: none;
}

.map-report-card__actions .btn-primary {
    background: var(--report-accent);
    border-color: var(--report-accent);
}

.map-report-card__actions .btn-primary:hover {
    background: var(--report-accent-strong);
    border-color: var(--report-accent-strong);
}

.map-report-card__actions .btn-outline-primary {
    color: var(--report-accent-strong);
    border-color: #9fd3c9;
}

.map-report-card__actions .btn-outline-primary:hover {
    color: #fff;
    background: var(--report-accent);
    border-color: var(--report-accent);
}

.map-report-card__hint {
    font-size: 0.74rem;
    color: var(--report-muted);
}

.map-report-card__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--report-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.map-report-card__close:hover,
.map-report-card__close:focus-visible {
    color: var(--report-text);
    background: #f1f5f9;
}

@keyframes map-report-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes map-report-attention {
    0%, 100% { transform: none; }
    30% { transform: translateY(-4px); box-shadow: 0 0 0 4px rgba(17, 133, 115, 0.25), var(--report-shadow); }
}

@keyframes map-report-shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* --- Paylaş menüsü (mobilde alt sayfa, masaüstünde ortalı kart) --- */
.map-share-sheet {
    position: fixed;
    inset: 0;
    z-index: 1095;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.map-share-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.map-share-sheet__panel {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    color: var(--report-text);
    background: var(--report-surface);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--report-shadow);
    transform: translateY(24px);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.18s ease;
}

.map-share-sheet.is-open .map-share-sheet__backdrop {
    opacity: 1;
}

.map-share-sheet.is-open .map-share-sheet__panel {
    transform: none;
    opacity: 1;
}

.map-share-sheet__grip {
    width: 40px;
    height: 4px;
    margin: 0 auto 10px;
    background: #cbd5e1;
    border-radius: 999px;
}

.map-share-sheet__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.map-share-sheet__title {
    font-size: 1.05rem;
    font-weight: 700;
}

.map-share-sheet__meta {
    font-size: 0.78rem;
    color: var(--report-muted);
}

.map-share-sheet__close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--report-muted);
    background: #f1f5f9;
    border: 0;
    border-radius: 10px;
}

.map-share-sheet__options {
    display: grid;
    gap: 4px;
}

.map-share-sheet__option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    text-align: left;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 12px;
}

.map-share-sheet__option:hover,
.map-share-sheet__option:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.map-share-sheet__option:focus-visible {
    box-shadow: 0 0 0 2px var(--report-accent);
}

.map-share-sheet__option[disabled] {
    opacity: 0.55;
    cursor: progress;
}

.map-share-sheet__option-icon {
    flex: 0 0 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    color: var(--report-accent);
    background: var(--report-accent-soft);
    border-radius: 11px;
}

.map-share-sheet__option[data-share-action="whatsapp"] .map-share-sheet__option-icon {
    color: #128c4a;
    background: #e8f7ee;
}

.map-share-sheet__option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.map-share-sheet__option-text strong {
    font-size: 0.88rem;
    font-weight: 600;
}

.map-share-sheet__option-text small {
    font-size: 0.74rem;
    color: var(--report-muted);
}

.map-share-sheet__note {
    margin: 10px 4px 0;
    font-size: 0.72rem;
    color: var(--report-muted);
}

@media (min-width: 768px) {
    .map-share-sheet {
        align-items: center;
    }

    .map-share-sheet__panel {
        border-radius: 20px;
        padding-bottom: 16px;
    }

    .map-share-sheet__grip {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .map-report-tray {
        right: 12px;
        left: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-report-card,
    .map-report-card.is-attention,
    .map-report-card.is-running .map-report-card__bar span::after {
        animation: none;
    }

    .map-report-card__bar span,
    .parcel-report-btn.is-report-busy::before,
    .map-share-sheet__panel,
    .map-share-sheet__backdrop {
        transition: none;
    }
}
