/* =========================================================================
   ACTION STREAM & SOCIAL FEED STYLES
   Compatible with Sitewide Theme (Dark / Light / Auto) & Brand Hydrator
   ========================================================================= */

.stream-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* Facebook-Style Call to Action Post Trigger Card */
.stream-trigger-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stream-trigger-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stream-trigger-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stream-trigger-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--accent);
    flex-shrink: 0;
}

.stream-trigger-pill {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.stream-trigger-card:hover .stream-trigger-pill {
    background: var(--bg-hover, rgba(255,255,255,0.04));
    color: var(--text-primary);
    border-color: var(--accent-dim, rgba(229, 149, 55, 0.3));
}

.stream-trigger-actions {
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    gap: 6px;
    flex-wrap: wrap;
}

.stream-trigger-action-btn {
    min-height: 44px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.stream-trigger-action-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Floating Action Button (FAB) in Lower Right */
body.has-stream-fab {
    /* Room to scroll the last post clear of the floating button. */
    padding-bottom: 88px;
}

.stream-fab-btn.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.8);
}

.stream-fab-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1000;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, opacity 0.2s;
}

.stream-fab-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
}

.stream-fab-btn:active {
    transform: scale(0.95);
}

/* Facebook-Style Composer Modal Overlay */
.stream-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.stream-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.stream-modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.stream-modal-backdrop.open .stream-modal-dialog {
    transform: scale(1);
}

.stream-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.stream-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}

.stream-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.12s;
}

.stream-modal-close:hover {
    background: var(--bg-hover, rgba(255,255,255,0.1));
    color: var(--text-primary);
}

.stream-modal-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stream-modal-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stream-modal-author-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
}

.stream-modal-author-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stream-modal-author-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.stream-modal-ai-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(229, 149, 55, 0.12);
    color: var(--accent);
    border: 1px solid rgba(229, 149, 55, 0.25);
    width: fit-content;
}

.stream-modal-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 280px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    padding: 8px 0;
}

.stream-modal-textarea::placeholder {
    color: var(--text-muted);
}

.stream-modal-smart-tag-strip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 8px;
}

.stream-smart-tag-left {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stream-smart-tag-chips {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stream-smart-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.12s;
}

.stream-smart-chip:hover, .stream-smart-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim, rgba(229, 149, 55, 0.12));
}

.stream-modal-footer {
    padding: 0 18px 18px 18px;
}

/* Admins only: who will see the post (stream.js showAudience). */
.stream-audience {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-hover);
}
.stream-audience--platform { background: var(--amber-dim); border-left: 3px solid var(--amber); }

.stream-modal-post-btn {
    width: 100%;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.stream-modal-post-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.stream-modal-post-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Stream Posts Feed List */
.stream-feed-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Individual Stream Card */
.stream-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.stream-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* Card Header */
.stream-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.stream-card-author-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.stream-author-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.stream-author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.stream-author-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stream-author-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--accent-dim, rgba(229, 149, 55, 0.12));
    color: var(--accent);
}

.stream-author-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stream-meta-dot {
    font-size: 8px;
}

.stream-card-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Badge Varieties */
.badge-referral {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-deal {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-social {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-event {
    background: rgba(245, 167, 66, 0.12);
    color: #f5a742;
    border: 1px solid rgba(245, 167, 66, 0.25);
}

.badge-credit {
    background: rgba(234, 179, 8, 0.12);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.25);
}

.badge-post {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Card Body */
.stream-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.stream-card-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
}

/* Card Attachment / Highlight Box */
.stream-card-attachment {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}

.stream-attachment-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.stream-attachment-icon {
    font-size: 18px;
}

.stream-attachment-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.stream-attachment-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.stream-attachment-link {
    min-height: 44px;
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.stream-attachment-link:hover {
    text-decoration: underline;
}

/* Card Engagement Bar */
.stream-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
    flex-wrap: wrap;
    gap: 8px;
}

.stream-action-btns-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stream-btn-action {
    min-height: 40px;
    min-width: 44px;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
    user-select: none;
}

.stream-btn-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.stream-btn-action.cheered {
    background: rgba(229, 149, 55, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
}

.stream-btn-action.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.stream-btn-action.primary:hover {
    opacity: 0.9;
}

/* Comments Section */
.stream-comments-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.stream-comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.stream-comment-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
}

.stream-comment-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.stream-comment-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    flex: 1;
    min-width: 0;
}

.stream-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}

.stream-comment-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 11px;
}

.stream-comment-time {
    color: var(--text-muted);
    font-size: 10px;
}

.stream-comment-body {
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

/* Comment Composer */
.stream-comment-input-row {
    display: flex;
    gap: 8px;
}

.stream-comment-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.stream-comment-input:focus {
    border-color: var(--accent);
}

.btn-send-comment {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

/* Infinite Scroll / End markers */
.stream-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    gap: 8px;
}

.stream-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: streamSpin 0.7s linear infinite;
}

@keyframes streamSpin {
    to { transform: rotate(360deg); }
}

.stream-end-marker {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    border-top: 1px dashed var(--border);
    margin-top: 8px;
}

/* Embed container in Column 2 */
/* Referral partner picker (shown only for referral posts) */
.stream-modal-partner-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stream-modal-partner-row[hidden] {
    display: none;
}

.stream-modal-partner-row select {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 15px;
    font-weight: 400;
}

/* In-stream ads (design.md "In-stream ads"; site/stream-ads.js), on /stream and the ad slot on /happenings */
.stream-ad { gap: 10px; }
.stream-ad-label { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg-card); color: var(--text-secondary); }
.stream-ad-body { display: flex; gap: 12px; align-items: flex-start; }
.stream-ad-body > div { min-width: 0; }
.stream-ad-photo { flex: 0 0 auto; width: 88px; height: 88px; border-radius: 10px; object-fit: cover; object-position: center 22%; background: var(--bg-card); }
.stream-ad h3 { font-size: 16px; font-weight: 700; line-height: 1.3; }
.stream-ad p { font-size: 15px; color: var(--text-secondary); }
.stream-ad-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stream-ad-foot span { font-size: 13px; color: var(--text-secondary); }
.stream-ad-foot .btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px;
    font-size: 15px; font-weight: 600; text-decoration: none; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-primary);
}
.stream-ad-foot .btn:hover { background: var(--bg-hover); }
.stream-ad.house { border-style: dashed; }
@media (max-width: 480px) { .stream-ad-photo { width: 64px; height: 64px; } }
