/**
 * Feed Styles - Reddit-style feed layout
 * Styles for the post feed component
 */

/* Feed Container */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Feed Loading State */
.feed-loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted, #6b7280);
    font-size: var(--text-base);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.feed-loading p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted, #6b7280);
}

/* Feed Empty State */
.feed-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted, #6b7280);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.feed-empty p {
    margin: 0;
    font-size: var(--text-base);
    max-width: 500px;
    line-height: 1.6;
}

/* Feed Error State */
.feed-error {
    text-align: center;
    padding: 2rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    width: 100%;
}

/* Post Detail Loading State */
.post-detail-loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted, #6b7280);
    font-size: var(--text-base);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.post-detail-loading p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted, #6b7280);
}

.feed-error p {
    padding: 0;
}

.feed-retry-btn {
    padding: 0.5rem 1rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
}

.feed-retry-btn:hover {
    background: #b91c1c;
}

/* Feed Sign-In Prompt */
.feed-signin-prompt {
    text-align: center;
    padding: 3rem 2rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.feed-signin-prompt p {
    padding: 0;
    color: var(--color-text-muted, #6b7280);
}

.feed-signin-btn {
    padding: 0.75rem 1.5rem;
    background: var(--color-brand, #3b82f6);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
}

.feed-signin-btn:hover {
    background: var(--color-brand-dark, #2563eb);
}

/* Feed Post Card */
.feed-post-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    padding: 1rem;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

/* Make clickable post cards have hover feedback */
.feed-post-card.js-post-clickable {
    cursor: pointer;
}

.feed-post-card.js-post-clickable:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.feed-post-card.js-post-clickable:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.feed-post-card.js-post-clickable:focus-visible {
    outline: 2px solid var(--color-brand, #3b82f6);
    outline-offset: 2px;
}

/* Ensure clickable areas have proper cursor */
.feed-post-card.js-post-clickable .js-post-title,
.feed-post-card.js-post-clickable .js-post-images,
.feed-post-card.js-post-clickable .js-post-body,
.feed-post-card.js-post-clickable .post-preview-caption,
.feed-post-card.js-post-clickable .feed-post-meta {
    cursor: pointer;
}

/* Post Detail Page Card - Same styling as feed posts */
.post-detail-container .post-preview-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    padding: 1rem;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

/* Post Metadata */
.feed-post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm); /* Increased from 12px to 14px for accessibility */
    color: var(--color-text-muted, #6b7280);
    flex-wrap: wrap;
}

.feed-post-username {
    font-weight: 600;
    color: var(--color-foreground, #1f2937);
}

.feed-post-separator {
    color: var(--color-text-muted, #9ca3af);
}

.feed-post-time {
    color: var(--color-text-muted, #6b7280);
}

/* Post Reactions Container */
.post-reactions__container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Pill Button Improvements */
.pill-btn:active {
    transform: scale(0.95);
}

.pill-btn:focus-visible {
    outline: 2px solid var(--color-brand, #3b82f6);
    outline-offset: 2px;
}

/* Post Image Styles */
.post-preview-image-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    width: 100%;
    max-width: 100%;
    display: block;
    min-height: 200px;
    /* Ensure container is responsive */
    box-sizing: border-box;
    /* Firefox fix: ensure no extra spacing */
    line-height: 0;
    font-size: 0;
}

.post-preview-image img{
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Grid layout for multiple images in detail view */
.post-preview-image-wrap[style*="grid"] {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    padding-block: 0.75rem;
}

.post-preview-image-wrap[style*="grid"] .post-preview-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
    /* Prevent layout shifts for grid images */
    aspect-ratio: 1 / 1;
    /* Ensure responsive in grid */
    box-sizing: border-box;
    min-width: 0;
}

/* Responsive Design */
@media (max-width: 767px) {
    .feed-post-card {
        padding: 0.75rem;
    }
    
    .post-preview-image-wrap {
        min-height: 150px;
        max-width: 100%;
    }
    
    .post-preview-image {
        max-height: 400px;
        max-width: 100%;
        width: 100%;
        height: auto;
        /* Ensure responsive on very small screens */
        min-width: 0;
    }
    
    /* Adjust grid for smaller screens */
    .post-preview-image-wrap[style*="grid"] {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.25rem;
    }
}

/* Tablet-specific adjustments (768px and up) */
@media (min-width: 768px) {
    .post-preview-image-wrap {
        min-height: 200px;
        max-width: 100%;
    }
    
    .post-preview-image {
        max-width: 100%;
        max-height: 600px;
        display: block;
        /* Prevent layout shifts by reserving space */
        aspect-ratio: 16 / 9;
        object-fit: cover;
        object-position: center;
        /* Ensure image is responsive and doesn't overflow */
        box-sizing: border-box;
        /* Firefox fix: remove any default spacing */
        margin: 0;
        padding: 0;
        border: none;
        /* Prevent image from being larger than container */
        overflow: hidden;
    }
}

