﻿/* ═══════════════════════════════════════
   Stoling — share-modal.css
   Premium in-app share modal.
   ═══════════════════════════════════════
   Replaces the native Web Share dialog with a friend-aware sheet that
   matches our dark editorial design language. Three structural blocks:
   preview card (top, optional) → search + friends list (middle) →
   optional message + footer actions (bottom). */

.shr-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: radial-gradient(circle at 50% 35%, rgba(15, 18, 36, 0.6), rgba(0, 0, 0, 0.85));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.shr-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.shr-modal {
    width: 100%;
    max-width: 480px;
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #11142a 0%, #0a0d1f 100%);
    border: 1px solid rgba(139, 92, 246, 0.20);
    border-radius: 22px;
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.10),
        0 30px 80px rgba(0, 0, 0, 0.60),
        0 0 100px rgba(139, 92, 246, 0.18);
    overflow: hidden;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.shr-modal-overlay.is-open .shr-modal {
    transform: scale(1) translateY(0);
}

/* ── Header ── */
.shr-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 0.85rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.10);
}

.shr-modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #f1f5f9;
}

.shr-modal-sub {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: #94a3b8;
}

.shr-modal-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.shr-modal-close:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    border-color: rgba(165, 180, 252, 0.35);
    transform: rotate(90deg);
}

/* ── Preview card ── */
.shr-preview {
    margin: 0.95rem 1.25rem 0;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(236, 72, 153, 0.10));
    border: 1px solid rgba(165, 180, 252, 0.25);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.shr-preview[hidden] {
    display: none !important;
}

.shr-preview-ico {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: #fff;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 18px rgba(124, 58, 237, 0.45);
}

.shr-preview-img {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.shr-preview-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shr-preview-kicker {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #c4b5fd;
}

.shr-preview-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shr-preview-sub {
    font-size: 0.78rem;
    color: rgba(241, 245, 249, 0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Search ── */
.shr-search-wrap {
    position: relative;
    margin: 0.85rem 1.25rem 0;
}

.shr-search-ico {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #64748b;
    pointer-events: none;
}

.shr-search-input {
    width: 100%;
    padding: 0.55rem 0.9rem 0.55rem 2rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.shr-search-input:focus {
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.20);
}

.shr-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* ── Friends list ── */
.shr-friends-wrap {
    flex: 1;
    overflow-y: auto;
    margin: 0.65rem 0.5rem 0;
    padding: 0 0.75rem;
    min-height: 200px;
    max-height: 320px;
}

.shr-friends-state {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.shr-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(165, 180, 252, 0.25);
    border-top-color: #a5b4fc;
    animation: shrSpin 0.65s linear infinite;
}

@keyframes shrSpin {
    to {
        transform: rotate(360deg);
    }
}

.shr-friends-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shr-friend {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.6rem;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.shr-friend:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(165, 180, 252, 0.18);
}

.shr-friend.is-selected {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.28), rgba(99, 102, 241, 0.14));
    border-color: rgba(165, 180, 252, 0.45);
}

.shr-friend-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(236, 72, 153, 0.18));
    border: 1px solid rgba(165, 180, 252, 0.30);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shr-friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shr-friend-avatar-fallback {
    color: #c7d2fe;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.shr-friend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.shr-friend-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shr-friend-username {
    font-size: 0.74rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shr-friend-check {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.shr-friend.is-selected .shr-friend-check {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border-color: transparent;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.55);
}

/* ── Optional message ── */
.shr-message-wrap {
    padding: 0.6rem 1.25rem 0;
}

.shr-message {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.shr-message:focus {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.16);
}

.shr-message::placeholder {
    color: rgba(255, 255, 255, 0.30);
}

/* ── Footer ── */
.shr-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem 1.1rem;
    border-top: 1px solid rgba(139, 92, 246, 0.10);
    margin-top: 0.6rem;
}

.shr-foot-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shr-foot-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.shr-foot-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    color: #fff;
    border-color: rgba(165, 180, 252, 0.35);
}

.shr-foot-btn[hidden] {
    display: none !important;
}

.shr-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35), 0 0 18px rgba(236, 72, 153, 0.20);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.shr-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.45), 0 0 22px rgba(236, 72, 153, 0.30);
}

.shr-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.shr-send-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.shr-send-count[hidden] {
    display: none !important;
}

/* ── Mobile tweaks ── */
@media (max-width: 540px) {
    .shr-modal {
        max-width: none;
        max-height: 92vh;
        border-radius: 18px;
    }

    .shr-friends-wrap {
        max-height: none;
    }
}

/* ─────────────────────────────────────────
   AI Style DNA preview cards inside DM bubbles
   (Variant B rich preview — rendered by messages.js
   when it detects the [ai:style|...] payload prefix.)
   Uses the same gradient family as the share modal so
   both surfaces feel like one feature.
   ───────────────────────────────────────── */
.msg-bubble .msg-style-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(236, 72, 153, 0.10));
    border: 1px solid rgba(165, 180, 252, 0.30);
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.4rem;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    max-width: 320px;
}

.msg-bubble .msg-style-card:hover {
    transform: translateY(-1px);
    border-color: rgba(165, 180, 252, 0.55);
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.30);
}

.msg-style-kicker {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #c4b5fd;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.msg-style-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.25;
}

.msg-style-meta {
    font-size: 0.78rem;
    color: rgba(241, 245, 249, 0.7);
}

.msg-style-cta {
    margin-top: 0.25rem;
    align-self: flex-start;
    padding: 0.3rem 0.7rem;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
}