/**
 * Posts Display - Frontend Styles
 *
 * @package WPSitesKit
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.wsk-posts {
    margin: 0;
}

.wsk-posts-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.wsk-posts-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wsk-posts-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.wsk-posts-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.wsk-posts-item-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 5px;
}

.wsk-posts-item-title a {
    color: #1a1a2e;
    text-decoration: none;
    transition: color 0.2s;
}

.wsk-posts-item-title a:hover {
    color: #667eea;
}

.wsk-posts-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.75rem;
    color: #6b7280;
}

.wsk-posts-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wsk-posts-meta span::before {
    content: '';
}

.wsk-posts-date::before {
    content: '📅';
}

.wsk-posts-author::before {
    content: '👤';
}

.wsk-posts-views::before {
    content: '👁';
}

.wsk-posts-comments::before {
    content: '💬';
}

.wsk-posts-category {
    display: inline-block;
    margin-bottom: 5px;
}

.wsk-posts-category a {
    display: inline-block;
    padding: 2px 8px;
    background: #667eea;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.2s;
}

.wsk-posts-category a:hover {
    background: #764ba2;
}

.wsk-posts-excerpt {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 8px 0;
}

.wsk-posts-thumb {
    flex-shrink: 0;
}

.wsk-posts-thumb a {
    display: block;
    width: 100%;
    height: 100%;
}

.wsk-posts-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.wsk-posts-content {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   List Style (default)
   ========================================================================== */

.wsk-posts-list .wsk-posts-item {
    display: flex;
    gap: 15px;
}

.wsk-posts-list .wsk-posts-thumb {
    width: 80px;
    height: 80px;
}

/* ==========================================================================
   Compact Style
   ========================================================================== */

.wsk-posts-compact .wsk-posts-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.wsk-posts-compact .wsk-posts-thumb {
    width: 50px;
    height: 50px;
}

.wsk-posts-compact .wsk-posts-item-title {
    font-size: 0.875rem;
    margin: 0;
}

.wsk-posts-compact .wsk-posts-meta {
    font-size: 0.6875rem;
    margin-top: 3px;
}

.wsk-posts-compact .wsk-posts-category {
    display: none;
}

/* ==========================================================================
   Cards Style
   ========================================================================== */

.wsk-posts-cards .wsk-posts-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.wsk-posts-cards .wsk-posts-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    margin: 0;
    border-bottom: none;
    transition: box-shadow 0.2s, transform 0.2s;
}

.wsk-posts-cards .wsk-posts-item:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.wsk-posts-cards .wsk-posts-thumb {
    width: 100%;
    height: 160px;
}

.wsk-posts-cards .wsk-posts-thumb img {
    border-radius: 0;
}

.wsk-posts-cards .wsk-posts-content {
    padding: 15px;
}

.wsk-posts-cards .wsk-posts-item-title {
    font-size: 1rem;
}

/* ==========================================================================
   Minimal Style
   ========================================================================== */

.wsk-posts-minimal .wsk-posts-item {
    display: block;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f5f5f5;
}

.wsk-posts-minimal .wsk-posts-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    padding-left: 15px;
}

.wsk-posts-minimal .wsk-posts-item-title::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: 700;
}

.wsk-posts-minimal .wsk-posts-meta {
    padding-left: 15px;
    margin-top: 3px;
    font-size: 0.6875rem;
}

.wsk-posts-minimal .wsk-posts-thumb,
.wsk-posts-minimal .wsk-posts-category {
    display: none;
}

/* ==========================================================================
   Numbered Style (Popular Posts)
   ========================================================================== */

.wsk-posts-popular .wsk-posts-items {
    counter-reset: post-counter;
}

.wsk-posts-popular .wsk-posts-item {
    counter-increment: post-counter;
    position: relative;
}

.wsk-posts-popular.wsk-posts-list .wsk-posts-item {
    padding-left: 40px;
}

.wsk-posts-popular .wsk-posts-item::before {
    content: counter(post-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.wsk-posts-popular.wsk-posts-list .wsk-posts-thumb {
    margin-left: -40px;
}

.wsk-posts-popular.wsk-posts-compact .wsk-posts-item {
    padding-left: 35px;
}

.wsk-posts-popular.wsk-posts-compact .wsk-posts-item::before {
    width: 24px;
    height: 24px;
    font-size: 0.6875rem;
}

/* First three numbers special styling */
.wsk-posts-popular .wsk-posts-item:nth-child(1)::before {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.wsk-posts-popular .wsk-posts-item:nth-child(2)::before {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.wsk-posts-popular .wsk-posts-item:nth-child(3)::before {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
}

/* Cards style doesn't show numbers */
.wsk-posts-popular.wsk-posts-cards .wsk-posts-item::before {
    display: none;
}

/* ==========================================================================
   Widget Specific
   ========================================================================== */

.widget .wsk-posts {
    font-size: 14px;
}

.widget .wsk-posts-title {
    display: none; /* Widget has its own title */
}

.widget .wsk-posts-list .wsk-posts-thumb {
    width: 70px;
    height: 70px;
}

.widget .wsk-posts-item-title {
    font-size: 0.875rem;
}

.widget .wsk-posts-cards .wsk-posts-items {
    grid-template-columns: 1fr;
}

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

@media (prefers-color-scheme: dark) {
    .wsk-posts-item-title a {
        color: #e5e7eb;
    }
    
    .wsk-posts-item-title a:hover {
        color: #818cf8;
    }
    
    .wsk-posts-cards .wsk-posts-item {
        background: #1f2937;
        border-color: #374151;
    }
}

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

@media (max-width: 768px) {
    .wsk-posts-cards .wsk-posts-items {
        grid-template-columns: 1fr;
    }
    
    .wsk-posts-list .wsk-posts-thumb {
        width: 60px;
        height: 60px;
    }
    
    .wsk-posts-item-title {
        font-size: 0.875rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wsk-posts-thumb {
        display: none;
    }
    
    .wsk-posts-item {
        break-inside: avoid;
    }
}

/* ==========================================================================
   Tabs Component
   ========================================================================== */

.wsk-posts-tabs {
    margin: 0;
}

.wsk-tabs-nav {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0;
}

.wsk-tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
    margin-bottom: -1px;
}

.wsk-tab-btn:hover {
    color: #1a1a2e;
    background: #f3f4f6;
}

.wsk-tab-btn.active {
    background: #d4a855;
    color: #fff;
}

.wsk-tab-panel {
    display: none;
}

.wsk-tab-panel.active {
    display: block;
}

/* Pills Style */
.wsk-tabs-pills .wsk-tabs-nav {
    border-bottom: none;
    gap: 8px;
    padding-bottom: 15px;
}

.wsk-tabs-pills .wsk-tab-btn {
    border-radius: 25px;
    padding: 8px 20px;
    margin-bottom: 0;
}

/* Underline Style */
.wsk-tabs-underline .wsk-tabs-nav {
    gap: 0;
}

.wsk-tabs-underline .wsk-tab-btn {
    border-radius: 0;
    padding: 12px 24px;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.wsk-tabs-underline .wsk-tab-btn.active {
    background: transparent;
    color: #d4a855;
    border-bottom-color: #d4a855;
}

/* Boxed Style */
.wsk-tabs-boxed .wsk-tabs-nav {
    background: #f3f4f6;
    padding: 5px;
    border-radius: 8px;
    border-bottom: none;
    gap: 5px;
}

.wsk-tabs-boxed .wsk-tab-btn {
    border-radius: 6px;
    padding: 10px 20px;
    margin-bottom: 0;
}

.wsk-tabs-boxed .wsk-tab-btn.active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tabs Responsive */
@media (max-width: 480px) {
    .wsk-tabs-nav {
        flex-wrap: wrap;
    }
    
    .wsk-tab-btn {
        flex: 1;
        min-width: 100px;
        text-align: center;
        padding: 8px 12px;
        font-size: 0.8125rem;
    }
}

/* ==========================================================================
   Auto Insert Styles
   ========================================================================== */

.wsk-posts-auto-insert {
    margin: 30px 0;
    padding: 25px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.wsk-posts-auto-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2196F3;
}

.wsk-posts-auto-insert .wsk-posts {
    margin: 0;
}

/* ==========================================================================
   Inline Box Styles (BBC Magazine Style)
   ========================================================================== */

.wsk-posts-inline {
    margin: 20px 0;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-top: 3px solid #0066cc;
    clear: both;
}

.wsk-posts-inline-header {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.wsk-posts-inline-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wsk-posts-inline-content {
    padding: 15px;
}

.wsk-posts-inline-content .wsk-posts {
    margin: 0;
}

.wsk-posts-inline-content .wsk-posts-items {
    margin: 0;
    padding: 0;
}

.wsk-posts-inline-content .wsk-posts-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dotted #ddd;
}

.wsk-posts-inline-content .wsk-posts-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.wsk-posts-inline-content .wsk-posts-item-title {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.wsk-posts-inline-content .wsk-posts-item-title a {
    color: #0066cc;
    text-decoration: none;
}

.wsk-posts-inline-content .wsk-posts-item-title a:hover {
    text-decoration: underline;
}

/* Float Right - Magazine Style (like BBC) */
.wsk-posts-inline-sidebar-right {
    float: right;
    margin: 0 0 20px 25px;
    max-width: 300px;
    width: 100%;
}

/* Float Left */
.wsk-posts-inline-sidebar-left {
    float: left;
    margin: 0 25px 20px 0;
    max-width: 300px;
    width: 100%;
}

/* Centered Box */
.wsk-posts-inline-box {
    max-width: 600px;
    margin: 30px auto;
    border-radius: 8px;
    overflow: hidden;
}

.wsk-posts-inline-box .wsk-posts-inline-header {
    background: linear-gradient(135deg, #f5f7fa 0%, #fff 100%);
}

/* Banner Style - Horizontal */
.wsk-posts-inline-banner {
    border-radius: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-top: none;
    color: #fff;
}

.wsk-posts-inline-banner .wsk-posts-inline-header {
    background: transparent;
    border-bottom-color: rgba(255,255,255,0.2);
}

.wsk-posts-inline-banner .wsk-posts-inline-title {
    color: #fff;
}

.wsk-posts-inline-banner .wsk-posts-inline-content {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.wsk-posts-inline-banner .wsk-posts-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.wsk-posts-inline-banner .wsk-posts-item {
    flex: 1;
    min-width: 150px;
    margin: 0;
    padding: 0;
    border: none;
}

.wsk-posts-inline-banner .wsk-posts-item-title a {
    color: #fff;
}

.wsk-posts-inline-banner .wsk-posts-item-meta {
    color: rgba(255,255,255,0.8);
}

/* Minimal Box */
.wsk-posts-inline-minimal-box {
    background: #fff;
    border: 1px solid #eee;
    border-top: 2px solid #333;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.wsk-posts-inline-minimal-box .wsk-posts-inline-header {
    background: #fff;
    border-bottom: none;
    padding-bottom: 5px;
}

.wsk-posts-inline-minimal-box .wsk-posts-inline-title {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wsk-posts-inline-minimal-box .wsk-posts-item {
    border-bottom-style: solid;
    border-bottom-color: #f0f0f0;
}

.wsk-posts-inline-minimal-box .wsk-posts-item-title a {
    color: #333;
}

/* Hide thumbnails in inline boxes for cleaner look */
.wsk-posts-inline .wsk-posts-item-thumb {
    display: none;
}

/* Show thumbnails only in box and banner styles */
.wsk-posts-inline-box .wsk-posts-item-thumb,
.wsk-posts-inline-banner .wsk-posts-item-thumb {
    display: block;
    width: 60px;
    height: 60px;
    margin-right: 12px;
    flex-shrink: 0;
}

.wsk-posts-inline-box .wsk-posts-item,
.wsk-posts-inline-banner .wsk-posts-item {
    display: flex;
    align-items: flex-start;
}

/* Responsive */
@media (max-width: 768px) {
    .wsk-posts-inline-sidebar-right,
    .wsk-posts-inline-sidebar-left {
        float: none;
        max-width: 100%;
        margin: 20px 0;
    }
    
    .wsk-posts-inline-banner .wsk-posts-items {
        flex-direction: column;
    }
    
    .wsk-posts-inline-banner .wsk-posts-item {
        min-width: 100%;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wsk-posts-auto-insert {
        background: #1f2937;
        border-color: #374151;
    }
    
    .wsk-posts-auto-title {
        color: #f3f4f6;
    }
    
    .wsk-posts-inline {
        background: #1f2937;
        border-color: #374151;
    }
    
    .wsk-posts-inline-header {
        background: #111827;
        border-color: #374151;
    }
    
    .wsk-posts-inline-title {
        color: #f3f4f6;
    }
    
    .wsk-posts-inline-content .wsk-posts-item-title a {
        color: #60a5fa;
    }
}
