/* "My plan" (assets/js/plan-list.js): the "Add to my plan" toggle on package cards and the tray pinned to the
   bottom of the page. Brand style: square corners, soft fills, orange block button. Dark by default; light rules
   at the end (homepage light theme). */

.plan-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 7px 12px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #170b07;
    background: #e87052;   /* solid orange */
    border: 0;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.plan-add:hover,
.plan-add:focus-visible {
    background: #f0805f;
    outline: none;
}

.plan-add::before {
    content: "+";
    font-size: 1rem;
    line-height: 1;
}

/* Added: the darker orange, so it reads as done */
.plan-add.is-added {
    background: #a4442b;
    color: #fff4ef;
}

.plan-add.is-added::before {
    content: "✓";
    font-size: 0.85rem;
}

/* The tray */
.plan-tray {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 900;
    width: min(560px, calc(100vw - 32px));
    padding: 14px 16px 16px;
    background: #121215;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 0 -1px #0b0b0d, 0 4px 0 0 rgba(255, 255, 255, 0.1), 0 18px 40px rgba(0, 0, 0, 0.45);
    color: #e9ecf1;
    font-family: "Plus Jakarta Sans", sans-serif;
    animation: planTrayIn 0.3s ease-out both;
}

.plan-tray[hidden] {
    display: none;
}

@keyframes planTrayIn {
    from { opacity: 0; transform: translate(-50%, 12px); }
}

.plan-tray-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.plan-tray-title {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 1rem;
}

.plan-tray-count {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.75rem;
    color: #e87052;
}

.plan-tray-clear {
    margin-left: auto;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 0.8rem;
    color: #9aa5b3;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.plan-tray-clear:hover { color: #e87052; }

.plan-tray-list {
    list-style: none;
    margin: 10px 0 12px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 30vh;
    overflow-y: auto;
}

.plan-tray-list li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 12px;
    font-size: 0.85rem;
    background: rgba(232, 112, 82, 0.12);
    color: #f4f4f6;
}

.plan-tray-remove {
    width: 22px;
    height: 22px;
    border: 0;
    background: transparent;
    color: #9aa5b3;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.plan-tray-remove:hover,
.plan-tray-remove:focus-visible { color: #e87052; outline: none; }

.plan-tray-foot {
    display: flex;
    align-items: center;
    gap: 14px;
}

.plan-tray-note {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #9aa5b3;
}

.plan-tray-go {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 16px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

/* Room at the bottom of the page so the tray never covers the footer's last line */
body.has-plan-tray { padding-bottom: 170px; }

@media (max-width: 520px) {
    .plan-tray-foot { flex-direction: column; align-items: stretch; }
    .plan-tray-go { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .plan-tray { animation: none; }
}

/* Light theme (homepage switch) */
html[data-theme="light"] .plan-tray {
    background: #fbfaf7;
    border-color: rgba(20, 20, 24, 0.15);
    box-shadow: 0 4px 0 -1px #efede8, 0 4px 0 0 rgba(20, 20, 24, 0.1), 0 18px 40px rgba(20, 16, 14, 0.12);
    color: #18181b;
}

html[data-theme="light"] .plan-tray-list li { color: #18181b; }
html[data-theme="light"] .plan-tray-clear,
html[data-theme="light"] .plan-tray-remove,
html[data-theme="light"] .plan-tray-note { color: #5f6570; }

/* Homepage: the floating chat bar sits at the bottom, so the tray rests just above it */
body:has(.intake-dock.is-shown) .plan-tray {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

/* While the homepage chat is open the plan is in the chat itself (its parts step), so the tray steps aside */
body:has(.intake-chat.open) .plan-tray {
    display: none;
}

/* On the package cards: one bottom row, "What is included" on the left and the solid "Add to my plan" box on the
   right, both in the link's font and size */
.card-bottom-row {
    display: flex;
    flex-wrap: wrap;   /* very narrow cards: the button drops below the link */
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    margin: 12px 16px 0;
}

.card-bottom-row .card-expand-btn {
    margin: 0 !important;
    align-self: center;   /* the card's own rule pins it to the top */
    white-space: nowrap;
}

.card-bottom-row .plan-add {
    margin: 0;
    flex-shrink: 0;
    padding: 8px 10px;
    white-space: nowrap;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1;
}

/* "What is included" without its arrow */
.card-bottom-row .expand-arrow {
    display: none;
}
