/* diary_page.css - diary.php 専用スタイルシート */

/* ===== 日記ページ固有のスタイル ===== */
/* diary.php の main content container */
.diary-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 10px;
    margin: 0 auto;
    /* background-color: rgba(0, 0, 0, 0.85); */
    /* 必要であれば有効に */
    border-radius: 8px;
    /* box-shadow: 0 0 25px rgba(255, 0, 0, 0.6); */
    /* 必要であれば有効に */
    box-sizing: border-box;
    width: 100%;
}

.diary-container h1 {
    color: #ffffff;
    text-align: center;
    margin: 0 auto;
    text-shadow: 0 0 12px #ff0000;
    font-family: 'Brush Script MT', cursive;
}

.diary-container h4 {
    color: #ffffff;
    text-align: center;
    margin: 0 auto;
    text-shadow: 0 0 12px #ff0101;
}

/* 検索フォームのスタイル */
.search-section {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    margin-top: 10px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.search-section label {
    color: #eee;
    font-weight: bold;
}

/* search-section の選択フィールドのスタイル (プルダウン) */
.search-section .search-select {
    padding: 10px 15px;
    border: 1px solid #ff0000;
    border-radius: 5px;
    background-color: #333;
    color: #eee;
    font-size: 1em;
    width: auto;
    min-width: 180px;
    box-sizing: border-box;
    max-width: 300px;
}

.search-section button,
.search-section .reset-button {
    padding: 8px 10px;
    border: none;
    border-radius: 5px;
    background-color: #ff0000;
    color: white;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.search-section button:hover,
.search-section .reset-button:hover {
    background-color: #cc0000;
    transform: translateY(-2px);
}

/* 日記グリッド表示 */
.diary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 3列表示 */
    gap: 20px;
    padding: 20px;
}

/* 各日記アイテム */
.diary-item {
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #444;
}

.diary-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.7);
}

/* 日記アイテム内のコンテンツコンテナ */
.diary-item-content {
    padding: 15px;
    padding-bottom: 0;
    color: #eee;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    justify-content: space-between;
    /* 要素を上下に広げる */
}

.diary-item-content h3 {
    margin-top: 0;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
    font-size: 1.2em;
    margin-bottom: 10px;
    text-align: center;
}

/* 日記本文の短縮表示スタイル */
.diary-short-content {
    font-size: 0.9em;
    color: #ccc;
    line-height: 1.6;
    flex-grow: 1;
    /* 残りのスペースを埋める */
    margin-bottom: 15px;
    text-align: center;
    max-height: calc(1.6em * 4);
    /* 4行分の高さ */
    overflow: hidden;
}

/* 日記本文内の画像コンテナ */
.diary-image-container {
    width: 100%;
    height: auto;
    max-height: 200px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #222;
    margin: 0 0 15px 0;
    border-radius: 5px;
}

.diary-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 投稿者と投稿日のメタ情報コンテナ */
.diary-meta-container {
    font-size: 0.85em;
    color: #bbb;
    margin-top: auto;
    /* 日記本文の長さに応じて下に配置 */
    margin-bottom: 5px;
    line-height: 1.6;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    /* padding: 0 10px; */
    /* このパディングが不要であればコメントアウト */
}

.diary-meta-container p {
    margin: 0;
    /* pタグのデフォルトマージンをリセット */
    /* padding: 5px 0; */
    /* これを削除または調整 */
}

/* 投稿者の上に区切り線 (点線) */
.diary-username-display {
    border-top: 1px dashed rgba(255, 0, 0, 0.5);
    /* 上の点線 */
    padding-top: 10px;
    /* 点線とテキストの間隔 */
    padding-bottom: 2px;
    /* 投稿者と投稿日の間の空白を減らす */
}

/* 投稿日の下に区切り線 (点線) */
.diary-createdat-display {
    /* border-bottom: 1px dashed rgba(255, 0, 0, 0.5); */
    /* 下の点線を削除 */
    /* padding-bottom: 10px; */
    /* パディングも削除 */
    padding-top: 2px;
    /* 投稿者と投稿日の間の空白を減らす */
}

/* 「続きを読む」に関連するスタイルは削除 */
/*
.read-more {
    color: #ffcc00;
    text-decoration: underline;
    font-size: 0.85em;
    text-align: right;
    display: block;
    cursor: pointer;
    margin-top: auto;
}
*/

.no-diaries {
    grid-column: 1 / -1;
    text-align: center;
    color: #aaa;
    font-size: 1.2em;
    padding: 50px;
}

/* モーダルウィンドウ */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: rgba(0, 0, 0, 0.555);
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    position: relative;
    color: #eee;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    max-width: 90%;
    height: auto;
    display: block;
    margin: 0 auto 20px;
    border-radius: 5px;
    border: 1px solid #444;
}

.modal-content h2 {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    margin-top: 0;
    font-size: 1.8em;
    margin-bottom: 15px;
    text-align: center;
}

/* モーダルの本文部分 (IDセレクタでより具体的に指定) */
.modal-content p#modalContent {
    font-size: 1em;
    line-height: 1.8;
    text-align: center;
    white-space: pre-wrap;
    margin-top: 10px;
    margin-bottom: 20px;
    /* メタ情報との間隔 */
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
    width: 100%;
    box-sizing: border-box;
}

/* モーダルウィンドウ内のメタ情報コンテナ */
.modal-meta-container {
    font-size: 0.9em;
    color: #bbb;
    margin-top: 20px;
    margin-bottom: 5px;
    line-height: 1.6;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    /* padding: 0 20px; */
}

.modal-meta-container p {
    margin: 0;
    /* pタグのデフォルトマージンをリセット */
    /* padding: 5px 0; */
}

/* 投稿者の上に区切り線 (モーダル用) */
.modal-username-display {
    border-top: 1px dashed rgba(255, 0, 0, 0.5);
    padding-top: 10px;
    padding-bottom: 2px;
}

/* 投稿日の下に区切り線 (モーダル用) */
.modal-createdat-display {
    /* border-bottom: 1px dashed rgba(255, 0, 0, 0.5); */
    /* 下の点線を削除 */
    /* padding-bottom: 10px; */
    /* パディングも削除 */
    padding-top: 2px;
}

/* スクロールバーのスタイル（任意） */
.modal-content p::-webkit-scrollbar {
    width: 8px;
}

.modal-content p::-webkit-scrollbar-track {
    background: #333;
    border-radius: 10px;
}

.modal-content p::-webkit-scrollbar-thumb {
    background: #ff0000;
    border-radius: 10px;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #ff0000;
    text-decoration: none;
}

/* ページネーションのスタイル */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    flex-wrap: wrap;
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.pagination .page-link {
    color: #ffffff;
    padding: 5px 5px 0 5px;
    text-decoration: none;
    border: 1px solid #ff0000;
    margin: 0 5px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.pagination .page-link:hover {
    background-color: #ff0000;
    color: #fff;
    border-color: #ff0000;
}

.pagination .page-link.active {
    background-color: #ff0000;
    color: white;
    border-color: #ff0000;
    cursor: default;
}

.pagination .page-link.active:hover {
    background-color: #cc0000;
}

/* ページネーションの省略記号 (...) */
.pagination-ellipsis {
    color: #bbb;
    padding: 8px 5px;
    /* ページリンクと揃えるためのパディング */
    margin: 0 5px;
    cursor: default;
    font-size: 0.9em;
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .diary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .search-section {
        padding: 15px;
        gap: 10px;
        width: 80%;
    }

    .search-form {
        flex-direction: column;
        align-items: center;
        width: 70%;
    }

    .search-section .search-select,
    .search-section button,
    .search-section .reset-button {
        width: 80%;
        max-width: 350px;
    }

    .diary-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .diary-item-content {
        min-height: 100px;
    }

    .modal-content {
        width: 70%;
        padding: 20px;
    }

    .modal-content img {
        max-width: 80%;
    }

    .modal-content h2 {
        font-size: 1.5em;
    }

    .close-button {
        font-size: 30px;
        top: 5px;
        right: 15px;
    }

    .pagination {
        margin-top: 20px;
        padding: 5px;
        max-width: 90%;
    }

    .pagination .page-link {
        padding: 6px 10px;
        margin: 0 3px;
        font-size: 0.9em;
        min-width: 30px;
    }

    .pagination-ellipsis {
        padding: 6px 3px;
        /* レスポンシブでも調整 */
        margin: 0 3px;
    }
}

@media (max-width: 480px) {

    /* .search-section .search-select,
    .search-section button,
    .search-section .reset-button {
        width: 95%;
    } */

    .modal-content {
        padding: 15px;
    }

    .modal-content h2 {
        font-size: 1.3em;
    }

    .modal-content p {
        font-size: 0.9em;
    }
}