/* ===================================
   コジコジ02 共通スタイル
   =================================== */

/* 共通設定 */
#cojicoji02-wrapper,
#cojicoji02-detail-wrapper {
    width: 100%;
    min-height: 100vh;
    padding-top: 120px; /* ヘッダーとの距離 */
    padding-bottom: 120px; /* フッターとの距離 */
}

/* ===================================
   トップページ スタイル
   =================================== */

.cojicoji02-top {
    background-color: #e9f0c4;
    padding: 40px 20px;
}

/* トップ画像 */
.top-image-wrapper {
    text-align: center;
    margin-bottom: 60px;
}

.top-main-image {
    max-width: 1000px;
    width: 100%;
    height: auto;
    border-radius: 32px;
}

/* 地域選択セクション */
.region-selection-wrapper {
    max-width: 1000px;
    margin: 0 auto 60px;
    display: flex;
    align-items: flex-start;
    gap: 80px;
}

/* 左側エリア（地域から探す + 発売予定日） */
.region-left-wrapper {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 30px; /* 🔧 PC版: 「地域から探す」と「発売予定日」の間隔 */
}

.region-title-wrapper {
    flex-shrink: 0;
}

.region-title-image {
    width: 300px;
    height: auto;
}

/* 発売予定日画像エリア */
.release-date-wrapper {
    width: 100%;
}

.release-date-image {
    width: 300px; /* 🔧 PC版: 発売予定日画像の横幅（300px / 250px / 350px など） */
    height: auto;
    display: block;
}

/* 右側のコンテンツエリア（ボタン） */
.region-content-wrapper {
    flex: 1;
}

.region-buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}

/* 地域ボタン */
.region-button {
    background-color: #ffffff;
    color: #333333;
    border: none;
    border-radius: 32px;
    padding: 5px 20px;
    font-size: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 0 0 calc(30% - 10px);
    min-width: 120px;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.region-button:hover {
    background-color: #1cb9ee;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.region-button.active {
    background-color: #1cb9ee;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(28, 185, 238, 0.3);
}

/* 商品一覧エリア */
.product-list-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.product-item {
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.product-link {
    display: block;
    text-decoration: none;
}

.product-image {
    width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   詳細ページ スタイル
   =================================== */

.cojicoji02-detail {
    background-color: #ffffff;
    padding: 0;
}

/* 詳細トップ画像 */
.detail-top-image-wrapper {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.detail-top-image {
    width: 100%;
    height: auto;
    display: block;
}

/* 商品セクション */
.product-section {
    max-width: 1200px;
    margin: 0 auto 80px;
    padding: 0 20px;
}

.product-title-wrapper {
    margin-bottom: 30px;
    text-align: center;
}

.product-title-image {
    width: 100%;
    max-width: 1100px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.product-content {
    display: flex;
    gap: 20px;
}

/* 商品画像1（左側・大きめ） */
.product-main-image-wrapper {
    flex: 0 0 35%;
}

.product-main-image {
    width: 100%;
    height: auto;
    border-radius: 32px;
    border: 2px solid #cccccc;
}

/* 商品画像2・3（中央・縦2段） */
.product-detail-images {
    flex: 0 0 16%;
    display: flex;
    flex-direction: column;
    gap: 33px;
}

.product-detail-image {
    width: 100%;
    height: auto;
    border-radius: 32px;
    border: 2px solid #cccccc;
}

/* 説明テキスト（右側） */
.product-description {
    flex: 1;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-sizing: border-box;
}

.product-text {
    font-size: 12px;
    line-height: 1;
    color: #333333;
    white-space: pre-line;
}

/* エラーメッセージ */
.error-message,
.no-products {
    max-width: 600px;
    margin: 100px auto;
    padding: 40px;
    text-align: center;
    background-color: #f8f8f8;
    border-radius: 8px;
}

.error-message p,
.no-products p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.6;
}

.error-message a,
.no-products a {
    color: #1cb9ee;
    text-decoration: underline;
}

/* ===================================
   画像拡大モーダル
   =================================== */

/* モーダル背景 */
.image-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    cursor: default; /* ギャラリーモードではカーソルをデフォルトに */
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease, background-color 0.3s ease;
}

/* モーダル表示時 */
.image-modal.active {
    visibility: visible;
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.9);
    transition: visibility 0s 0s, opacity 0.3s ease, background-color 0.3s ease;
}

/* 画像コンテナ */
.image-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 拡大画像 */
.image-modal img {
    min-width: 600px;
    max-width: 1200px;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s ease;
    user-select: none; /* 画像の選択を無効化 */
}

/* 画像表示時のアニメーション */
.image-modal.active img {
    opacity: 1;
    transform: scale(1);
}

/* 閉じるボタン */
.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease;
    user-select: none;
}

.image-modal.active .image-modal-close {
    opacity: 1;
}

.image-modal-close:hover {
    color: #cccccc;
}

/* 左右の矢印ボタン */
.image-modal-prev,
.image-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease, background-color 0.3s ease;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px 15px;
    border-radius: 8px;
}

.image-modal.active .image-modal-prev,
.image-modal.active .image-modal-next {
    opacity: 0.7;
}

.image-modal-prev:hover,
.image-modal-next:hover {
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.8);
}

.image-modal-prev {
    left: 20px;
}

.image-modal-next {
    right: 20px;
}

/* 画像インジケーター */
.image-modal-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.4s ease;
    user-select: none;
}

.image-modal.active .image-modal-indicator {
    opacity: 1;
}

/* クリック可能な画像のカーソル */
.product-main-image,
.product-detail-image {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.product-main-image:hover,
.product-detail-image:hover {
    opacity: 0.8;
}

/* ===================================
   レスポンシブ対応
   =================================== */

/* タブレット（768px - 1023px） */
@media (max-width: 1023px) {
    /* ヘッダー余白調整 */
    #cojicoji02-wrapper,
    #cojicoji02-detail-wrapper {
        padding-top: 80px;
    }
    
    /* トップページ - 地域選択 */
    .region-selection-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    /* 左側エリア（タブレットでは上部に縦並び） */
    .region-left-wrapper {
        gap: 20px; /* タブレット版: 「地域から探す」と「発売予定日」の間隔 */
        align-items: center; /* 中央揃え */
    }
    
    .region-title-image {
        width: 180px;
    }
    
    .release-date-image {
        width: 180px; /* タブレット版: 発売予定日画像の横幅 */
    }
    
    .region-content-wrapper {
        width: 100%;
    }
    
    .region-buttons-wrapper {
        justify-content: center;
    }
    
    .region-button {
        flex: 0 0 calc(50% - 7.5px);
    }
    
    /* トップページ - 商品一覧 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* 詳細ページ - 商品コンテンツ */
    .product-content {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .product-main-image-wrapper {
        flex: 0 0 100%;
    }
    
    .product-detail-images {
        flex: 0 0 100%;
        flex-direction: row;
        gap: 20px;
    }
    
    .product-detail-image {
        width: calc(50% - 10px);
    }
    
    .product-description {
        flex: 0 0 100%;
    }
}

/* ===================================
   スマートフォン（767px以下）
   🔧 ここから下がスマホ版の調整箇所です
   =================================== */
@media (max-width: 767px) {
    /* ヘッダー余白調整 */
    #cojicoji02-wrapper,
    #cojicoji02-detail-wrapper {
        padding-top: 80px; /* 🔧 調整可能: ヘッダーとの距離 */
        padding-bottom: 120px; /* 🔧 調整可能: フッターとの距離 */
    }
    
    /* ===== トップページ ===== */
    
    .cojicoji02-top {
        padding: 20px 0; /* 🔧 左右の余白を0に（上下のみ余白を残す） */
    }
    
    /* 📱 トップ画像の調整 */
    .top-image-wrapper {
        margin-bottom: 30px; /* 🔧 画像下の余白 */
        padding: 0; /* 🔧 左右の余白を0に（隙間なし） */
        text-align: center; /* 🔧 位置: center(中央) / left(左) / right(右) */
    }
    
    .top-main-image {
        max-width: 100%; /* 🔧 画像の横幅: 100%（画面いっぱい） / 90% / 80% など */
        width: 100%; /* 画面幅に対する比率 */
        border-radius: 0; /* 🔧 スマホでは角丸を無効化（画面いっぱいに表示） */
    }
    
    /* 📱 「地域から探す」画像の調整 */
    .region-selection-wrapper {
        margin-bottom: 30px; /* 🔧 セクション下の余白 */
        gap: 20px; /* 🔧 左側エリアとボタンの間隔 */
        padding: 0; /* 🔧 左右の余白を0に（隙間なし） */
        flex-direction: column; /* 縦並び */
        align-items: center; /* 中央揃え */
    }
    
    /* 📱 左側エリア（地域から探す + 発売予定日） */
    .region-left-wrapper {
        gap: 20px; /* 🔧 スマホ版: 「地域から探す」と「発売予定日」の間隔 */
        align-items: center; /* 中央揃え */
    }
    
    .region-title-wrapper {
        text-align: center; /* 🔧 位置: center(中央) / left(左) / right(右) */
    }
    
    .region-title-image {
        width: 150px; /* 🔧 画像の横幅: 150px / 180px / 200px など */
        max-width: 100%; /* 画面からはみ出さないように制限 */
    }
    
    /* 📱 発売予定日画像 */
    .release-date-wrapper {
        text-align: center; /* 🔧 位置: center(中央) / left(左) / right(右) */
    }
    
    .release-date-image {
        width: 150px; /* 🔧 スマホ版: 発売予定日画像の横幅（150px / 200px / 250px など） */
        max-width: 90%; /* 画面からはみ出さないように制限 */
    }
    
    /* 📱 右側コンテンツエリア */
    .region-content-wrapper {
        width: 100%;
    }
    
    /* 📱 地域ボタンの調整 */
    .region-buttons-wrapper {
        gap: 10px; /* 🔧 ボタン間の余白 */
        justify-content: center; /* ボタンの配置 */
        padding: 0 10px; /* 🔧 ボタンエリアのみ左右に少し余白（ボタンが端にくっつかないように） */
    }
    
    .region-button {
        /* 🔧 一行に表示するボタン数の調整 */
        /* 1列表示: flex: 0 0 100%; */
        /* 2列表示: flex: 0 0 calc(50% - 5px); */
        /* 3列表示: flex: 0 0 calc(33.333% - 7px); */
        flex: 0 0 calc(50% - 5px); /* 現在: 2列表示 */
        
        /* 🔧 ボタン自体の横幅を固定したい場合 */
        /* width: 150px; */ /* コメントを外して数値を調整 */
        /* flex: 0 0 auto; */ /* 上のflexをこれに変更 */
        
        font-size: 16px; /* 🔧 ボタンの文字サイズ */
        padding: 10px 20px; /* 🔧 ボタンの内側余白（上下 左右） */
    }
    
    /* 📱 商品一覧の調整 */
    .product-list-wrapper {
        padding: 20px 10px; /* 🔧 一覧エリア全体の余白（上下 左右） */
        /* 左右の余白を無くす場合: padding: 20px 0; */
    }
    
    .product-grid {
        /* 🔧 一行に表示する商品画像数の調整 */
        /* 1列表示: grid-template-columns: 1fr; */
        /* 2列表示: grid-template-columns: repeat(2, 1fr); */
        /* 3列表示: grid-template-columns: repeat(3, 1fr); */
        grid-template-columns: 1fr; /* 現在: 1列表示 */
        
        gap: 15px; /* 🔧 商品間の余白 */
        padding: 0 10px; /* 🔧 グリッド自体に余白を追加（商品が端にくっつかないように） */
    }
    
    .product-item {
        /* 🔧 商品画像の横幅を制限（中央揃えのまま） */
        max-width: 350px; /* 画像の最大幅（例: 300px / 350px / 400px など） */
        margin: 0 auto; /* 中央揃え */
    }
    
    /* ===== 詳細ページ ===== */
    
    /* 📱 詳細トップ画像の調整 */
    .detail-top-image-wrapper {
        margin-bottom: 40px; /* 🔧 画像下の余白 */
        padding: 0; /* 🔧 左右の余白（0=画面いっぱい） */
    }
    
    .detail-top-image {
        width: 100%; /* 🔧 横幅: 100%(画面いっぱい) / 90% / 80% など */
        /* 位置調整したい場合は .detail-top-image-wrapper に text-align を追加 */
    }
    
    /* 📱 商品セクション全体 */
    .product-section {
        margin-bottom: 40px; /* 🔧 商品セクション間の余白 */
        padding: 0 10px; /* 🔧 セクションの左右余白 */
    }
    
    /* 📱 商品タイトル画像の調整 */
    .product-title-wrapper {
        margin-bottom: 20px; /* 🔧 タイトル下の余白 */
        text-align: center; /* 🔧 位置: center(中央) / left(左) / right(右) */
        padding: 0 10px; /* 🔧 タイトル画像の左右余白 */
    }
    
    .product-title-image {
        max-width: 100%; /* 🔧 横幅: 100%(最大幅) / 90% / 80% など */
        width: 100%; /* 画面幅に対する比率 */
    }
    
    /* 📱 商品コンテンツ */
    .product-content {
        flex-wrap: wrap;
        gap: 15px; /* 🔧 画像・テキスト間の余白 */
    }
    
    /* 📱 商品画像1（メイン画像）の調整 */
    .product-main-image-wrapper {
        flex: 0 0 100%; /* 横幅100%固定 */
        text-align: center; /* 🔧 位置: center(中央) / left(左) / right(右) */
    }
    
    .product-main-image {
        max-width: 88%; /* 🔧 横幅: 100%(最大) / 90% / 80% / 350px など */
        width: 100%; /* 画面幅に対する比率 */
        border-radius: 16px; /* 🔧 角丸のサイズ（0で角丸なし） */
    }
    
    /* 📱 商品画像2・3（詳細画像）の調整 */
    .product-detail-images {
        flex: 0 0 100%;
        flex-direction: row;
        gap: 15px; /* 🔧 画像2枚の間隔 */
        justify-content: center; /* 🔧 位置: center(中央) / flex-start(左) / flex-end(右) */
    }
    
    .product-image-wrapper {
        flex: 0 0 calc(50% - 7.5px); /* 2枚を均等に配置 */
        max-width: 200px; /* 🔧 各画像の最大横幅（例: 150px / 200px / 250px など） */
        /* 画像サイズを小さくしたい場合は max-width の数値を小さく */
    }
    
    .product-detail-image {
        width: 100%; /* 親要素に合わせる */
        border-radius: 16px; /* 🔧 角丸のサイズ（0で角丸なし） */
    }
    
    /* 📱 説明テキストの調整 */
    .product-description {
        flex: 0 0 100%;
        padding: 15px; /* 🔧 テキストエリアの内側余白 */
    }
    
    .product-text {
        font-size: 14px; /* 🔧 テキストサイズ（12px / 14px / 16px など） */
        line-height: 1; /* 🔧 行間の縦幅（1.5 / 1.6 / 1.8 / 2.0 など） */
    }
    
    /* 📱 画像拡大モーダル（スマホ版） */
    .image-modal img {
        min-width: 150px;  /* スマホでは最低200px */
        max-width: 95%;
        max-height: 95vh;
    }
}

/* ===================================
   極小スマートフォン（480px以下）
   🔧 さらに小さい画面用の調整箇所
   =================================== */
@media (max-width: 480px) {
    .region-title-image {
        width: 120px; /* 🔧 調整可能: さらに小さいタイトル画像 */
    }
    
    .region-button {
        font-size: 14px; /* 🔧 調整可能: さらに小さいボタン文字 */
        padding: 8px 16px; /* 🔧 調整可能: さらに小さいボタン余白 */
    }
}