/**
 * PostCard Component Styles
 * 
 * Unified styling for all content post card types.
 */

/* Base Card Styles */
.post-card {
    display: flex;
    flex-direction: column;
    background: var(--card-background, #ffffff);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color, #e0e0e0);
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.post-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Card Header */
.post-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color-light, #f0f0f0);
}

.post-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-index { background: #dbeafe; color: #1d4ed8; }
.badge-media { background: #ede9fe; color: #7c3aed; }
.badge-chart { background: #d1fae5; color: #059669; }
.badge-table { background: #fef3c7; color: #d97706; }
.badge-take { background: #fef3c7; color: #d97706; }
.badge-timeline { background: #fee2e2; color: #dc2626; }
.badge-default { background: #f3f4f6; color: #6b7280; }

.post-topic-link {
    font-size: 13px;
    color: var(--text-secondary, #666);
    text-decoration: none;
}

.post-topic-link:hover {
    color: var(--primary-color, #3b82f6);
    text-decoration: underline;
}

/* Card Media */
.post-card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface-color, #f5f5f5);
}

.post-media-image,
.post-media-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Card Body */
.post-card-body {
    flex: 1;
    padding: 16px;
}

.post-card-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 8px;
    color: var(--text-primary, #111);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-description {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary, #666);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Tags */
.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.post-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--surface-color, #f5f5f5);
    color: var(--text-secondary, #666);
}

/* Card Footer */
.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color-light, #f0f0f0);
}

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #111);
    text-decoration: none;
}

.author-name:hover {
    text-decoration: underline;
}

.post-date {
    font-size: 12px;
    color: var(--text-tertiary, #999);
    margin-left: 4px;
}

.post-stats {
    display: flex;
    gap: 12px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary, #666);
}

.stat svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   Type-Specific Styles
   ========================================================================== */

/* Take Card */
.post-card-take .take-content {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary, #111);
    font-style: italic;
    margin-bottom: 12px;
}

.take-quote {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color, #3b82f6);
    vertical-align: text-top;
    line-height: 1;
}

.take-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #666);
}

/* External Media Card */
.post-card-embed-preview {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--surface-color, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.embed-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.platform-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.platform-icon {
    font-size: 14px;
}

/* Timeline Card */
.post-card-timeline-preview {
    padding: 20px;
    background: var(--surface-color, #f5f5f5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.timeline-thumbnail-stack {
    position: relative;
    width: 180px;
    height: 100px;
}

.timeline-thumb {
    position: absolute;
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.timeline-thumb:nth-child(1) { left: 0; z-index: 3; }
.timeline-thumb:nth-child(2) { left: 30px; top: 10px; z-index: 2; }
.timeline-thumb:nth-child(3) { left: 60px; top: 20px; z-index: 1; }

.post-card-timeline:hover .timeline-thumb:nth-child(1) { transform: translateX(-5px) rotate(-3deg); }
.post-card-timeline:hover .timeline-thumb:nth-child(2) { transform: rotate(1deg); }
.post-card-timeline:hover .timeline-thumb:nth-child(3) { transform: translateX(5px) rotate(3deg); }

.timeline-empty-stack {
    font-size: 48px;
    opacity: 0.3;
}

.timeline-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #666);
}

/* Chart Card */
.post-card-chart-preview {
    aspect-ratio: 16 / 9;
    background: var(--surface-color, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary, #666);
}

.chart-icon {
    font-size: 48px;
    opacity: 0.5;
}

.chart-type {
    font-size: 14px;
    font-weight: 500;
    text-transform: capitalize;
}

/* Table Card */
.post-card-table-preview {
    padding: 30px;
    background: var(--surface-color, #f5f5f5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary, #666);
}

.table-icon {
    font-size: 36px;
    opacity: 0.5;
}

/* Media Placeholder */
.media-placeholder {
    font-size: 48px;
    opacity: 0.3;
}

/* ==========================================================================
   Card Grid Layouts
   ========================================================================== */

.post-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.post-cards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-cards-list .post-card {
    flex-direction: row;
}

.post-cards-list .post-card-media {
    width: 200px;
    flex-shrink: 0;
    aspect-ratio: auto;
    height: 150px;
}

/* ==========================================================================
   Compact Card Variant
   ========================================================================== */

.post-card-compact .post-card-body {
    padding: 12px;
}

.post-card-compact .post-card-title {
    font-size: 15px;
    -webkit-line-clamp: 1;
}

.post-card-compact .post-card-description {
    font-size: 13px;
    -webkit-line-clamp: 2;
}

.post-card-compact .post-card-footer {
    padding: 8px 12px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .post-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .post-cards-list .post-card {
        flex-direction: column;
    }
    
    .post-cards-list .post-card-media {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
    
    .post-card-title {
        font-size: 16px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .post-card {
        background: var(--card-background-dark, #1f2937);
        border-color: var(--border-color-dark, #374151);
    }
    
    .post-card:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }
    
    .post-card-header,
    .post-card-footer {
        border-color: var(--border-color-dark, #374151);
    }
    
    .post-card-title {
        color: var(--text-primary-dark, #f3f4f6);
    }
    
    .post-card-description,
    .post-topic-link,
    .stat {
        color: var(--text-secondary-dark, #9ca3af);
    }
    
    .author-name {
        color: var(--text-primary-dark, #f3f4f6);
    }
    
    .post-tag {
        background: var(--surface-color-dark, #374151);
        color: var(--text-secondary-dark, #9ca3af);
    }
    
    .post-card-embed-preview,
    .post-card-chart-preview,
    .post-card-table-preview,
    .post-card-timeline-preview,
    .post-card-media {
        background: var(--surface-color-dark, #111827);
    }
}
