/* feed-card.css — shared styling for the feed item card (_feed_items.html).

Used by every page that renders feed items: the activity feed and the
status detail page. Moved out of activity_feed.html's inline <style> block
(commit 75dd314 added status_detail.html which reuses the card markup but
had none of this CSS, leaving the action buttons unstyled).
*/

    .feed-item-wrapper {
        width: 100%;
        overflow: visible;
        scroll-margin-top: 80px;
    }

    /* Desktop: no local width/padding — inherits the single 760px column like every page; a local 768px+16px used to double margins */
    @media (min-width: 768px) {
        .feed-item-wrapper {
            max-width: 100%;
        }
    }
    [data-layout="mobile-first"] .desktop-card {
        display: none !important;
    }
    [data-layout="mobile-first"] .mobile-feed-card {
        display: block !important;
    }
    /* Hide mobile feed card on non-mobile layouts */
    .mobile-feed-card {
        display: none !important;
    }
    /* A.3: circular pet avatar in the card avatar slot (photo or species icon);
       size comes from the img width/height attrs, cover crops to the circle */
    .pet-avatar {
        display: block;
        border-radius: 50%;
        object-fit: cover;
    }
    /* Height-based clamping for StatusUpdate body (text + images) - max-height set by JS */
    .feed-body-clamped {
        overflow: hidden;
        position: relative;
    }

    .feed-body-expanded {
        max-height: none !important;
        overflow: visible !important;
    }

    /* Line clamping for BoardThread text-only content - 10 lines max */
    .feed-content-clamped {
        display: -webkit-box;
        -webkit-line-clamp: 10;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Board thread badge styling */
    .board-thread-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.75rem;
        color: #6c757d;
    }

    .board-thread-badge i {
        color: var(--accent-color);
    }

    .board-thread-badge a {
        color: inherit;
        text-decoration: none;
    }

    .board-thread-badge a:hover {
        text-decoration: underline;
    }

    /* Feed thread title */
    .feed-thread-title {
        margin-bottom: 0.5rem;
        font-weight: 600;
    }

    /* Show more link styling */
    .feed-show-more-link {
        color: var(--accent-color);
        text-decoration: none;
        font-size: 0.875rem;
    }

    .feed-show-more-link:hover {
        text-decoration: underline;
    }
    /* Center feed images in Event posts - wrapper and image styles are now inline */

    /* ── Engagement Bar ──────────────────────────────────────────── */
     .mobile-feed-engagement {
        display: flex !important;
        align-items: center;
        gap: 4px;
        padding: var(--ui-space-2) var(--ui-space-2);
        border-top: 1px solid var(--border-color, #eee);
        background: var(--bg-card, #fff);
        border-radius: 0 0 var(--mobile-card-radius, 12px) var(--mobile-card-radius, 12px);
    }

    .mobile-engagement-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: var(--ui-space-2) var(--ui-space-1);
        background: none;
        border: none;
        color: var(--text-secondary, #6c757d);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        border-radius: 8px;
        transition: all 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-engagement-btn i {
        font-size: 20px;
        font-style: normal !important;
        transition: transform 0.2s ease;
    }

    .mobile-engagement-btn .reaction-icon {
        font-size: 20px;
        line-height: 1;
    }

    .mobile-engagement-btn:active {
        background: var(--bg-secondary, #f0f2f5);
    }

    .mobile-engagement-btn.like-btn.liked {
        color: #e74c3c;
    }

    .mobile-engagement-btn.like-btn.liked i {
        animation: heartBurst 0.4s ease;
    }

    @keyframes heartBurst {
        0% { transform: scale(1); }
        25% { transform: scale(1.4); }
        50% { transform: scale(0.9); }
        100% { transform: scale(1); }
    }

    .engagement-count {
        font-size: 12px;
        font-weight: 600;
    }

    /* ── Double-Tap Heart Animation ─────────────────────────────── */
    .mobile-feed-double-tap {
        display: none;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0);
        pointer-events: none;
        z-index: 10;
    }

    .mobile-feed-double-tap.show {
        display: block;
    }

    .double-tap-heart {
        font-size: 80px;
        color: #e74c3c;
        filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
        animation: doubleTapHeart 0.8s ease forwards;
    }

    @keyframes doubleTapHeart {
        0% { transform: scale(0); opacity: 1; }
        15% { transform: scale(1.3); opacity: 1; }
        30% { transform: scale(0.95); opacity: 1; }
        50% { transform: scale(1.1); opacity: 1; }
        80% { transform: scale(1); opacity: 1; }
        100% { transform: scale(1); opacity: 0; }
    }

    /* Make feed card relative for double-tap overlay */
    .mobile-feed-card {
        position: relative;
        overflow: visible !important;
    }

    .share-dropdown-wrapper {
        overflow: visible !important;
        position: relative;
    }

    .mobile-feed-engagement .share-dropdown-wrapper {
        flex: 1;
        display: flex;
    }
    /* ── Share Dropdown ──────────────────────────────────────── */
    .share-dropdown {
        position: fixed;
        left: 0;
        top: 0;
        background: var(--bg-card, #fff);
        border: 1px solid var(--border-color, #dee2e6);
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        padding: var(--ui-space-2) 0;
        min-width: 180px;
        z-index: 99999;
    }

    .share-dropdown .share-option {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: var(--ui-space-2) var(--ui-space-4);
        color: var(--text-primary, #212529);
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
        transition: background 0.15s;
        cursor: pointer;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
    }

    .share-dropdown .share-option:hover {
        background: var(--bg-secondary, #f0f2f5);
    }

    .share-dropdown .share-option i {
        font-size: 16px;
        width: 20px;
        text-align: center;
    }
    /* ── Comments Section ─────────────────────────────────────── */
    .comments-section {
        border-top: 1px solid var(--border-color, #eee);
        background: var(--bg-secondary, #fafbfc);
        padding: 0;
        margin: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        max-height: 0;
    }

    .comments-section.comments-expanded {
        max-height: 600px;
    }

    /* When the collapsed comments strip (1px bg-secondary line) is the LAST
       child of a mobile feed card, its square corners poked out of the card's
       rounded bottom corners (the card must stay overflow:visible for
       dropdowns). Inset radius = card radius - 1px card border. */
    .mobile-feed-card > .comments-section:last-child {
        border-bottom-left-radius: calc(var(--mobile-card-radius, 12px) - 1px);
        border-bottom-right-radius: calc(var(--mobile-card-radius, 12px) - 1px);
    }

    .comments-list {
        max-height: 240px;
        overflow-y: auto;
        padding: var(--ui-space-1) 0;
        height: auto;
        flex: 0 0 auto;
    }

    .comment-item {
        display: flex;
        align-items: flex-start;
        gap: 4px;
        padding: var(--ui-space-1) var(--ui-space-2);
    }

    .comment-avatar-wrapper {
        flex-shrink: 0;
        width: 24px;
        height: 24px;
    }

    .comment-avatar-link {
        flex-shrink: 0;
        text-decoration: none;
    }

    .comment-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: var(--ui-space-1);
    }

    .comment-author-info {
        display: inline-flex;
        align-items: baseline;
        gap: 0.3em;
        flex-shrink: 0;
        min-width: 0;
    }

    .comment-author-link a {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-primary, #212529);
        text-decoration: none;
    }

    .comment-author-link a:hover {
        text-decoration: underline;
    }

    .comment-sep {
        display: inline-block;
        vertical-align: middle;
        color: var(--text-secondary, #6c757d);
        font-size: 12px;
    }

    .comment-pet-name {
        font-size: 12px;
        color: var(--text-secondary, #6c757d);
    }

    .comment-time {
        display: inline;
        font-size: 10px;
        color: var(--text-secondary, #6c757d);
        margin-top: 0;
        white-space: nowrap;
    }

    .comment-bubble {
        background: var(--bg-secondary, #f0f2f5);
        border-radius: 16px;
        padding: var(--ui-space-2) var(--ui-space-3);
        flex: 1;
    }

    [data-color-theme="dark"] .comment-bubble {
        background: var(--bg-secondary, #16213e);
    }

    .comment-author {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-primary, #212529);
    }

    .comment-text {
        display: block;
        font-size: 13px;
        color: var(--text-primary, #212529);
        margin-top: 0;
        word-break: break-word;
    }

    .comment-delete-btn {
        background: none;
        border: none;
        color: var(--text-secondary, #6c757d);
        cursor: pointer;
        padding: var(--ui-space-1);
        font-size: 14px;
        opacity: 0.5;
        transition: opacity 0.15s;
    }

    .comment-delete-btn:hover {
        opacity: 1;
        color: #dc3545;
    }

    .comment-report-btn-inline {
        background: none;
        border: none;
        color: var(--text-secondary, #6c757d);
        cursor: pointer;
        padding: var(--ui-space-1);
        font-size: 12px;
        opacity: 0.3;
        transition: opacity 0.15s;
        float: right;
        margin-top: 4px;
    }

    .comment-report-btn-inline:hover {
        opacity: 1;
        color: #fd7e14;
    }
   .comment-form-row {
        display: flex;
        align-items: center;
        gap: var(--ui-space-2);
        padding: var(--ui-space-1) var(--ui-space-2);
        background: var(--bg-card, #fff);
    }

    .comment-char-counter {
        font-size: 10px;
        color: #adb5bd;
        text-align: right;
        padding: 0 var(--ui-space-2) var(--ui-space-1) var(--ui-space-2);
        line-height: 1;
        transition: color 0.2s ease;
        background: var(--bg-card, #fff);
    }

    .comment-char-counter.warning {
        color: var(--bs-warning, #fd7e14);
    }

    .comment-char-counter.danger {
        color: var(--bs-danger, #dc3545);
    }

    .comment-input {
        flex: 1;
        border: 1px solid var(--border-color, #dee2e6);
        border-radius: 20px;
        padding: var(--ui-space-2) var(--ui-space-3);
        font-size: 13px;
        background: var(--bg-secondary, #f8f9fa);
        color: var(--text-primary, #212529);
        outline: none;
        transition: border-color 0.15s;
        resize: none;
        min-height: 32px;
        line-height: 1.4;
        font-family: inherit;
        overflow-y: hidden;
    }

    .comment-input:focus {
        border-color: var(--accent-color, #0d6efd);
    }

    .comment-input::placeholder {
        color: var(--text-secondary, #6c757d);
    }

    .comment-submit-btn {
        background: none;
        border: none;
        color: var(--accent-color, #0d6efd);
        cursor: pointer;
        padding: var(--ui-space-1) var(--ui-space-2);
        font-size: 18px;
        opacity: 0.6;
        transition: opacity 0.15s;
    }

    .comment-submit-btn:hover {
        opacity: 1;
    }
    /* ── Desktop Card Fixes ──────────────────────────────────── */
    .desktop-card {
        overflow: hidden;
    }

    .desktop-card .card-body {
        overflow: visible;
    }

    .desktop-card .card-footer,
    .desktop-card .desktop-comment-input {
        overflow: visible !important;
    }

    .desktop-card .desktop-comments-section {
        overflow: hidden;
    }

    .desktop-status-footer {
        overflow: visible !important;
        border-top: 1px solid var(--border-color, #dee2e6);
        background: var(--bg-secondary, #f8f9fa);
    }

    .desktop-footer-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--ui-space-2) var(--ui-space-3);
        gap: 8px;
    }

    .desktop-footer-left {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .desktop-footer-right {
        display: flex;
        align-items: center;
        gap: var(--ui-space-2);
    }

    .desktop-share .share-dropdown {
        z-index: 99999 !important;
    }

    /* ── Desktop Engagement Buttons ────────────────────────── */
    .desktop-eng-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--ui-space-2);
        padding: var(--ui-space-2) var(--ui-space-3);
        background: none;
        border: none;
        color: var(--text-secondary, #6c757d);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        border-radius: 6px;
        transition: all 0.15s ease;
        white-space: nowrap;
    }

    .desktop-eng-btn:hover {
        background: var(--bg-card, #e9ecef);
        color: var(--text-primary, #212529);
    }

    .desktop-eng-btn i {
        font-size: 18px;
    }

    .desktop-eng-btn .reaction-icon {
        font-size: 18px;
        line-height: 1;
    }

    .desktop-eng-btn.like-btn.liked {
        color: #e74c3c;
    }

    .desktop-eng-btn span {
        font-size: 12px;
        font-weight: 600;
    }

    /* ── Desktop Comment Input ──────────────────────────────────── */
    .desktop-comment-input {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: var(--ui-space-1) var(--ui-space-3);
        background: var(--bg-secondary, #f8f9fa);
        border-bottom: 1px solid var(--border-color, #dee2e6);
    }

    .desktop-comment-avatar {
        flex-shrink: 0;
    }

    .avatar-tiny {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        font-size: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        color: #fff;
    }

    .desktop-comment-form {
        display: flex;
        align-items: center;
        gap: var(--ui-space-2);
    }

    .desktop-comment-field {
        flex: 1;
        border: 1px solid var(--border-color, #dee2e6);
        border-radius: 20px;
        padding: var(--ui-space-1) var(--ui-space-3);
        font-size: 13px;
        background: var(--bg-card, #fff);
        color: var(--text-primary, #212529);
        outline: none;
        transition: border-color 0.15s;
        resize: none;
        min-height: 28px;
        line-height: 1.4;
        font-family: inherit;
    }

    .desktop-comment-field:focus {
        border-color: var(--accent-color, #0d6efd);
        box-shadow: 0 0 0 2px rgba(13,110,253,0.15);
    }

    .desktop-comment-submit {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: none;
        background: var(--accent-color, #0d6efd);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.15s;
    }

    .desktop-comment-submit:hover {
        background: var(--accent-color-hover, #0b5ed7);
    }

    .desktop-comment-submit i {
        font-size: 14px;
    }

    /* ── Desktop Comments Section ───────────────────────────────── */
    .desktop-comments-section {
        padding: 0;
        border-bottom: 1px solid var(--border-color, #dee2e6);
        overflow: hidden;
        transition: max-height 0.3s ease;
        max-height: 0;
    }

    .desktop-comments-section.comments-expanded {
        max-height: 600px;
    }

    .desktop-comments-list {
        max-height: 300px;
        overflow-y: auto;
        padding: var(--ui-space-1) 0;
    }

    .desktop-comment-item {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        padding: var(--ui-space-2) var(--ui-space-3);
    }

    .desktop-comment-item .comment-avatar-wrapper {
        flex-shrink: 0;
        width: 24px;
        height: 24px;
    }

    .desktop-comment-item .comment-avatar-link {
        flex-shrink: 0;
        text-decoration: none;
    }

    .desktop-comment-body {
        flex: 1;
        background: var(--bg-secondary, #f0f2f5);
        border-radius: 12px;
        padding: var(--ui-space-2) var(--ui-space-3);
        min-width: 0;
    }

    .desktop-comment-author {
        display: block;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-primary, #212529);
        margin-bottom: var(--ui-space-1);
    }

    .desktop-comment-text {
        display: block;
        font-size: 13px;
        color: var(--text-primary, #212529);
        word-break: break-word;
        white-space: pre-wrap;
        line-height: 1.4;
    }

    .desktop-comment-time {
        display: block;
        font-size: 11px;
        color: var(--text-secondary, #6c757d);
        margin-top: 4px;
    }
    /* ── B.3 — Shared Post Attribution ───────────────────────────── */
    .shared-post-attribution {
        border: 1px solid var(--border-color, #dee2e6);
        border-left: 3px solid var(--accent-color, #0d6efd);
        border-radius: 8px;
        padding: var(--ui-space-2) var(--ui-space-3);
        margin-bottom: 8px;
        background: var(--bg-secondary, #f8f9fa);
    }

    .shared-post-header {
        display: flex;
        align-items: center;
        gap: var(--ui-space-2);
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary, #6c757d);
        margin-bottom: 4px;
    }

    .shared-post-header i {
        font-size: 14px;
        color: var(--accent-color, #0d6efd);
    }

    .shared-post-header a {
        color: var(--accent-color, #0d6efd);
        text-decoration: none;
    }

    .shared-post-header a:hover {
        text-decoration: underline;
    }

    .shared-post-pet {
        font-weight: 400;
        color: var(--text-secondary, #6c757d);
        font-size: 11px;
    }

    .shared-post-original {
        font-size: 13px;
        color: var(--text-primary, #212529);
        line-height: 1.4;
    }

    .shared-post-original p {
        margin: 0 0 var(--ui-space-2) 0;
    }

    .shared-post-image-wrapper {
        margin-top: var(--ui-space-2);
        border-radius: 8px;
        overflow: hidden;
        background: var(--bg-secondary, #f0f2f5);
    }

    .shared-post-image {
        width: 100%;
        max-height: 200px;
        object-fit: cover;
        border-radius: 8px;
    }

    /* ── B.4 — Hashtag Links ──────────────────────────────────────────── */
    .hashtag-link {
        color: var(--accent-color, #0d6efd);
        text-decoration: none;
        font-weight: 500;
        transition: opacity 0.15s;
    }

    .hashtag-link:hover {
        opacity: 0.7;
        text-decoration: underline;
    }

    /* ── I.3 — Mention Links ──────────────────────────────────────────── */
    .mention-link {
        color: var(--accent-color, #0d6efd);
        text-decoration: none;
        font-weight: 600;
        transition: opacity 0.15s;
    }

    .mention-link:hover {
        opacity: 0.7;
        text-decoration: underline;
    }

    /* ── D.2 — Pet of the Day (daily anchor above the feed, both
       layouts). The card is a link to the pet owner's profile. The
       photo keeps its full aspect (object-fit cover); the badge chip
       uses the brand accent so the paw reads in light and dark. ── */
    .pet-of-the-day {
        display: block;
        margin-bottom: var(--ui-space-3, 16px);
        color: var(--text-primary, #212529);
        text-decoration: none;
        overflow: hidden;
        background: var(--bg-card, #fff);
        border: 1px solid var(--border-color, #dee2e6);
        border-radius: 12px;
    }

    .pet-of-the-day:hover {
        text-decoration: none;
        opacity: 0.92;
    }

    .pet-of-the-day-photo {
        display: block;
        width: 100%;
        height: 170px;
        object-fit: cover;
        object-position: center top;
    }

    .pet-of-the-day-body {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: var(--ui-space-3, 12px) var(--ui-space-4, 16px);
    }

    .pet-of-the-day-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 3px 10px;
        border-radius: 999px;
        background: var(--accent-color, #E8645A);
        color: #fff;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.6;
    }

    .pet-of-the-day-badge .paw-accent {
        width: 13px;
        height: auto;
    }

    .pet-of-the-day-name {
        font-size: 19px;
        font-weight: 700;
        line-height: 1.25;
    }

    .pet-of-the-day-owner {
        font-size: 13px;
        color: var(--text-secondary, #6c757d);
    }

    @media (min-width: 768px) {
        .pet-of-the-day-photo {
            height: 220px;
        }

        .pet-of-the-day-name {
            font-size: 20px;
        }
    }
