/* styles.css - Unified Version - Last Updated: 2024-08-29 */

/* 共通スタイル */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    transition: background-color 0.5s ease, color 0.5s ease;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
    border-bottom: 1px solid #ddd;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

/* テキスト選択を無効にする */
body, .modal-content, .modal-text {
    user-select: none; /* テキスト選択を無効化 */
    -webkit-user-select: none; /* Safari対応 */
    -moz-user-select: none; /* Firefox対応 */
    -ms-user-select: none; /* IE対応 */
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    width: auto;
    height: 40px;
}

.logo img {
    width: 40px;
    height: 40px;
    display: block;
}

.site-name {
    margin-left: 10px;
    font-weight: bold;
    color: #333;
}

body.dark-mode .site-name {
    color: #ffffff;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.nav-item {
    margin: 0 15px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: color 0.5s ease;
}

.nav-item:hover {
    color: #ff5252;
}

.search-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.search-box {
    width: 60%;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    transition: border-color 0.5s ease, background-color 0.5s ease, color 0.5s ease;
}

.search-box:focus {
    border-color: #ff5252;
}

.grid {
    margin: 20px auto;
    max-width: 100%;
    padding: 0 10px;
    display: block;
    position: relative; /* 必須 */
}

.grid-item {
    margin-bottom: 10px;
    width: 240px;
    display: inline-block;
    position: absolute; /* Masonryのために必要 */
    transition: box-shadow 0.5s ease;
}

.grid-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.5s ease;
}

.grid-item img:hover {
    transform: scale(1.05);
}

/* ダークモードのスタイル */
body.dark-mode {
    background-color: #121212;
    color: #ffffff;
}

body.dark-mode header {
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}

body.dark-mode .nav-item,
body.dark-mode .search-box {
    color: #ffffff;
}

body.dark-mode .search-box {
    background-color: #333;
    border-color: #555;
}

body.dark-mode .grid-item img {
    box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
}

/* モーダルウィンドウのスタイル */
.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.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 80%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    overflow: hidden;
}

/* ダークモード対応のモーダルウィンドウ */
body.dark-mode .modal-content {
    background-color: #333;
    color: #fff;
}

.modal-image {
    position: relative; /* ボタンの絶対配置に対応 */
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px 0 0 10px;
}

.modal-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 10px 0 0 10px;
}

.modal-text {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    max-height: 75vh;
    color: inherit;
}

/* タグのスタイル */
.modal-tag {
    background-color: #ff69b4;
    color: white;
    padding: 5px 10px;
    margin: 5px;
    border-radius: 15px;
    display: inline-block;
    white-space: nowrap;
}

/* ダークモード時のタグスタイル */
body.dark-mode .modal-tag {
    background-color: #ff69b4;
    color: white;
}

/* タグが枠から出た場合の改行設定 */
.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    overflow: hidden;
    visibility: visible;
}

/* スマホサイズ用のスタイル */
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        height: auto;
        width: 90%;
        max-height: 90%;
        overflow: hidden;
        margin: 5% auto;
        position: relative;
    }

    .modal-image {
        width: 100%;
        height: auto;
        border-radius: 10px 10px 0 0;
        flex: none;
        position: relative;
    }

    .modal-text {
        display: block;
        position: absolute;
        bottom: 0;
        width: 100%;
        padding: 20px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0)); /* グラデーションにより写真との境界線をなくす */
        color: white;
        border-radius: 0 0 10px 10px;
        box-sizing: border-box;
    }

    .modal-close {
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.6);
        color: white;
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1002;
    }

    .modal-close {
        top: 10px;
        right: 10px;
    }

    .modal-close:hover {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* トグルスイッチのコンテナ */
.theme-toggle {
    position: relative;
    width: 50px;
    height: 25px;
    background-color: #ccc; /* 初期の背景色 */
    border-radius: 15px; /* スイッチの形 */
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    padding: 2px;
    border: none; /* 枠をなしに */
    box-shadow: none; /* 影をなしに */
}

/* スライダー部分 */
.theme-toggle .slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    border: none; /* 枠をなしに */
    box-shadow: none; /* 影をなしに */
}

/* 太陽アイコン */
.theme-toggle .slider::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #FFD700; /* 太陽の色 */
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 -6px 0 -1px #FFD700, /* 上 */
        0 6px 0 -1px #FFD700,  /* 下 */
        6px 0 0 -1px #FFD700,  /* 右 */
        -6px 0 0 -1px #FFD700; /* 左 */
}

/* 月アイコン */
.theme-toggle.active {
    background-color: #333; /* 月用の背景色 */
}

.theme-toggle.active .slider {
    transform: translateX(25px); /* スライダーを右に動かす */
}

.theme-toggle.active .slider::before {
    background-color: #FFF; /* 月の色 */
    box-shadow: 
        -5px 0 0 0 #333; /* 月の影 */
}

/* 左矢印アイコン */
.nav-left {
    position: fixed; /* 絶対位置から固定位置に変更 */
    top: 50%;
    left: 5px; /* ウィンドウにさらに近づける */
    transform: translateY(-50%);
    width: 40px;
    height: 70px;
    background-color: rgba(255, 105, 180, 0.5);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1003;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.nav-left::before {
    content: '';
    border: solid white;
    border-width: 0 4px 4px 0;
    display: inline-block;
    padding: 10px;
    transform: rotate(135deg);
}

/* 右矢印アイコン */
.nav-right {
    position: fixed; /* 絶対位置から固定位置に変更 */
    top: 50%;
    right: 5px; /* ウィンドウにさらに近づける */
    transform: translateY(-50%);
    width: 40px;
    height: 70px;
    background-color: rgba(255, 105, 180, 0.5);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1003;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.nav-right::before {
    content: '';
    border: solid white;
    border-width: 0 4px 4px 0;
    display: inline-block;
    padding: 10px;
    transform: rotate(-45deg);
}

/* ホバー時のスタイルとアニメーション */
.nav-left:hover {
    background-color: #ff69b4; /* 濃いピンクに変更 */
    transform: translate(-5px, -50%); /* 左にスライドするアニメーション */
}

.nav-right:hover {
    background-color: #ff69b4; /* 濃いピンクに変更 */
    transform: translate(5px, -50%); /* 右にスライドするアニメーション */
}

/* クローズボタン */
.modal-close {
    position: absolute;
    top: 10px;
    left: 10px; /* 画像の左上に配置 */
    width: 40px;
    height: 40px;
    background-color: rgba(255, 105, 180, 0.2); /* さらに薄い半透明のピンク色 */
    border-radius: 50%; /* 円形にする */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1003;
    transition: background-color 0.3s ease, transform 0.3s ease;
    border: none; /* 白い枠を消すためにボーダーをなしに */
    box-shadow: none; /* 白い枠が影の場合も消す */
}

.modal-close::before {
    content: '✖'; /* 閉じるアイコン */
    font-size: 20px;
    color: rgba(255, 255, 255, 0.5); /* 薄い白色に設定 */
}

.modal-close:hover {
    background-color: #ff69b4; /* タグと同じ色 */
    transform: none; /* シンプルにするためアニメーションをなしに */
}