/* TopSpots — Trips heart UI (Phase 3, 2026-05-21).
 * Stateful styles only. Layout/shape utilities live as Tailwind classes
 * inside _heart_button.html. */

/* ── heart icon states ──────────────────────────────────────────────── */
.trip-heart-btn {
    color: #6b7280;       /* gray-500 — empty */
    transition: color 150ms ease, transform 100ms ease;
}
.trip-heart-btn[data-state="filled"] {
    color: #ec4899;       /* pink-500 — filled */
}
.trip-heart-btn:active {
    transform: scale(0.92);
}
.trip-heart-btn.is-error {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.7);  /* red-500 — transient error */
}

/* ── popover ────────────────────────────────────────────────────────── */
.trip-popover {
    position: absolute;
    z-index: 60;
    width: 320px;
    background: #1f2937;        /* gray-800 */
    border: 1px solid #374151;  /* gray-700 */
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    padding: 0.75rem;
    color: #e5e7eb;             /* gray-200 */
}
.trip-popover[hidden] { display: none; }

.trip-popover-heading {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0.25rem 0.5rem;
}

.trip-popover-list {
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}
.trip-popover-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
}
.trip-popover-row:hover { background: rgba(255,255,255,0.05); }
.trip-popover-row input[type="checkbox"] {
    width: 1rem; height: 1rem;
    accent-color: #ec4899;
    cursor: pointer;
}
.trip-popover-row .trip-name {
    flex: 1;
    font-size: 0.875rem;
    color: #e5e7eb;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trip-popover-row .trip-default-tag {
    font-size: 0.6875rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.trip-popover-divider {
    height: 1px; background: #374151; margin: 0.5rem 0;
}

.trip-popover-newinput {
    width: 100%;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.5rem 0.625rem;
    color: #fff;
    font-size: 0.875rem;
    outline: none;
}
.trip-popover-newinput:focus { border-color: #ec4899; }

.trip-popover-removeall {
    display: block;
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.8125rem;
    color: #f87171;             /* red-400 */
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    border-radius: 0.5rem;
}
.trip-popover-removeall:hover { background: rgba(239,68,68,0.1); }
.trip-popover-removeall[hidden] { display: none; }

/* ── skeleton loading rows ──────────────────────────────────────────── */
.trip-skel-row {
    height: 2rem; margin: 0.25rem 0; border-radius: 0.5rem;
    background: linear-gradient(90deg, #2b3441 0%, #374151 50%, #2b3441 100%);
    background-size: 200% 100%;
    animation: trip-skel-shimmer 1.2s linear infinite;
}
@keyframes trip-skel-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ── mobile bottom-sheet ────────────────────────────────────────────── */
@media (max-width: 639px) {
    .trip-popover {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        width: 100%;
        border-radius: 1rem 1rem 0 0;
        max-height: 75vh;
        overflow-y: auto;
        animation: trip-sheet-up 180ms ease-out;
    }
    @keyframes trip-sheet-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
}

/* ── Phase 3.5 (2026-05-22): card-context heart styles ──────────────── */
/* Size variant — small (used on rank cards) */
.trip-heart-btn--sm { width: 2rem; height: 2rem; }
.trip-heart-btn--sm .trip-heart-icon { width: 1.125rem; height: 1.125rem; }

/* Card-context positioning: heart sits in the top-right corner over the
   card, outside the <a> anchor. Wrapper provides position context. */
.rank-card-wrap { position: relative; }
.rank-card-heart {
    position: absolute; top: 0.5rem; right: 0.5rem; z-index: 10;
}
.rank-card-heart .trip-heart-btn {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.rank-card-heart .trip-heart-btn:hover {
    background: rgba(17, 24, 39, 0.9);
}

/* Mobile: keep card content from sliding under the heart on narrow viewports. */
@media (max-width: 639px) {
    .rank-card-wrap > .rank-card,
    .rank-card-wrap > a.block { padding-right: 0; }
    .rank-card-wrap > .rank-card > div:first-child,
    .rank-card-wrap > a.block > div:first-child { padding-right: 3rem; }
}

/* Phase 3.6 (2026-05-22) — heart in map popup row.
   .pop-row already has flex+justify-between (see map.html inline CSS),
   so the heart sits at the right while View stays at left. */
.pop-row .trip-heart-btn { background: transparent; }
.pop-row .trip-heart-btn:hover { background: rgba(255, 255, 255, 0.08); }


/* ── Phase 4 (2026-05-22): /account My Trips section ───────────────── */

.account-trips-input.account-trips-error,
.account-place-row.account-trips-error,
.account-trip.account-trips-error {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.7);
}

.account-trips-empty {
    padding: 1.25rem 1rem;
    border: 1px dashed #374151;
    border-radius: 0.75rem;
    text-align: center;
}

/* ── trip <details> ──────────────────────────────────────────────── */
.account-trip {
    background: #16181d;
    border: 1px solid #2b3441;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: box-shadow 200ms;
}
.account-trip[open] {
    border-color: #374151;
}
.account-trip-summary {
    list-style: none;
    cursor: pointer;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
}
.account-trip-summary::-webkit-details-marker { display: none; }
/* Disclosure chevron */
.account-trip-summary::before {
    content: '▸';
    color: #6b7280;
    font-size: 0.75rem;
    transition: transform 150ms;
    margin-right: 0.25rem;
}
.account-trip[open] > .account-trip-summary::before {
    transform: rotate(90deg);
}
.account-trip-name {
    font-weight: 600;
    color: #fff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-trip-count {
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
}
.account-trip-actions {
    margin-left: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Delete button + inline confirm */
.account-delete-btn {
    background: transparent;
    color: #f87171;
    border: 1px solid transparent;
    padding: 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 150ms;
}
.account-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}
.account-confirm-msg {
    font-size: 0.75rem;
    color: #d1d5db;
    margin-right: 0.5rem;
}
.account-confirm-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.account-confirm-btn:hover { background: #dc2626; }
.account-cancel-btn {
    background: #374151;
    color: #fff;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}
.account-cancel-btn:hover { background: #4b5563; }

/* ── place rows ──────────────────────────────────────────────────── */
.account-trip-places {
    list-style: none;
    margin: 0;
    padding: 0 0 0.5rem;
}
.account-trip-empty {
    padding: 0 1rem 1rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-style: italic;
}

.account-place-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(55, 65, 81, 0.4);
}
.account-place-row:hover {
    background: rgba(255, 255, 255, 0.02);
}
.account-place-thumb {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
    background: #1f2937;
}
.account-place-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    font-size: 1.25rem;
}
.account-place-text {
    flex: 1;
    min-width: 0;
}
.account-place-name {
    font-size: 0.875rem;
    color: #e5e7eb;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-place-meta {
    font-size: 0.75rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-remove-btn {
    background: transparent;
    color: #6b7280;
    border: none;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms, color 150ms;
}
.account-remove-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* sr-only utility (Tailwind classname mirrored locally for the live region) */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* mobile */
@media (max-width: 639px) {
    .account-trip-summary { flex-wrap: wrap; }
    .account-trip-count { order: 3; flex-basis: 100%; margin-left: 1.25rem; margin-top: 0.125rem; }
    .account-place-thumb { width: 40px; height: 40px; }
    .account-confirm-msg {
        flex-basis: 100%; order: -1; margin: 0 0 0.375rem; padding: 0.375rem;
        background: rgba(239, 68, 68, 0.08); border-radius: 0.375rem;
    }
}


/* Phase 5 — trip rename UI (2026-05-22) */
.account-trip-name[role="button"] {
    cursor: text;
    outline-offset: 2px;
    border-radius: 0.25rem;
    padding: 0 0.125rem;
}
.account-trip-name[role="button"]:hover { background: rgba(255,255,255,0.04); }
.account-trip-name[role="button"]:focus-visible {
    outline: 2px solid #ec4899;
}
.account-trip-pencil {
    width: 14px; height: 14px; color: #9ca3af;
    opacity: 0; transition: opacity 150ms;
    flex-shrink: 0; margin-left: 0.25rem;
}
.account-trip-summary:hover .account-trip-pencil { opacity: 0.5; }
@media (max-width: 639px) {
    .account-trip-pencil { opacity: 0.5; }
}
.account-rename-input {
    flex: 1; min-width: 0;
    font: inherit; color: inherit;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #374151; border-radius: 0.375rem;
    padding: 0.125rem 0.5rem; outline: none;
}
.account-rename-input:focus { border-color: #ec4899; }
.account-rename-input.account-trips-error {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.7);
}


/* ── Phase 6 (2026-05-22): /account share panel + share-page row reuse ── */
.account-trip-share-panel {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(55, 65, 81, 0.4);
    background: rgba(31, 41, 55, 0.3);
}
.account-trip-share-panel[hidden] { display: none; }
.account-trip-share-panel > div {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.account-trip-share-panel input[data-share-url-input] {
    flex: 1; min-width: 0;
    background: #0f172a;
    border: 1px solid #374151;
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    color: #e5e7eb;
    font-size: 0.8125rem;
    font-family: ui-monospace, SFMono-Regular, monospace;
    outline: none;
}
.account-trip-share-panel input[data-share-url-input]:focus {
    border-color: #ec4899;
}
.account-trip-share-panel button {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #374151;
    background: #1f2937;
    color: #e5e7eb;
    cursor: pointer;
    transition: background 150ms;
}
.account-trip-share-panel button:hover {
    background: #374151;
}
.account-trip-share-panel button[data-share-create] {
    background: #ec4899; color: #fff; border-color: #ec4899;
}
.account-trip-share-panel button[data-share-create]:hover { background: #db2777; }
.account-trip-share-panel button[data-share-stop] {
    color: #f87171;
}
.account-trip-share-panel .muted {
    flex-basis: 100%; color: #6b7280; font-size: 0.75rem; margin: 0.5rem 0 0;
}

/* "Copied!" temporary state */
button[data-share-copy].is-copied {
    background: #10b981; color: #fff; border-color: #10b981;
}

/* Mobile: stack action buttons full-width on narrow viewports. */
@media (max-width: 639px) {
    .account-trip-summary { flex-wrap: wrap; }
    .account-trip-actions {
        flex-basis: 100%; order: 4;
        margin-left: 1.25rem; margin-top: 0.375rem;
        justify-content: flex-end;
    }
    .account-trip-share-panel > div { flex-wrap: wrap; }
    .account-trip-share-panel input[data-share-url-input] {
        flex-basis: 100%;
    }
}


/* ── Phase 7 (2026-05-22): per-trip map ─────────────────────────────── */
.trip-map-block { padding: 0.75rem 1rem 1rem; }
.trip-map-caption {
    color: #9ca3af; font-size: 0.75rem; margin: 0 0 0.5rem;
}
.trip-map-caption:empty { display: none; }
.trip-map-canvas {
    width: 100%; height: 400px;
    border-radius: 0.75rem; z-index: 0;
    background: #1f2937;   /* placeholder bg while tiles load */
}
@media (max-width: 639px) {
    .trip-map-canvas { height: 300px; }
}

/* Popup styles scoped to Leaflet's container so they don't bleed. */
.leaflet-popup-content .trip-pop-name {
    font-weight: 600; color: #111; margin-bottom: 0.125rem;
}
.leaflet-popup-content .trip-pop-meta {
    font-size: 0.75rem; color: #6b7280; margin-bottom: 0.375rem;
}
.leaflet-popup-content .trip-pop-link {
    font-size: 0.8125rem; color: #ec4899; text-decoration: none;
}
.leaflet-popup-content .trip-pop-link:hover { text-decoration: underline; }


# ── Phase 8 (2026-05-22): collaborators panel + leave-trip + shared badge ─

.account-collab-panel {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(55, 65, 81, 0.4);
    background: rgba(31, 41, 55, 0.3);
}
.account-collab-panel[hidden] { display: none; }
.account-collab-panel form {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin-bottom: 0.75rem; align-items: center;
}
.account-collab-panel input[type="email"] {
    flex: 1; min-width: 0;
    background: #0f172a;
    border: 1px solid #374151;
    border-radius: 0.375rem;
    padding: 0.375rem 0.625rem;
    color: #e5e7eb;
    font-size: 0.875rem;
    outline: none;
}
.account-collab-panel input[type="email"]:focus { border-color: #ec4899; }
.account-collab-panel button[type="submit"] {
    background: #ec4899; color: #fff;
    padding: 0.375rem 0.75rem;
    border: none; border-radius: 0.375rem;
    font-size: 0.8125rem; font-weight: 600;
    cursor: pointer;
}
.account-collab-panel button[type="submit"]:hover { background: #db2777; }
.account-collab-panel ul {
    list-style: none; margin: 0; padding: 0;
}
.account-collab-panel li {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.375rem 0;
    font-size: 0.8125rem; color: #e5e7eb;
}
.account-collab-panel li.muted { color: #6b7280; font-style: italic; }
.account-collab-panel li .muted {
    color: #6b7280; font-size: 0.75rem; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-collab-panel button[data-collab-remove] {
    margin-left: auto;
    background: transparent; color: #f87171;
    border: 1px solid transparent;
    padding: 0.25rem 0.5rem; border-radius: 0.375rem;
    font-size: 0.75rem; cursor: pointer;
}
.account-collab-panel button[data-collab-remove]:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}
.account-collab-panel [data-collab-error] {
    color: #f87171; font-size: 0.75rem;
    margin: 0 0 0.5rem;
}
.account-collab-panel [data-collab-error].hidden { display: none; }

/* "Shared by X" badge on collab trips */
.account-trip-shared-badge {
    display: inline-block;
    font-size: 0.6875rem; color: #a5b4fc;
    background: rgba(99, 102, 241, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.account-leave-btn {
    background: transparent; color: #fbbf24;
    border: 1px solid transparent;
    padding: 0.25rem 0.625rem; border-radius: 0.5rem;
    font-size: 0.75rem; cursor: pointer;
    transition: background 150ms;
}
.account-leave-btn:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
}
