/*
 * Plugin Styles for My YouTuber Rating Plugin
 */

/* =============================== */
/* General / Layout Styles         */
/* =============================== */
#primary {
    margin-bottom: 30px; /* メインコンテンツ下の余白 */
}

.site-main {
    padding: 20px;
    background-color: #fefefe;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

h1.entry-title {
    color: #333;
    font-size: 2.2em;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

h2 {
    color: #444;
    font-size: 1.8em;
    margin-top: 30px;
    margin-bottom: 15px;
    border-left: 5px solid #0073aa;
    padding-left: 10px;
}

h3 {
    color: #555;
    font-size: 1.5em;
    margin-top: 25px;
    margin-bottom: 10px;
}

h4 {
    color: #666;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 8px;
}

/* =============================== */
/* YouTuber Details Styles         */
/* =============================== */

/* ★追加: サムネイルと最新コメントを並べるコンテナ */
.youtuber-overview-container {
    display: flex; /* Flexboxを有効にする */
    align-items: flex-start; /* 上揃え */
    gap: 20px; /* サムネイルとコメントの間のスペース */
    margin-bottom: 25px; /* 下の要素との間隔 */
    flex-wrap: wrap; /* 画面幅が狭い場合に折り返す */
}

.youtuber-thumbnail {
    /* text-align: center; これはFlexアイテムになるため不要 */
    margin-bottom: 0; /* 親がFlexコンテナなのでmargin-bottomは不要 */
    flex-shrink: 0; /* 縮小しない */
    width: 150px; /* ★サムネイルの固定幅 (調整可能) */
    height: 150px; /* ★サムネイルの固定高さ (調整可能) */
    border: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden; /* 画像がはみ出さないように */
    display: flex; /* 画像を中央に配置するためのFlexbox */
    justify-content: center;
    align-items: center;
}

.youtuber-thumbnail img {
    width: 100%; /* 親の.youtuber-thumbnailに合わせる */
    height: 100%; /* 親の.youtuber-thumbnailに合わせる */
    object-fit: cover; /* 画像が枠に収まるようにトリミング */
    display: block;
    margin: 0; /* 中央寄せのmarginはFlexboxで処理 */
    border: none; /* 親に枠線があるので不要 */
    box-shadow: none; /* 親に影があるので不要 */
}

/* ★追加: 登録者数と最新コメントをまとめる新しいFlexコンテナ */
.youtuber-stats-and-latest-comment {
    flex-grow: 1; /* 残りのスペースを全て占める */
    display: flex; /* このコンテナ内もFlexboxにする */
    flex-direction: column; /* 子要素を縦に並べる */
    justify-content: center; /* 垂直方向の中央揃え */
    /* サムネイルとの上下位置を合わせたい場合はalign-items: flex-start; なども検討 */
}

/* ★追加: 登録者数表示のスタイル */
.youtuber-subscribers-display {
    font-size: 1.2em; /* 文字サイズを少し大きく */
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0; /* 下に少し余白 */
    text-align: left; /* 左寄せ */
    width: 100%; /* 親要素の幅いっぱいに */
}


/* ★追加: 最新コメントのスクロールエリア */
.latest-comment-area {
    flex-grow: 1; /* 残りのスペースを埋めるように伸縮 */
    /* max-width: calc(100% - 170px); */ /* 親がyoutuber-stats-and-latest-commentなので、このmax-widthは不要になる場合が多い */
    background-color: #fcfcfc;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    max-height: 150px; /* ★スクロールする最大の高さ (サムネイルの高さに合わせるか調整) */
    overflow-y: auto; /* 垂直スクロールを有効に */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);

    /* スクロールバーのスタイルをカスタマイズ (WebKit/Blink系ブラウザ用) */
    scrollbar-width: thin; /* Firefox用 */
    scrollbar-color: #0073aa #f0f0f0; /* Firefox用 (thumb track) */
}

/* WebKit/Blink (Chrome, Safari, Edge) 用のスクロールバーカスタム */
.latest-comment-area::-webkit-scrollbar {
    width: 8px; /* スクロールバーの幅 */
}
.latest-comment-area::-webkit-scrollbar-track {
    background: #f0f0f0; /* トラックの背景色 */
    border-radius: 10px;
}
.latest-comment-area::-webkit-scrollbar-thumb {
    background-color: #0073aa; /* スクロールバーのつまみの色 */
    border-radius: 10px;
    border: 2px solid #f0f0f0; /* つまみの周りの枠線 */
}
.latest-comment-area::-webkit-scrollbar-thumb:hover {
    background-color: #005177; /* ホバー時の色 */
}

.latest-comment-area h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3em;
    color: #444;
    border-left: none; /* 通常のh3のスタイルを上書き */
    padding-left: 0;
}

.latest-comment-item {
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
    margin-bottom: 10px;
}
.latest-comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.latest-comment-item p {
    margin-bottom: 5px;
    line-height: 1.5;
}

.latest-comment-item p strong {
    font-size: 1em;
    color: #333;
}

.latest-comment-stars {
    color: #FFD700; /* 星の色 */
    font-size: 1.1em;
    margin-bottom: 5px;
}
.latest-comment-text {
    font-size: 0.95em;
    color: #555;
    white-space: pre-wrap; /* 改行を保持 */
}
.latest-comment-date {
    font-size: 0.85em;
    color: #777;
    font-style: italic;
    text-align: right;
}

.rating-date-inline { /* この要素はlatest-comment-areaの外にあり、既存のHTMLには直接含まれていませんが、もし必要であれば追加 */
    font-style: italic;
    font-size: 0.9em;
    color: #777;
    margin-left: 10px; /* 名前の右に少しスペース */
}


/* ★既存: YouTuberディスクリプション用のスクロール可能な枠 */
.youtuber-description-scroll {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fcfcfc;
    border-radius: 5px;
    line-height: 1.6;
    scrollbar-width: thin;
    scrollbar-color: #0073aa #f0f0f0;
}
/* WebKit/Blink (Chrome, Safari, Edge) 用のスクロールバーカスタム */
.youtuber-description-scroll::-webkit-scrollbar {
    width: 8px;
}
.youtuber-description-scroll::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}
.youtuber-description-scroll::-webkit-scrollbar-thumb {
    background-color: #0073aa;
    border-radius: 10px;
    border: 2px solid #f0f0f0;
}
.youtuber-description-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #005177;
}


/* =============================== */
/* Rating Section Styles           */
/* =============================== */
.youtuber-rating-section {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.youtuber-rating-vote-buttons {
    margin-top: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.youtuber-rating-vote-button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.youtuber-rating-vote-button:hover {
    background-color: #e0e0e0;
}

.youtuber-rating-vote-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #e9e9e9;
}

.youtuber-rating-vote-button[data-vote-type="good"] {
    color: #4CAF50;
    border-color: #4CAF50;
}
.youtuber-rating-vote-button[data-vote-type="good"]:hover {
    background-color: #e8f5e9;
}

.youtuber-rating-vote-button[data-vote-type="bad"] {
    color: #F44336;
    border-color: #F44336;
}
.youtuber-rating-vote-button[data-vote-type="bad"]:hover {
    background-color: #ffebee;
}

.youtuber-rating-good-count,
.youtuber-rating-bad-count {
    font-weight: bold;
    margin-left: 5px;
}

.youtuber-single-rating {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #fff;
    border-radius: 5px;
    position: relative;
}

.youtuber-single-rating p strong {
    color: #333;
    font-size: 1.1em;
}

.youtuber-single-rating .rating-date {
    font-style: italic;
    font-size: 0.9em;
    color: #777;
}

.youtuber-single-rating .rating-comment-text {
    line-height: 1.6;
    margin-bottom: 10px;
    padding: 5px 0;
}

.youtuber-single-rating.child-rating {
    margin-left: 30px;
    border-left: 3px solid #ddd;
    padding-left: 15px;
    background-color: #f9f9f9;
    margin-top: 10px;
    border-radius: 0 5px 5px 0;
}

.reply-to-rating {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.reply-to-rating:hover {
    background-color: #005177;
}

.reply-rating-form-container {
    margin-top: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    background-color: #fdfdfd;
    border-radius: 5px;
}

.reply-rating-form-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #555;
}

/* =============================== */
/* Form Elements Common Styles     */
/* =============================== */
.youtuber-rating-form-container,
.sns-add-form-container {
    background-color: #f8f8f8;
    padding: 20px;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    margin-bottom: 30px;
}

#youtuber-rating-form label,
.sns-add-form-container label,
.youtuber-reply-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #444;
}

#youtuber-rating-form input[type="url"],
#youtuber-rating-form textarea,
#youtuber-rating-form select,
.sns-add-form-container input[type="url"],
.sns-add-form-container textarea,
.youtuber-reply-form textarea,
.edit-sns-url-form input[type="url"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

#youtuber-rating-form input[type="submit"],
.sns-add-form-container input[type="submit"],
.sns-actions button,
.edit-sns-url-form button,
.youtuber-reply-form input[type="submit"] {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    margin-right: 10px;
}

.button-primary {
    background-color: #0073aa;
    color: white;
}
.button-primary:hover {
    background-color: #005177;
}

.button-secondary {
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #ccc;
}
.button-secondary:hover {
    background-color: #d0d0d0;
}

.button-small {
    padding: 5px 10px;
    font-size: 0.8em;
}

.message-area {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-weight: bold;
    display: none;
    box-sizing: border-box;
}
.message-area.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}
.message-area.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}


/* =============================== */
/* Responsive Adjustments          */
/* =============================== */
@media (max-width: 768px) {
    .site-main {
        padding: 15px;
    }
    h1.entry-title {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.5em;
    }
    h3 {
        font-size: 1.3em;
    }
    h4 {
        font-size: 1.1em;
    }

    /* ★変更: モバイルでの概要コンテナの折り返し (元の状態を維持) */
    .youtuber-overview-container {
        flex-direction: column; /* 縦並びにする */
        align-items: center; /* 中央寄せ */
        gap: 15px;
    }
    .youtuber-thumbnail {
        width: 120px; /* モバイルでのサムネイルサイズ */
        height: 120px;
    }
    /* ★追加/変更: モバイルでの登録者数とコメントのコンテナ (元の状態を維持) */
    .youtuber-stats-and-latest-comment {
        align-items: center; /* 中央寄せ */
        text-align: center; /* テキストも中央寄せに */
        width: 100%; /* 親要素の幅いっぱいに */
    }
    /* ★追加/変更: モバイルでの登録者数表示 (元の状態を維持) */
    .youtuber-subscribers-display {
        text-align: center; /* 中央寄せ */
    }
    .latest-comment-area {
        max-width: 100%; /* 幅をいっぱいに使う */
        max-height: 120px; /* モバイルでのコメントエリアの高さ */
    }


    .youtuber-description-scroll {
        max-height: 150px;
        padding: 10px;
    }

    /* SNS関連のメディアクエリはsns-links.cssへ移動します */
    /* .social-links-list { ... } */
    /* .social-links-list li a i { ... } */
    /* .social-links-list .platform-name, .social-links-list .url-text { ... } */
    /* .social-links-overview-list { ... } */
    /* .social-links-overview-list li a i { ... } */

    .youtuber-thumbnail img {
        max-width: 100%;
    }
    .youtuber-single-rating {
        padding: 10px;
    }
    .youtuber-single-rating.child-rating {
        margin-left: 15px;
        padding-left: 10px;
    }
    .youtuber-rating-vote-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }
    .youtuber-rating-vote-button,
    .reply-to-rating {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    .sns-add-form-container input[type="url"],
    .sns-add-form-container textarea,
    .youtuber-reply-form textarea,
    .edit-sns-url-form input[type="url"] {
        padding: 8px;
        font-size: 0.9em;
    }
    .sns-add-form-container input[type="submit"],
    .sns-actions button,
    .edit-sns-url-form button,
    .youtuber-reply-form input[type="submit"] {
        padding: 8px 15px;
        font-size: 0.9em;
        margin-right: 8px;
    }
    .button-small {
        padding: 4px 8px;
        font-size: 0.75em;
    }
    .edit-sns-url-form {
        flex-direction: column;
        align-items: stretch;
    }
    .edit-sns-url-form input[type="url"] {
        width: auto;
        margin-bottom: 10px;
    }
    .edit-sns-url-form button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 5px;
    }
    .edit-sns-message {
        text-align: center;
    }
}

/* 最新コメントエリア内の広告を非表示にする */
.latest-comment-area iframe, /* latest-comment-area内のiframe要素全てを対象 */
.latest-comment-area ins.adsbygoogle /* Google AdSenseのinsタグを対象 */
{
    display: none !important; /* 強制的に非表示にする */
    width: 0 !important; /* 幅を0にする */
    height: 0 !important; /* 高さを0にする */
    overflow: hidden !important; /* はみ出しを隠す */
    margin: 0 !important; /* 余白をなくす */
    padding: 0 !important; /* パディングをなくす */
    border: none !important; /* 枠線をなくす */
    min-height: 0 !important; /* 最小高さを0にする */
}

/* 念のため、広告が親要素に影響を与えている可能性を考慮 */
.latest-comment-area {
    position: relative; /* 子要素のabsolute/fixed配置の基準とする */
    /* background-color: #fcfcfc; */ /* 前回の設定で指定済みのはずですが、念のため透明でない色に */
    /* z-index: 1; */ /* 必要に応じて、他の要素より手前に表示させる */
}

/* 登録者数表示のアイコン位置調整 */
.youtuber-subscribers-display .dashicons {
    vertical-align: middle; /* アイコンをテキストの中央に揃える */
    margin-right: 5px;      /* アイコンとテキストの間に少しスペースを空ける */
}

/* ★追加: 平均評価表示のスタイル */
.youtuber-average-rating-display {
    font-size: 1.2em; /* 登録者数と同じくらいのサイズに */
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0; /* 下に少し余白 */
    text-align: left; /* 左寄せ */
    width: 100%; /* 親要素の幅いっぱいに */
}

.youtuber-average-rating-display .dashicons-star-filled,
.youtuber-average-rating-display .dashicons-star-half, /* もし半星アイコンを使うなら */
.youtuber-average-rating-display .dashicons-star-empty {
    vertical-align: middle;
    margin-right: 3px; /* アイコンとテキストの間隔 */
    color: #FFD700; /* 星の色を金色に */
}

/* 半星の表示に絵文字「½」を使っている場合、特別なスタイルは不要ですが、
   もしDashiconsの半星アイコン（dashicons-star-half）を使いたい場合は
   そのアイコンをPHPコードで使用するように変更し、上記のCSSもそれに合わせて調整してください。
   現在のPHPコードでは絵文字を使っています。
*/