/**
 * Hello Middleton - Community Pulse Component
 * Activity feed styles for BuddyPress integration
 * Mobile-optimized with touch-friendly interactions
 *
 * @requires tokens.css
 * @since 2.1.4
 */

/* ==========================================================================
   PULSE CONTAINER (.community-pulse-wrapper)
   ========================================================================== */

.community-pulse-wrapper {
    background: var(--hm-bg-elevated);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--hm-border);
}

/* ==========================================================================
   PULSE ITEMS LIST (.pulse-items)
   ========================================================================== */

.pulse-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Force proper top spacing alignment */
.hm-column .feedzy-rss,
.hm-column-main .pulse-items {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Make pulse-items container fill column properly */
.hm-column-main .pulse-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==========================================================================
   ACTIVITY ITEM CARDS (Base Styling)
   ========================================================================== */

.pulse-items .activity-item,
.hm-master-layout .activity-item {
    background: var(--hm-bg-elevated) !important;
    border: 1px solid var(--hm-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: var(--space-4) !important;
    transition:
        transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out) !important;
}

/* Card Hover - Subtle Lift */
.pulse-items .activity-item:hover,
.hm-master-layout .activity-item:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--shadow-md) !important;
    border-color: var(--hm-border-strong) !important;
}

/* Card Focus State */
.pulse-items .activity-item:focus-within {
    box-shadow: var(--shadow-md), var(--shadow-glow) !important;
    border-color: var(--hm-primary) !important;
}

/* Remove old top borders */
.hm-column-main .activity-item {
    border-top: none !important;
}

/* Match activity item styling to RSS items */
.hm-column-main .activity-item,
.pulse-items .activity-item {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 0;
}

/* ==========================================================================
   PULSE HEADER
   ========================================================================== */

.pulse-items .pulse-header {
    margin-bottom: var(--space-3) !important;
    padding-bottom: var(--space-3) !important;
    border-bottom: 1px solid var(--hm-border) !important;
}

.pulse-items .pulse-header strong {
    font-family: var(--font-body) !important;
    font-weight: 700 !important;
    color: var(--hm-text) !important;
}

/* ==========================================================================
   PULSE CONTENT
   ========================================================================== */

.pulse-items .pulse-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

.pulse-items .pulse-content p {
    font-family: var(--font-body) !important;
    color: var(--hm-text-secondary) !important;
    line-height: 1.6 !important;
}

.pulse-text {
    margin: 10px 0;
    line-height: 1.5;
    color: var(--hm-text-secondary);
}

/* ==========================================================================
   PULSE TIME
   ========================================================================== */

.pulse-items .pulse-time,
.pulse-time {
    font-family: var(--font-mono) !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: var(--hm-text-muted) !important;
    letter-spacing: 0.01em !important;
}

/* ==========================================================================
   PULSE AVATAR
   ========================================================================== */

.pulse-avatar a {
    display: block;
}

.pulse-item .pulse-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 2px solid var(--hm-primary-muted);
}

/* ==========================================================================
   PULSE AUTHOR
   ========================================================================== */

.pulse-author {
    color: inherit !important;
    text-decoration: none !important;
}

.pulse-author:hover {
    color: var(--hm-primary) !important;
}

.pulse-item .pulse-author {
    font-weight: 600;
    color: var(--hm-text);
}

.pulse-item .pulse-action {
    color: var(--hm-text-secondary);
    font-size: 0.875rem;
}

.pulse-item .pulse-time {
    font-size: 0.75rem;
    color: var(--hm-text-muted);
    font-family: var(--font-mono);
}

/* ==========================================================================
   PULSE FOOTER
   ========================================================================== */

.pulse-footer,
.pulse-items .pulse-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--hm-border);
}

.pulse-items .pulse-footer-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.pulse-items .pulse-comment-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--hm-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================================================
   PULSE VIEW LINK
   ========================================================================== */

.pulse-view-link,
.pulse-items .pulse-view-link {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--hm-accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

.pulse-view-link:hover,
.pulse-items .pulse-view-link:hover {
    color: var(--hm-accent-hover);
    text-decoration: underline !important;
}

/* ==========================================================================
   PULSE MEDIA (Photos & Videos)
   ========================================================================== */

.pulse-media,
.pulse-items .pulse-media {
    margin: 12px 0;
    margin-top: var(--space-3);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pulse-photos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.pulse-media-photo {
    display: block;
    border-radius: 8px;
    overflow: hidden;
}

.pulse-media-photo img,
.pulse-items .pulse-media img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s var(--ease-out);
}

.pulse-media-photo:hover img,
.pulse-items .activity-item:hover .pulse-media img {
    transform: scale(1.03);
}

/* Video media */
.pulse-media-video {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
}

.pulse-media-video video {
    max-width: 100%;
    border-radius: 8px;
}

/* ==========================================================================
   PULSE ICONS
   ========================================================================== */

.pulse-icons:not(:empty) {
    background: #fef3c7 !important;
    color: var(--hm-primary-dark) !important;
}

/* ==========================================================================
   PULSE ITEM (Alternative Card Style)
   ========================================================================== */

.pulse-item {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--hm-bg);
    border: 1px solid var(--hm-border);
    transition:
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out);
}

.pulse-item:hover {
    background: var(--hm-bg-subtle);
    border-color: var(--hm-primary-muted);
}

.pulse-item .pulse-content {
    flex: 1;
}

/* ==========================================================================
   PINNED POSTS
   ========================================================================== */

.pulse-items .activity-item.pulse-pinned {
    border: 2px solid #f59e0b !important;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%) !important;
    position: relative;
}

.pulse-items .activity-item.pulse-pinned::after {
    content: "PINNED";
    position: absolute;
    top: -10px;
    left: 16px;
    background: #f59e0b;
    color: white;
    font: 700 10px system-ui;
    padding: 3px 10px;
    border-radius: 4px;
}

/* ==========================================================================
   LIVE PULSE INDICATOR
   ========================================================================== */

@keyframes pulse-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

.hm-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
    color: var(--hm-success);
    font-weight: 600;
}

.hm-live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--hm-success);
    border-radius: 50%;
    animation: pulse-live 2s ease-in-out infinite;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.pulse-empty {
    text-align: center;
    padding: 30px;
    color: var(--hm-text-muted);
}

/* ==========================================================================
   DESKTOP STYLES (min-width: 992px)
   ========================================================================== */

@media (min-width: 992px) {
    .hm-column-main .activity-item {
        min-height: 180px;
    }

    /* Ensure columns have same internal structure */
    .hm-column,
    .hm-column-main {
        display: flex;
        flex-direction: column;
    }

    .hm-column > .feedzy-rss,
    .hm-column-main > .pulse-items {
        flex: 1;
    }
}

/* ==========================================================================
   RESPONSIVE - TABLET (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    /* Reduce card padding on mobile */
    .pulse-item {
        padding: var(--space-3);
    }

    /* Disable hover transforms on touch */
    .pulse-item:hover {
        transform: none;
    }

    .pulse-photos {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .pulse-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .activity-item,
    .bp-activity-item,
    .pulse-items .activity-item {
        padding: 14px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }

    .pulse-avatar {
        width: 44px !important;
        height: 44px !important;
    }

    .pulse-avatar img {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
    }

    .pulse-content {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }

    .pulse-header {
        font-size: 0.85rem !important;
        margin-bottom: 8px !important;
    }

    .pulse-time {
        font-size: 0.75rem !important;
        color: var(--hm-text-muted) !important;
    }
}

/* ==========================================================================
   RESPONSIVE - SMALL MOBILE (max-width: 600px)
   ========================================================================== */

@media (max-width: 600px) {
    .pulse-photos {
        grid-template-columns: repeat(2, 1fr);
    }

    .pulse-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ==========================================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .pulse-items .activity-item,
    .pulse-item {
        transition: none !important;
    }

    .pulse-media-photo img,
    .pulse-items .pulse-media img {
        transition: none !important;
    }

    .hm-live-indicator::before {
        animation: none;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .hm-master-layout .activity-item,
    .pulse-items .activity-item,
    .pulse-item {
        box-shadow: none !important;
        transform: none !important;
        break-inside: avoid;
        border: 1px solid #ccc !important;
    }

    .hm-live-indicator {
        display: none;
    }
}
