/**
 * Custom Story VN - Frontend Styles
 * Styles cho shortcode hiển thị posts
 */

/* ========================================
   Container & Grid Layout
======================================== */

.csvn-posts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.csvn-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

/* Grid variations - Hỗ trợ 1-6 cột */
.csvn-posts-grid.csvn-cols-1 {
    grid-template-columns: 1fr;
}

.csvn-posts-grid.csvn-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.csvn-posts-grid.csvn-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.csvn-posts-grid.csvn-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.csvn-posts-grid.csvn-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.csvn-posts-grid.csvn-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* ========================================
   Post Item Card
======================================== */

.csvn-post-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.csvn-post-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Thumbnail
======================================== */

.csvn-post-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.csvn-post-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.csvn-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.csvn-post-item:hover .csvn-post-thumbnail img {
    transform: scale(1.08);
}

/* Date badge */
.csvn-post-date {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csvn-date-icon {
    font-size: 14px;
}

/* ========================================
   Post Content
======================================== */

.csvn-post-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.csvn-post-title {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 700;
}

.csvn-post-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.csvn-post-title a:hover {
    color: #667eea;
}

/* ========================================
   Post Meta
======================================== */

.csvn-post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

.csvn-author {
    display: flex;
    align-items: center;
    gap: 4px;
}

.csvn-author-icon {
    font-size: 14px;
}

/* ========================================
   Excerpt
======================================== */

.csvn-post-excerpt {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   Post Footer & Read More
======================================== */

.csvn-post-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.csvn-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.csvn-read-more:hover {
    color: #764ba2;
    gap: 10px;
}

.csvn-arrow {
    transition: transform 0.3s ease;
}

.csvn-read-more:hover .csvn-arrow {
    transform: translateX(4px);
}

/* ========================================
   Empty State
======================================== */

.csvn-no-posts {
    text-align: center;
    padding: 80px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
}

.csvn-no-posts-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.csvn-no-posts p {
    font-size: 16px;
    margin: 0;
}

/* ========================================
   Pagination
======================================== */

.csvn-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 40px;
    padding: 20px 0;
}

.csvn-page-link,
.csvn-page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 16px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    gap: 6px;
}

.csvn-page-link:hover,
.csvn-page-number:hover {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.csvn-page-number.csvn-current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.csvn-page-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
}

.csvn-page-dots {
    color: #999;
    padding: 0 8px;
    font-weight: 600;
}

.csvn-arrow-left,
.csvn-arrow-right {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.csvn-page-link.csvn-prev:hover .csvn-arrow-left {
    transform: translateX(-3px);
}

.csvn-page-link.csvn-next:hover .csvn-arrow-right {
    transform: translateX(3px);
}

/* ========================================
   Responsive Design
======================================== */

/* Tablet Landscape */
@media (max-width: 1024px) {
    .csvn-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
    
    .csvn-posts-grid.csvn-cols-4,
    .csvn-posts-grid.csvn-cols-5,
    .csvn-posts-grid.csvn-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet Portrait */
@media (max-width: 768px) {
    .csvn-posts-container {
        padding: 15px;
    }
    
    .csvn-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .csvn-posts-grid.csvn-cols-3,
    .csvn-posts-grid.csvn-cols-4,
    .csvn-posts-grid.csvn-cols-5,
    .csvn-posts-grid.csvn-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .csvn-post-title {
        font-size: 16px;
    }
    
    .csvn-post-excerpt {
        font-size: 13px;
    }
    
    .csvn-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .csvn-page-link,
    .csvn-page-number {
        min-width: 36px;
        height: 36px;
        padding: 0 12px;
        font-size: 13px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .csvn-posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .csvn-posts-grid.csvn-cols-2,
    .csvn-posts-grid.csvn-cols-3,
    .csvn-posts-grid.csvn-cols-4,
    .csvn-posts-grid.csvn-cols-5,
    .csvn-posts-grid.csvn-cols-6 {
        grid-template-columns: 1fr;
    }
    
    .csvn-post-thumbnail {
        aspect-ratio: 16 / 9;
    }
    
    .csvn-post-content {
        padding: 16px;
    }
    
    .csvn-post-title {
        font-size: 15px;
    }
    
    .csvn-post-excerpt {
        -webkit-line-clamp: 2;
    }
    
    .csvn-no-posts {
        padding: 60px 20px;
    }
    
    .csvn-no-posts-icon {
        font-size: 48px;
    }
    
    .csvn-page-link span {
        display: none;
    }
    
    .csvn-page-link {
        padding: 0;
        width: 36px;
    }
}

/* ========================================
   Print Styles
======================================== */

@media print {
    .csvn-pagination,
    .csvn-read-more {
        display: none;
    }
    
    .csvn-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .csvn-post-item {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* ========================================
   Dark Mode Support (optional)
======================================== */

@media (prefers-color-scheme: dark) {
    .csvn-post-item {
        background: #2a2a2a;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .csvn-post-title a {
        color: #e0e0e0;
    }
    
    .csvn-post-title a:hover {
        color: #a8b5ff;
    }
    
    .csvn-post-excerpt {
        color: #b0b0b0;
    }
    
    .csvn-post-meta {
        color: #999;
    }
    
    .csvn-post-footer {
        border-top-color: #444;
    }
    
    .csvn-page-link,
    .csvn-page-number {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .csvn-no-posts {
        background: #2a2a2a;
        color: #b0b0b0;
    }
}

/* ========================================
   Accessibility
======================================== */

.csvn-post-item:focus-within {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.csvn-post-title a:focus,
.csvn-read-more:focus,
.csvn-page-link:focus,
.csvn-page-number:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .csvn-post-item,
    .csvn-post-thumbnail img,
    .csvn-read-more,
    .csvn-page-link,
    .csvn-page-number {
        transition: none;
    }
}

