/**
 * CPGP Frontend Styles
 * 全てのアーカイブページで共通のスタイル
 */

/* ========================================
   フッター領域の保護
   ※プラグインのスタイルをフッターに適用しない
======================================== */

#colophon a,
#colophon a:link,
#colophon a:visited,
#colophon a:hover,
footer a,
footer a:link,
footer a:visited,
footer a:hover {
    color: inherit !important;
}

/* ========================================
   アーカイブページ共通スタイル
======================================== */

/* アーカイブラッパー - 1140px固定 */
.cpgp-archive-wrapper {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* アーカイブヘッダー */
.cpgp-archive-header {
    margin: 0 0 40px 0 !important; /* テーマのmarginをリセット */
    padding-bottom: 30px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    border-bottom: 4px solid #0073aa !important;
}

.cpgp-archive-header .page-title {
    font-size: 36px !important;
    font-weight: 700 !important;
    color: #333 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.cpgp-archive-description {
    margin-top: 20px;
    color: #666;
    font-size: 16px;
    line-height: 1.7;
}

/* ========================================
   フィルターエリア
======================================== */

.cpgp-filters {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 40px;
}

.cpgp-filters h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
    padding: 20px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    background: #e3f2fd;
    border: 3px solid #2778bd;
    border-radius: 8px;
}

.cpgp-region-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cpgp-filter-btn {
    display: inline-block;
    background: #ffffff;
    color: #333;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.cpgp-filter-btn:visited {
    background: #ffffff;
    color: #333;
    border-color: #e0e0e0;
}

.cpgp-filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.cpgp-filter-btn.active {
    background: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
}

.cpgp-filter-btn.active:visited {
    background: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
}

.cpgp-filter-count {
    font-size: 12px;
    opacity: 0.8;
}

/* ========================================
   投稿グリッド
======================================== */

.cpgp-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 50px;
    align-items: start;
}

.cpgp-archive-item {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0 !important; /* テーマ側の.entryクラスのmarginをリセット */
    padding: 0 !important;
}

.cpgp-item-thumbnail {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.cpgp-item-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.cpgp-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cpgp-no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    color: #999;
    font-size: 18px;
    font-weight: 600;
}

.cpgp-item-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* カスタムページ専用のシンプルスタイル */
.cpgp-custom-page-item .cpgp-item-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cpgp-item-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
    line-height: 1.4;
}

.cpgp-item-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpgp-item-title a:hover {
    color: #0073aa;
}

.cpgp-item-title a:visited {
    color: #333;
}

.cpgp-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.cpgp-region-tag {
    display: inline-block;
    background: #e3f2fd;
    color: #0073aa;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.cpgp-post-type-badge {
    display: inline-block;
    background: #fff9e6;
    color: #856404;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.cpgp-item-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 15px;
}

.cpgp-item-excerpt p {
    margin: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cpgp-item-link {
    margin-top: auto;
}

.cpgp-read-more {
    display: block;
    width: 100%;
    text-align: center;
    background-color: #0073aa;
    color: #ffffff !important; /* 訪問済みでも白色を維持 */
    padding: 12px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.cpgp-read-more:hover,
.cpgp-read-more:visited {
    color: #ffffff !important; /* 訪問済みでも白色を維持 */
    background-color: #005a87;
}

.cpgp-read-more:visited:not(:hover) {
    background-color: #0073aa;
}

/* ========================================
   ページネーション
======================================== */

.cpgp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 50px 0;
}

.cpgp-pagination .page-numbers {
    display: inline-block;
    padding: 10px 16px;
    background: #ffffff;
    color: #0073aa;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cpgp-pagination .page-numbers:hover {
    background: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
}

.cpgp-pagination .page-numbers.current {
    background: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
}

.cpgp-pagination .page-numbers.dots {
    border: none;
    background: none;
    color: #999;
}

/* ========================================
   投稿なし
======================================== */

.cpgp-no-posts {
    text-align: center;
    padding: 80px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.cpgp-no-posts h2 {
    font-size: 24px;
    color: #333;
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
}

.cpgp-no-posts p {
    color: #666;
    font-size: 16px;
    margin-bottom: 40px;
}

.cpgp-back-to-all {
    display: inline-block;
    background-color: #0073aa;
    color: #ffffff !important;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.cpgp-back-to-all:link,
.cpgp-back-to-all:visited,
.cpgp-back-to-all:hover,
.cpgp-back-to-all:active,
.cpgp-back-to-all:focus {
    color: #ffffff !important;
    text-decoration: none;
}

.cpgp-back-to-all:hover {
    background-color: #005a87;
}

/* サービスフィルター情報 */
.cpgp-service-filter-info {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 4px;
}

.cpgp-service-filter-info p {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.cpgp-service-filter-info strong {
    color: #2196F3;
    font-weight: 700;
}

.cpgp-clear-filter {
    display: inline-block;
    color: #2196F3;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 5px 0;
    border-bottom: 1px solid #2196F3;
    transition: opacity 0.3s ease;
}

.cpgp-clear-filter:hover {
    opacity: 0.7;
}

/* ========================================
   レスポンシブ対応
======================================== */

@media (max-width: 1140px) {
    .cpgp-archive-wrapper {
        padding: 30px 15px;
    }
    
    .cpgp-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cpgp-archive-header .page-title {
        font-size: 28px !important;
    }
    
    .cpgp-filters {
        padding: 20px;
    }
    
    .cpgp-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cpgp-item-content {
        padding: 20px;
    }
    
    .cpgp-region-filters {
        gap: 8px;
    }
    
    .cpgp-filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}
