/* ============================
   ページ全体の中央寄せ
============================ */
.products-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* タイトル */
.products-page h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: #202124;
}

/* ============================
   検索フォーム（一般向け・直感UI）
============================ */
.search-filter-box {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 24px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* フォーム全体は縦方向に積む */
.search-filter-box form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 1段目：キーワード検索バー */
.search-row {
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 12px; /* ← 999px → 12px に変更 */
    padding-left: 40px;
    height: 48px; /* ← 高さを固定して安定させる */
    box-sizing: border-box;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 1rem;
    outline: none;
    background: transparent;
}

.search-input-wrapper::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    font-size: 1.1rem;
}

/* 2段目：カテゴリ / メーカー / 製造年 / 状態 / 価格帯 / 在庫スイッチ / 検索ボタン */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-row select {
    flex: 1 1 180px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    font-size: 0.95rem;
    background: #fff;
}

/* 在庫ありスイッチ */
.stock-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #dadce0;
    background: #f8f9fa;
    font-size: 0.9rem;
    white-space: nowrap;
}

.stock-switch input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* 検索ボタン */
.filter-row button[type="submit"] {
    flex: 0 0 auto;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    background: #1a73e8;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(26,115,232,0.4);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.filter-row button[type="submit"]:hover {
    background: #1664c4;
    box-shadow: 0 2px 6px rgba(26,115,232,0.5);
    transform: translateY(-1px);
}

/* スマホ最適化 */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-row select,
    .filter-row button[type="submit"],
    .stock-switch {
        flex: 1 1 100%;
    }

    .search-filter-box {
        padding: 16px;
    }
}

/* ============================
   商品一覧のグリッド
============================ */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
}

/* ============================
   商品カード（Material風）
============================ */
.product-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    text-align: center;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* 商品画像 */
.product-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

/* 商品名 */
.product-card h3 {
    font-size: 1.2rem;
    margin: 16px 16px 8px;
    font-weight: 600;
    color: #202124;
}

/* 説明文 */
.product-card p {
    font-size: 0.95rem;
    color: #5f6368;
    margin: 0 16px 12px;
    line-height: 1.6;
}

/* 価格 */
.product-card .price {
    font-size: 1.4rem;
    font-weight: bold;
    color: #0f9d58;
    margin: 0 16px 20px;
}

/* ============================
   画像モーダル（拡大表示）
============================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    animation: zoomIn 0.25s ease;
    cursor: grab;
    transition: transform 0.1s ease-out;
}

.modal img:active {
    cursor: grabbing;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    z-index: 2100;
}

/* ============================
   ページネーション（Material風）
============================ */
.pagination {
    margin: 40px auto;
    text-align: center;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px;
}

.pagination a,
.pagination button {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 90px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f1f3f4;
    color: #202124;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #dadce0;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.pagination a:hover,
.pagination button:hover {
    background: #e8f0fe;
    box-shadow: 0 1px 3px rgba(60,64,67,0.3);
}

.pagination a.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
    box-shadow: 0 2px 6px rgba(26,115,232,0.4);
}

/* スマホ最適化（ページネーション） */
@media (max-width: 480px) {
    .pagination a,
    .pagination button {
        padding: 8px 6px;
        font-size: 0.8rem;
        max-width: 70px;
    }

    .pagination {
        gap: 4px;
    }
}

/* ============================
   ページネーションモーダル
============================ */
.pagination-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.pagination-modal.show {
    display: flex;
}

.pagination-modal-content {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: fadeInScale 0.25s ease;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.pagination-modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.pagination-modal-header input {
    width: 120px;
    padding: 8px;
    text-align: center;
    border: 1px solid #dadce0;
    border-radius: 6px;
}

.pagination-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.pagination-grid a {
    display: block;
    padding: 8px;
    background: #f1f3f4;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    color: #202124;
    border: 1px solid #dadce0;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.pagination-grid a:hover {
    background: #e8f0fe;
    box-shadow: 0 1px 3px rgba(60,64,67,0.3);
}

.active-page {
    background: #1a73e8 !important;
    color: #fff !important;
    border-color: #1a73e8 !important;
    box-shadow: 0 2px 6px rgba(26,115,232,0.4);
}

.pagination-modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.pagination-modal-footer button {
    flex: 1;
    padding: 8px 0;
    border-radius: 8px;
    border: 1px solid #dadce0;
    background: #f1f3f4;
    cursor: pointer;
}

.pagination-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 24px;
    cursor: pointer;
}

/* ============================
   在庫ありスイッチ（Material風）
============================ */
.stock-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
    color: #202124;
}

/* input を非表示にしてカスタムスイッチを作る */
.stock-switch input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 46px;
    height: 26px;
    background: #dadce0;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.25s ease;
    outline: none;
}

/* 丸いスライダー部分 */
.stock-switch input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ON の状態 */
.stock-switch input[type="checkbox"]:checked {
    background: #1a73e8;
}

.stock-switch input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* ホバー時の軽いアニメーション */
.stock-switch:hover input[type="checkbox"] {
    box-shadow: 0 0 0 4px rgba(26,115,232,0.15);
}

/* 画像ラッパー */
.image-wrapper {
    position: relative;
}

/* SOLD OUT バッジ */
.soldout-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.85);
    color: #fff;
    padding: 10px 20px;
    font-size: 1.4rem;
    font-weight: bold;
    border-radius: 6px;
}

/* 売り切れ商品の画像を暗くする（任意） */
.product-card.sold-out .product-image {
    opacity: 0.4;
}
