/* ====================================
   RESET / BASE STYLES
   ==================================== */
:root {
    --color-primary: #003399;
    /* Euro Blue */
    --color-secondary: #FFCC00;
    /* Euro Gold */
    --color-text: #333;
    --color-background: #f8f8f8;
    --color-card-bg: #fff;
    --color-shadow: rgba(0, 0, 0, 0.1);
    --header-height-mobile: 130px;
    /* モバイル時のヘッダー全体の高さ */
    --header-height-desktop: 150px;
    /* デスクトップ時のヘッダー全体の高さ */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

/* ====================================
   HEADER & NAVIGATION
   ==================================== */

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #f8f8f8;
    color: var(--color-secondary);
    box-shadow: 0 2px 5px var(--color-shadow);

}

.header-link-wrapper {
    text-decoration: none;
    /* 🚨 リンクの下線を非表示にする */
    color: inherit;
    /* テキストの色を親要素から継承 */
    cursor: pointer;
    /* クリック可能であることを示すカーソル */

    /* 🚨 flexコンテナのサイズを<a>タグに適用 */
    display: inline-flex;
    align-items: center;
}

.header-link-wrapper h1#site-title {
    color: var(--color-primary);
    /* 翻訳されたタイトルが正しい色で表示されるように */
    margin-left: 10px;
    /* ロゴとタイトルの間にスペースを設ける (必要に応じて調整) */
}

#header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 100px;
    /* max-width: 1200px; */
    margin: 0 auto;
    border-bottom: 2px solid var(--color-primary);
}

#header-logo {
    height: 30px;
    margin-right: 10px;
    display: block;
}

.site-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
    font-style: italic;
}

/* 言語ナビゲーション */
#lang-nav {
    list-style: none;
    display: flex;
    gap: 10px;
}

#lang-nav li {
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 5px;
    transition: background-color 0.2s;
    color: var(--color-primary);
}

#lang-nav li.active {
    background-color: var(--color-primary);
    color: #fff;
}

/* TOP BAR (検索・フィルタリング) */
.top-bar {
    background: #fff;
    padding: 10px 1rem;
    border-top: 1px solid #eee;
    /* 💡 修正点2: モバイルでは幅を最大にする */
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    margin-bottom: 10px;
    width: 100%;
    /* 💡 修正点2: 検索バーもモバイルで最大幅に */
}


.search-icon {
    cursor: pointer;
    padding: 0 10px;
    color: #999;
}

#searchInput {
    flex-grow: 1;
    border: none;
    padding: 8px 10px;
    font-size: 1rem;
    outline: none;
}

#clearSearch {
    background: none;
    border: none;
    color: #999;
    font-size: 1rem;
    padding: 8px 10px;
    cursor: pointer;
    transition: color 0.2s;
}

#clearSearch:hover {
    color: var(--color-primary);
}

/* style.css に以下のスタイルを追加 */

#scrollToTopBtn {
    /* 画面右下に固定配置 */
    position: fixed;
    bottom: 20px;
    /* 下端からの距離 */
    right: 20px;
    /* 右端からの距離 */

    /* デザイン */
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    /* 円形にする */
    width: 50px;
    height: 50px;
    font-size: 24px;
    line-height: 50px;
    /* 垂直方向の中央揃え用 */
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    /* 🚨 初期状態では非表示 */
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    /* 他の要素の上に表示 */
}

/* ボタンが表示されるときのクラス */
#scrollToTopBtn.show {
    opacity: 1;
    visibility: visible;
}

#scrollToTopBtn:hover {
    background-color: #0056b3;
}

/* カテゴリーフィルターとビュー切り替え */
#category-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 10px;
}

.filter-label {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.9rem;
}

.filter-btn {
    background: #eee;
    color: var(--color-text);
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s, color 0.2s;
}

.filter-btn:hover {
    background: #ddd;
}

.filter-btn.active {
    background: var(--color-primary);
    color: #fff;
}

.view-switcher {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

.view-switcher button {
    background: #eee;
    color: var(--color-text);
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
}

.view-switcher button.active {
    background: var(--color-primary);
    color: #fff;
}


/* ====================================
   MAIN CONTENT
   ==================================== */

/* 💡 修正点3: 固定ヘッダーの高さ分、コンテンツにパディングを追加 */
main {
    width: 100%;
    padding-top: var(--header-height-mobile);
    /* モバイル時のヘッダーの高さ */
    max-width: none;
    margin: 0;
    box-sizing: border-box;
}

.intro-section {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fff;
    border-bottom: 1px solid #eee;
    margin: 110px 10px 10px 10px;
    border-radius: 10px;
    box-shadow: 1px 1px 4px gray;

}

/* ====================================
   CARD STYLES (GRID & LIST)
   ==================================== */

.cards {
    padding-bottom: 2rem;
    width: 100%;
}

/* GRID VIEW */
.cards.grid-view {
    display: grid;
    /* grid-template-columns: 1fr; */
    grid-template-columns: repeat(auto-fill, 350px);
    /* Mobile Base */
    gap: 1.5rem;
    padding: 0 20px;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 20px auto;
}

.card {
    width: 100%;
    background: var(--color-card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--color-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.card img {
    margin: 40px 10px;
    width: 280px;
    height: 200px;
    object-fit: cover;
    /* 💡 修正点1: 壊れアイコンがあっても画像領域を確保し、ALTテキストが画像領域外に出ないようにする */
    display: block;
    border-bottom: 1px solid #eee;
}

.card .category-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--color-secondary);
    color: var(--color-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 10;
}

.card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h2 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--color-primary);
}

.card-content .description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.card-text-area {
    flex-grow: 1;
}

.details {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    gap: 10px;
}

.details button,
.details a {
    padding: 8px 15px;
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    flex: 1;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.details-btn {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.contact-btn {
    background: #fff;
    color: var(--color-primary);
}


/* LIST VIEW */
.cards.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 1rem;
}

.cards.list-view .card {
    flex-direction: row;
    align-items: stretch;
    padding: 10px;
    gap: 15px;
}

.cards.list-view .card img {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 4px;
}

.cards.list-view .card .category-label {
    position: static;
    align-self: flex-start;
    margin-bottom: 5px;
    padding: 2px 6px;
    font-size: 0.7rem;
    display: block;
}

.cards.list-view .card-content {
    padding: 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.cards.list-view .card-text-area {
    flex-grow: 1;
    margin-right: 15px;
}

.cards.list-view .card-text-area h2 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.cards.list-view .card-text-area .description {
    display: none;
}

.cards.list-view .details {
    width: 200px;
    flex-shrink: 0;
    gap: 5px;
}

/* ====================================
   MODAL (変更なし)
   ==================================== */

.modal {
    /* ... (前回のCSSと同じ) ... */
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    top: 120px;
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#modal-img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    margin-bottom: 15px;
    border-radius: 4px;
}

#modal-title {
    color: var(--color-primary);
    margin-bottom: 10px;
}

/* ------------------------------------------- */
/* ホームページボタンの修飾 */
/* ------------------------------------------- */

/* ボタンを中央寄せにしたり、モーダル下部にマージンを取ったりするためのコンテナ */
.modal-actions {
    text-align: center;
    margin-top: 25px;
    padding: 10px 0;
}

/* <a>タグをボタンとしてデザイン */
.homepage-btn {
    display: inline-block;
    /* ボタンとして機能させるため */
    padding: 10px 30px;
    background-color: var(--color-primary);
    /* 青色 (例) */
    color: white;
    text-decoration: none;
    /* 下線を削除 */
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

/* ホバー時の効果 */
.homepage-btn:hover {
    background-color: #0056b3;
}

/* ------------------------------------------- */
/* クーポン番号の修飾 */
/* ------------------------------------------- */

/* クーポンエリアの全体的な調整 */
.coupon-area {
    margin-top: 20px;
    padding: 15px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* クーポン番号本体（<code>タグ）の修飾 */
#coupon-code-display {
    display: inline-block;
    font-size: 1.2em;
    font-weight: bold;
    color: #d9534f;
    /* 赤色 (強調) */
    background-color: #fff;
    padding: 5px 10px;
    border: 1px solid #d9534f;
    border-radius: 4px;
    user-select: all;
    /* クリックで簡単に選択できるように */
}

/* クーポンラベルの調整 */
.coupon-area p {
    margin-bottom: 5px;
}

/* クーポンサービスの説明文 */
.coupon-service-desc {
    font-size: 1em;
    color: #333;
    /* 説明文の色 */
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dotted #ccc;
    /* 区切り線 */
}


/* ====================================
   FOOTER (変更なし)
   ==================================== */

.footer-container {
    display: flex;
    flex-wrap: wrap;
    /* モバイルで折り返すように設定 */
    justify-content: space-between;
    padding: 30px 20px;
    max-width: 100%;
    margin: 0 auto;
    border-top: 1px solid #ddd;
    background-color: #333333;
}

.footer-section {
    flex: 1 1 200px;
    /* 最小幅200pxで伸縮 */
    margin: 15px 10px;
}

.footer-section h4 {
    border-bottom: 2px solid #007bff;
    /* タイトルにアクセント */
    padding-bottom: 5px;
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #fff;
}

.contact-info address p {
    margin: 5px 0;
    line-height: 1.5;
    font-style: normal;
    color: #fff;
    /* addressのデフォルト斜体を解除 */
}

.contact-info address p a {
    margin: 5px 0;
    line-height: 1.5;
    font-style: normal;
    color: #fff;
    /* addressのデフォルト斜体を解除 */
}

.legal-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #fff;
}

.legal-links ul li a {
    display: block;
    padding: 5px 0;
    color: #fff;
    /* リンクの色 */
    text-decoration: none;
}

.legal-links ul li a:hover {
    color: #007bff;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .footer-container {
        flex-direction: column;
        /* 縦に積み重ねる */
        padding: 20px 15px;
    }

    .footer-section {
        flex: 1 1 100%;
        margin: 10px 0;
    }
}

.footer-bottom {
    text-align: center;
    padding: 10px 0;
    background-color: #333333;
    font-size: 0.8em;
    color: #fff;
    border-top: 1px solid #e0e0e0;
}

/* ページネーション */
.pagination-top {
    text-align: center;
    margin: 20px 0;
    padding: 10px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.pagination-list {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-item {
    margin: 0 4px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.95em;
    user-select: none;
    /* テキスト選択を防止 */
}

.page-item:hover:not(.active) {
    background-color: #e9e9e9;
    border-color: #aaa;
}

.page-item.active {
    background-color: var(--color-primary);
    /* アクティブなページの色 */
    color: white;
    border-color: var(--color-primary);
    cursor: pointer;
    font-weight: bold;
}


/* ====================================
   MEDIA QUERIES (Desktop Overrides: min-width: 601px)
   ==================================== */
@media (min-width: 601px) {

    #header-logo {
        display: block;
        height: 70px;
    }

    .site-title {
        font-size: 2.5rem;
    }

    /* 修正点2: 検索バーの幅を固定し、全体のトップバーはコンテンツ幅に */
    .top-bar {
        display: flex;
        justify-content: space-between;
        /* max-width: 1200px; */
        margin: 0 auto;
        padding-top: 10px;
        padding-bottom: 10px;
        width: auto;
        /* コンテンツ幅に合わせる */
    }

    .search-bar {
        margin-bottom: 0;
        width: 300px;
        /* デスクトップでは固定幅 */
    }

    #category-filter {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 15px;
        flex-grow: 1;
        padding-left: 20px;
    }

    /* 💡 修正点3: PC時のヘッダーの高さに合わせてコンテンツパディングを調整 */
    main {
        padding-top: var(--header-height-desktop);
    }

    /* 💡 修正点4: ブラウザ幅に応じた柔軟な列数調整 */
    .cards.grid-view {
        /* 最小サイズ280px。ブラウザ幅に応じて2列、3列、4列と自動で調整される */
        grid-template-columns: repeat(auto-fit, minmax(300px, 300px));
        justify-content: center;
    }

    /* LIST VIEW: デスクトップでのレイアウト調整 (変更なし) */
    .cards.list-view .card {
        height: 120px;
    }

    .cards.list-view .details {
        width: 250px;
    }

    .cards.list-view .card-text-area .description {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* 768px以上のタブレットでの調整例（オプション） */
@media (min-width: 768px) {

    #otem-container.list-view {
        min-height: calc(100vh - 200px);
    }

    /* デフォルトの表示（list-viewクラスがない状態）に min-height を適用 */
    #item-container:not(.list-view) {
        min-height: calc(100vh - 200px);
    }

    #item-container:not(.list-view) .card {
        height: 450px;
        /* 🚨 例: カードの高さを固定値に設定 */
        /* または */
        min-height: 350px;

        /* 必要に応じて、コンテンツが溢れた場合の処理を設定 */
        overflow: hidden;
    }

    #item-container.list-view {
        /* カードが見つからない時やカード数が少ない時でも高さを維持 */
        min-height: calc(100vh - 200px);
    }

    #item-container.list-view .card {
        display: flex;
        /* Flexboxを有効化 */
        align-items: center;
        /* 🚨 垂直方向の中央揃え */
        gap: 20px;
        padding: 10px 20px;
        height: 100px;
        /* 例: 高さの固定（必要に応じて調整） */
    }

    #item-container.list-view .card .category-label {
        min-width: 70px;
        white-space: nowrap;
        text-align: center;
    }

    /* 🚨 サムネイル画像（img）のマージンをリセット */
    #item-container.list-view .card img {
        /* グリッドビューのときに設定されていた可能性のあるマージン（40px）を解除 */
        margin: 0 !important;

        /* 画像のサイズ設定 */
        width: 80px;
        height: 80px;
        object-fit: cover;
        flex-shrink: 0;
        /* 縮小させない */
    }

    #item-container.no-results-active {
        /* 画面の高さから、ヘッダーとフッターの高さを引いた残りを確保 */
        min-height: calc(100vh - 200px);

        /* メッセージを中央に配置するためのレイアウト設定 */
        display: flex;
        justify-content: start;
        align-items: center;
        text-align: center;
        flex-direction: column;
        padding: 30px 20px;
    }

    .no-results-message {
        font-size: 1.2em;
        color: #cc5555;
        padding: 20px;
        border: 1px solid #ddd;
        border-radius: 8px;
        background-color: #fff0f0;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    /* カードのテキストコンテンツエリア */
    #item-container.list-view .card-content {
        flex-grow: 1;
        /* 残りのスペースを全て占有 */
    }


    .cards.grid-view {
        /* 768px以上で最小幅を300pxにすると、よりゆったり表示される */
        grid-template-columns: repeat(auto-fit, minmax(300px, 300px));
        justify-content: start;

        .cards.grid-view {
            padding: 0 50px;
        }
    }

    .intro-section {
        margin: 30px 50px 0 50px;
        box-shadow: 2px 2px 4px gray;
    }

    .search-bar {
        margin-bottom: 0;
        width: 500px;
        outline: 1px solid var(--color-primary);
        border-radius: 30px;
        /* デスクトップでは固定幅 */
    }
}