/* Route planner feedback (#1186): the "Planning your routes" card while it calculates
   (Components/Shared/RoutePlanningProgress.razor) and the closable "Routes planned" popup afterwards
   (Components/Shared/RoutePlanSuccessPopup.razor, or the .cp-rp-attention card in Calendar.razor when
   something needs a look). Black-and-white like the rest of the app. */

.cp-rp-progress,
.cp-rp-success {
    position: fixed;
    top: 16px;
    left: 50%;
    z-index: 1040;
    width: min(calc(100vw - 24px), 380px);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.05);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #111;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    animation: cp-rp-drop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@media (min-width: 641px) {
    /* Centred over the page next to the sidebar, not the whole window. */
    .cp-rp-progress,
    .cp-rp-success {
        left: calc(var(--main-margin-left, 0px) + (100vw - var(--main-margin-left, 0px)) / 2);
    }
}

/* ---- Planning your routes ---- */

.cp-rp-progress-route {
    flex: 0 0 auto;
    width: 84px;
    height: 34px;
    overflow: visible;
}

.cp-rp-progress-track {
    fill: none;
    stroke: #ececef;
    stroke-width: 4;
    stroke-linecap: round;
}

.cp-rp-progress-line {
    fill: none;
    stroke: #111;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: cp-rp-draw 2.4s ease-in-out infinite;
}

.cp-rp-progress-pin {
    fill: #fff;
    stroke: #111;
    stroke-width: 3;
}

.cp-rp-progress-pin.is-end {
    fill: #111;
}

.cp-rp-progress-dot {
    fill: #22c55e;
    stroke: #fff;
    stroke-width: 1.5;
}

.cp-rp-progress-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cp-rp-progress-copy strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* The status line steps through four messages, one at a time. */
.cp-rp-progress-steps {
    position: relative;
    display: block;
    height: 18px;
    overflow: hidden;
    font-size: 12.5px;
    color: #6b7280;
}

.cp-rp-progress-steps > span {
    position: absolute;
    inset: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    animation: cp-rp-step 10s linear infinite;
}

.cp-rp-progress-steps > span:nth-child(2) { animation-delay: 2.5s; }
.cp-rp-progress-steps > span:nth-child(3) { animation-delay: 5s; }
.cp-rp-progress-steps > span:nth-child(4) { animation-delay: 7.5s; }

/* ---- Routes planned ---- */

/* Both cards let clicks through to the page; only the popup's × takes them. */
.cp-rp-progress,
.cp-rp-success {
    pointer-events: none;
}

.cp-rp-success-check {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
}

.cp-rp-success-check circle {
    fill: #111;
    stroke: #111;
    stroke-width: 2;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: cp-rp-draw-once 0.5s ease-out forwards;
}

.cp-rp-success-check path {
    fill: none;
    stroke: #fff;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: cp-rp-draw-once 0.35s 0.4s ease-out forwards;
}

.cp-rp-success-copy {
    flex: 1 1 160px;
    padding-right: 28px; /* room for the × */
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cp-rp-success-copy strong {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.cp-rp-success-copy span {
    font-size: 13px;
    line-height: 1.4;
    color: #6b7280;
}

.cp-rp-success-close {
    pointer-events: auto;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cp-rp-success-close:hover {
    background: #e5e7eb;
}

/* ---- Routes planned, with something to review (#1226) ---- */

/* Same card as "Routes planned", but its buttons take clicks. */
.cp-rp-attention {
    align-items: flex-start;
    pointer-events: auto;
}

.cp-rp-attention-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: #111;
}

.cp-rp-attention-icon svg {
    width: 26px;
    height: 26px;
    stroke: #20bd75;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cp-rp-attention-list {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.cp-rp-attention-list li {
    position: relative;
    padding-left: 14px;
    color: #111;
    font-size: 13px;
    line-height: 1.5;
}

.cp-rp-attention-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #20bd75;
}

.cp-rp-attention-list li.is-danger::before {
    background: #ef4444;
}

.cp-rp-attention-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.cp-rp-attention-actions button {
    flex: 1 1 0;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.cp-rp-attention-later {
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #111;
}

.cp-rp-attention-later:hover {
    background: #f3f4f6;
}

.cp-rp-attention-view {
    border: 1px solid #111;
    background: #111;
    color: #fff;
}

.cp-rp-attention-view:hover {
    background: #343434;
}

@keyframes cp-rp-drop {
    from { opacity: 0; transform: translate(-50%, -12px) scale(0.98); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes cp-rp-draw {
    0% { stroke-dashoffset: 100; }
    55% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -100; }
}

@keyframes cp-rp-draw-once {
    to { stroke-dashoffset: 0; }
}

@keyframes cp-rp-step {
    0% { opacity: 0; transform: translateY(8px); }
    4%, 22% { opacity: 1; transform: none; }
    26%, 100% { opacity: 0; transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
    .cp-rp-progress,
    .cp-rp-success,
    .cp-rp-progress-line,
    .cp-rp-progress-steps > span {
        animation: none;
    }

    .cp-rp-progress-line { stroke-dashoffset: 0; }
    .cp-rp-progress-steps > span:first-child { opacity: 1; }
    .cp-rp-success-check circle,
    .cp-rp-success-check path {
        animation: none;
        stroke-dashoffset: 0;
    }
}
