/**
 * Popular Page Styles
 * 
 * @package 20190301-nashiyoi
 * @since 1.0.0
 */

/* Popular Page Layout */
.popular-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Hero Section */
.popular-hero {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #1a3a5c 0%, #2d5a87 100%);
    border-radius: 12px;
    color: #fff;
}

.popular-hero h1 {
    font-size: 32px;
    margin: 0 0 10px;
    font-weight: 700;
}

.popular-hero p {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
    color:#fff;
}

/* Controls: Period Tabs + View Toggle */
.popular-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.period-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.period-tab {
    display: inline-block;
    padding: 12px 24px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.period-tab:hover {
    background: #e9ecef;
    color: #333;
}

.period-tab.active {
    background: #1a3a5c;
    color: #fff;
    border-color: #1a3a5c;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.view-btn.active {
    background: #fff;
    color: #1a3a5c;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Posts Grid */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

/* Posts List View */
.popular-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.popular-list .popular-card {
    flex-direction: row;
    max-height: 160px;
}

.popular-list .popular-card-thumbnail {
    width: 200px;
    min-width: 200px;
    aspect-ratio: auto;
    height: 100%;
}

.popular-list .popular-card-content {
    padding: 16px 20px;
}

.popular-list .popular-card-title {
    font-size: 16px;
    margin-bottom: 8px;
}

.popular-list .popular-card-excerpt {
    font-size: 13px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-list .popular-card-rank {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

@media (max-width: 767px) {
    .popular-list .popular-card {
        flex-direction: row; /* Keep horizontal */
        max-height: 120px; /* Limit height */
        align-items: center;
    }
    
    .popular-list .popular-card-thumbnail {
        width: 120px;
        min-width: 120px;
        height: 100%;
        aspect-ratio: 1/1; /* Square or close to it for valid list feel */
    }

    .popular-list .popular-card-content {
        padding: 10px 15px;
    }

    .popular-list .popular-card-title {
        font-size: 15px;
        margin-bottom: 5px;
    }
    
    .popular-list .popular-card-excerpt {
        display: none; /* Hide excerpt on very small screens if needed, or truncate more */
    }
    
    .popular-list .popular-card-meta {
        font-size: 11px;
    }
}

.popular-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.4s ease-out both;
}

.popular-card:nth-child(1) { animation-delay: 0.05s; }
.popular-card:nth-child(2) { animation-delay: 0.1s; }
.popular-card:nth-child(3) { animation-delay: 0.15s; }
.popular-card:nth-child(4) { animation-delay: 0.2s; }
.popular-card:nth-child(5) { animation-delay: 0.25s; }
.popular-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popular-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.popular-card-thumbnail {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f0f1 0%, #e5e7eb 100%);
    position: relative;
}

.popular-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.popular-card:hover .popular-card-thumbnail img {
    transform: scale(1.05);
}

.popular-card-thumbnail .no-thumbnail {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 48px;
}

.popular-card-rank {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(4px);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Top 3 Medals - Gold, Silver, Bronze */
/* Top 3 Medals - Gold, Silver, Bronze (Lighter/Softer) */
.popular-card-rank.top-3[data-rank="1"] {
    background: linear-gradient(135deg, #ffe55c 0%, #ffc83d 100%);
    color: #8a6a00;
}

.popular-card-rank.top-3[data-rank="2"] {
    background: linear-gradient(135deg, #f5f5f5 0%, #dcdcdc 100%);
    color: #555;
}

.popular-card-rank.top-3[data-rank="3"] {
    background: linear-gradient(135deg, #e3c193 0%, #d6a66d 100%);
    color: #6d4618;
}

.popular-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.popular-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.4;
    color: #1a3a5c;
}

.popular-card-title a {
    color: inherit;
    text-decoration: none;
}

.popular-card-title a:hover {
    color: #2d5a87;
}

.popular-card-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
}

.popular-card-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #888;
}

.popular-card-views {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #e11d48;
}

/* 18+ Badge */
.popular-card-adult-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

/* No Posts Message */
.no-posts-message {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
}

.no-posts-message h3 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #333;
}

/* Responsive */
@media (max-width: 767px) {
    .popular-page-wrapper {
        padding: 20px 15px;
    }
    
    .popular-hero {
        padding: 30px 15px;
    }
    
    .popular-hero h1 {
        font-size: 24px;
    }
    
    .popular-grid {
        grid-template-columns: 1fr;
    }
    
    .period-tabs {
        gap: 8px;
    }
    
    .period-tab {
        padding: 10px 18px;
        font-size: 14px;
    }
}
