/**
 * GA4 Popular Posts Plugin Styles
 */

.ga4-popular-posts {
    margin: 0;
    padding: 0;
}

.ga4-popular-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ga4-popular-post-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background-color: #fff;
    transition: background-color 0.2s ease;
}

.ga4-popular-post-item:hover {
    background-color: #f8f9fa;
}

.ga4-popular-post-item:last-child {
    margin-bottom: 0;
}

.ga4-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    margin-right: 12px;
    padding: 2px 6px;
    background-color: #007cba;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 12px;
    flex-shrink: 0;
}

.ga4-rank:nth-child(1) {
    background-color: #d4a02e; /* Gold */
}

.ga4-popular-post-item[data-rank="1"] .ga4-rank {
    background-color: #d4a02e; /* Gold */
}

.ga4-popular-post-item[data-rank="2"] .ga4-rank {
    background-color: #a8a8a8; /* Silver */
}

.ga4-popular-post-item[data-rank="3"] .ga4-rank {
    background-color: #cd7f32; /* Bronze */
}

.ga4-post-content {
    flex: 1;
    min-width: 0;
}

.ga4-post-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.ga4-post-title a {
    color: #1e1e1e;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ga4-post-title a:hover {
    color: #007cba;
    text-decoration: underline;
}

.ga4-post-date,
.ga4-post-views {
    display: inline-block;
    margin-right: 10px;
    font-size: 11px;
    color: #6c757d;
}

.ga4-post-excerpt {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #555;
    line-height: 1.4;
}

/* サイドバー用のコンパクトスタイル */
.widget .ga4-popular-posts {
    font-size: 13px;
}

.widget .ga4-popular-post-item {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #e1e5e9;
}

.widget .ga4-rank {
    min-width: 20px;
    height: 20px;
    margin-right: 8px;
    font-size: 11px;
}

.widget .ga4-post-title {
    font-size: 13px;
    margin-bottom: 3px;
}

.widget .ga4-post-date,
.widget .ga4-post-views {
    font-size: 10px;
}

.widget .ga4-post-excerpt {
    font-size: 11px;
    margin-top: 5px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .ga4-popular-post-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ga4-rank {
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    .ga4-post-content {
        width: 100%;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .ga4-popular-post-item {
        background-color: #1e1e1e;
        border-color: #333;
        color: #e1e5e9;
    }
    
    .ga4-popular-post-item:hover {
        background-color: #2a2a2a;
    }
    
    .ga4-post-title a {
        color: #e1e5e9;
    }
    
    .ga4-post-title a:hover {
        color: #4fc3f7;
    }
    
    .ga4-post-date,
    .ga4-post-views {
        color: #aaa;
    }
    
    .ga4-post-excerpt {
        color: #ccc;
    }
}

/* 管理画面用のスタイル */
.ga4-popular-posts-admin {
    max-width: 800px;
}

.ga4-admin-section {
    margin-bottom: 30px;
}

.ga4-admin-section h2 {
    border-bottom: 2px solid #007cba;
    padding-bottom: 5px;
}

.ga4-connection-status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    font-weight: bold;
}

.ga4-connection-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ga4-connection-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ga4-cache-stats {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.ga4-cache-stats h4 {
    margin-top: 0;
}

.ga4-cache-stats ul {
    margin: 0;
    padding-left: 20px;
}

/* エラーメッセージ */
.ga4-error-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    color: #856404;
}

/* 成功メッセージ */
.ga4-success-message {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    color: #0c5460;
}

/* ローディング状態 */
.ga4-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: ga4-spin 1s linear infinite;
}

@keyframes ga4-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}