/* =========================================================
   商品一覧ページ 共通
   ---------------------------------------------------------
   ・商品一覧全体
   ・画像モーダル
   ・最新価格お問い合わせモーダル
   ・レスポンシブ対応
========================================================= */


/* =========================================================
   1. ページ全体
========================================================= */

.products-page {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 10px 28px;
    box-sizing: border-box;
}


/* =========================================================
   2. ページヘッダー
========================================================= */

.products-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.products-page-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.products-cart-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    background: #111827;
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    transition: 0.2s ease;
}

.products-cart-link:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}


/* =========================================================
   3. 検索ボックス
========================================================= */

.products-search-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.products-search-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.products-search-input {
    flex: 1;
    min-width: 220px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
    outline: none;
}

.products-search-input::placeholder {
    color: #9ca3af;
}

.products-search-input:focus {
    border-color: #b90000;
    box-shadow: 0 0 0 3px rgba(185, 0, 0, 0.08);
}

.products-search-button {
    height: 40px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: #b90000;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.products-search-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}


/* =========================================================
   4. メッセージエリア
========================================================= */

.products-result-summary {
    margin: 0 0 10px;
    font-size: 14px;
    color: #6b7280;
}

.products-error-box {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff5f5;
    color: #c62828;
    border: 1px solid #fecaca;
    font-size: 13px;
}

.products-empty-box {
    padding: 24px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}


/* =========================================================
   5. 商品一覧
========================================================= */

.products-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.products-row {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}


/* ---------------------------------------------------------
   5-1. 商品名ヘッダー
--------------------------------------------------------- */

.products-row-header {
    background: #f8fafc;
    padding: 10px 12px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.45;
    color: #111827;
    border-bottom: 1px solid #eef2f7;
}

/* 特別指定の商品はタイトル帯を黒×金で強調 */
.products-row-header.is-special-title {
    background: #111;
    color: #d4af37;
    padding: 10px 12px;
    border-radius: 6px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.25);
}

/* 商品名帯の中の特別指定バッジ */
.products-special-badge-header {
    display: inline-block;
    background: linear-gradient(135deg, #d4af37, #f6e27a);
    color: #111;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
}


/* ---------------------------------------------------------
   5-2. 商品本体レイアウト
--------------------------------------------------------- */

.products-row-body {
    display: grid;
    grid-template-columns: 132px 1fr 190px;
    gap: 14px;
    padding: 12px;
    align-items: start;
}


/* =========================================================
   6. 商品画像エリア
========================================================= */

.products-image-area {
    display: flex;
    align-items: center;
    justify-content: center;
}

.products-image {
    width: 100%;
    max-width: 120px;
    height: 120px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #eceff3;
    border-radius: 12px;
    padding: 6px;
    box-sizing: border-box;
    cursor: zoom-in;
}


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

.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
}

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

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.2s ease;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 24px;
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
}

@keyframes zoomIn {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* =========================================================
   8. 商品情報エリア
========================================================= */

.products-info {
    min-width: 0;
}

.products-badge-row {
    margin-bottom: 6px;
}

.products-info-line {
    margin-bottom: 5px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
    color: #374151;
}

.products-info-label {
    display: inline-block;
    min-width: 72px;
    color: #6b7280;
    font-weight: 700;
}


/* ---------------------------------------------------------
   8-1. 商品情報バッジ
--------------------------------------------------------- */

.products-special-badge,
.products-store-badge {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    margin-bottom: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.products-special-badge {
    background: #111827;
    color: #fff;
}

.products-store-badge {
    background: #b90000;
    color: #fff;
}


/* ---------------------------------------------------------
   8-2. 商品情報リンク
--------------------------------------------------------- */

.products-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: 0.15s ease;
}

.products-link:hover {
    color: #1d4ed8;
    border-bottom: 1px solid #1d4ed8;
}


/* =========================================================
   9. 価格エリア
========================================================= */

.products-price-block {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
}

.products-price-main {
    font-size: 12px;
    font-weight: 800;
    color: #4b5563;
    line-height: 1.4;
}

.products-price-value {
    margin-top: 2px;
    color: #dc2626;
    font-size: 30px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0.01em;
}

.products-price-value-text {
    font-size: 21px;
}

.products-price-sub {
    margin-top: 4px;
    font-size: 11px;
    color: #dc2626;
    font-weight: 700;
    line-height: 1.45;
}

.products-updated-at {
    margin-top: 8px;
    font-size: 11px;
    color: #6b7280;
}


/* =========================================================
   10. アクションボタンエリア
========================================================= */

.products-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
    justify-content: center;
}

.products-cart-form {
    margin: 0;
}

.products-action-button {
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    box-sizing: border-box;
    border: none;
    transition: 0.2s ease;
}

.products-action-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.products-action-button-blue {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.products-action-button-yellow {
    background: #ffd54f;
    color: #3f2d00;
    cursor: pointer;
}


/* =========================================================
   11. ページネーション
========================================================= */

.products-page .pagination {
    gap: 4px;
}

.products-page .page-link,
.products-page .page-item span {
    font-size: 12px;
    border-radius: 8px !important;
}


/* =========================================================
   12. 最新価格お問い合わせボタン
========================================================= */
.latest-price-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;

    border-radius: 9999px;
    border: 1px solid #bfdbfe;

    /* 青系（products-action-button-blueに寄せる） */
    background: #eff6ff;
    color: #1d4ed8;

    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;

    cursor: pointer;

    /* 影なし */
    box-shadow: none;

    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

/* ホバー */
.latest-price-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

/* クリック */
.latest-price-btn:active {
    transform: translateY(0);
    background: #bfdbfe;
}

/* フォーカス */
.latest-price-btn:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.25);
    outline-offset: 2px;
}


/* =========================================================
   13. 最新価格お問い合わせモーダル
========================================================= */

/* hidden属性がある時は非表示 */
.latest-price-modal[hidden] {
    display: none !important;
}

/* モーダル全体 */
.latest-price-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    /* ← 縦中央 */
    justify-content: center;
    /* ← 横中央 */
}

/* 背景の暗幕 */
.latest-price-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: latestPriceFadeIn 0.2s ease;
}

/* モーダル本体 */
.latest-price-modal__dialog {
    position: relative;
    width: min(92vw, 560px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    margin: 0;
    padding: 28px 24px 24px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
    animation: latestPriceSlideUp 0.24s ease;
}

/* 閉じるボタン */
.latest-price-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 9999px;
    background: #f3f4f6;
    color: #111827;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.latest-price-modal__close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
}

.latest-price-modal__close:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.25);
    outline-offset: 2px;
}


/* ---------------------------------------------------------
   13-1. モーダルヘッダー
--------------------------------------------------------- */

.latest-price-modal__header {
    text-align: center;
    margin-bottom: 22px;
}

.latest-price-modal__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.latest-price-modal__header h3 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.3;
    font-weight: 800;
    color: #111827;
}

.latest-price-modal__header p {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: #6b7280;
}

.latest-price-limit {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 最大件数 */
.limit-max {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 9999px;

    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* 残り回数（重要なので強調） */
.limit-remaining {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    border-radius: 9999px;

    background: #1d4ed8;
    color: #fff;
}


/* ---------------------------------------------------------
   13-2. 商品情報ボックス
--------------------------------------------------------- */

.latest-price-product-box {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #3b82f6;
    border-radius: 18px;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.latest-price-product-box__label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    color: #2563eb;
    letter-spacing: 0.04em;
}

.latest-price-product-box__name {
    margin-bottom: 14px;
    font-size: 20px;
    line-height: 1.5;
    font-weight: 700;
    color: #111827;
    word-break: break-word;
}

.latest-price-product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.latest-price-product-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #f3f4f6;
}

.latest-price-product-item--full {
    grid-column: 1 / -1;
}

.latest-price-product-item__label {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
}

.latest-price-product-item__value {
    font-size: 14px;
    line-height: 1.6;
    color: #111827;
    word-break: break-all;
}


/* ---------------------------------------------------------
   13-3. 送信結果メッセージ
--------------------------------------------------------- */

.latest-price-message-area {
    margin-bottom: 16px;
}

.form-success,
.form-error {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
}

.form-success {
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}


/* ---------------------------------------------------------
   13-4. 入力フォーム
--------------------------------------------------------- */

.latest-price-form-group {
    margin-bottom: 18px;
}

.latest-price-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.latest-price-input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    background: #fff;
    color: #111827;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.latest-price-input::placeholder {
    color: #9ca3af;
}

.latest-price-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background: #fff;
}

.latest-price-help {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: #6b7280;
}


/* ---------------------------------------------------------
   13-5. 送信ボタン
--------------------------------------------------------- */

.latest-price-submit-btn {
    width: 100%;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: none;
    border-radius: 9999px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.4;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(59,130,246, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.latest-price-submit-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.latest-price-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}


/* =========================================================
   14. モーダル表示中のスクロール制御
========================================================= */

body.is-modal-open {
    overflow: hidden;
}


/* =========================================================
   15. モーダル用アニメーション
========================================================= */

@keyframes latestPriceFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes latestPriceSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================================================
   16. タブレット対応
========================================================= */

@media (max-width: 900px) {
    .products-row-body {
        grid-template-columns: 110px 1fr;
        gap: 12px;
    }

    .products-image {
        max-width: 100px;
        height: 100px;
    }

    .products-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 8px;
        align-self: stretch;
    }

    .products-actions>* {
        flex: 1;
    }
}


/* =========================================================
   17. スマホ対応
========================================================= */

@media (max-width: 640px) {
    .products-page {
        padding: 10px 8px 22px;
    }

    .products-page-header {
        margin-bottom: 8px;
    }

    .products-page-title {
        font-size: 12px;
    }

    .products-cart-link {
        width: 100%;
        min-height: 36px;
        font-size: 12px;
    }

    .products-search-box {
        padding: 8px;
        margin-bottom: 10px;
    }

    .products-search-form {
        flex-direction: column;
        gap: 6px;
    }

    .products-search-input,
    .products-search-button {
        width: 100%;
        min-width: 0;
        height: 38px;
        font-size: 12px;
    }

    .products-list {
        gap: 10px;
    }

    .products-row-header {
        font-size: 14px;
        padding: 8px 10px;
    }

    .products-row-body {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }

    .products-image {
        max-width: 150px;
        height: 150px;
    }

    .products-info-line {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .products-info-label {
        min-width: 64px;
    }

    .products-price-block {
        padding: 8px 10px;
    }

    .products-price-main {
        font-size: 11px;
    }

    .products-price-value {
        font-size: 24px;
    }

    .products-price-value-text {
        font-size: 18px;
    }

    .products-price-sub {
        font-size: 10px;
    }

    .products-updated-at {
        font-size: 10px;
    }

    .products-actions {
        flex-direction: column;
        gap: 6px;
    }

    .products-action-button {
        min-height: 38px;
        font-size: 12px;
    }

    .latest-price-modal__dialog {
        width: calc(100vw - 20px);
        margin: 10px auto;
        padding: 24px 16px 18px;
        border-radius: 20px;
        max-height: calc(100vh - 20px);
    }

    .latest-price-modal__header h3 {
        font-size: 23px;
    }

    .latest-price-product-box__name {
        font-size: 17px;
    }

    .latest-price-product-grid {
        grid-template-columns: 1fr;
    }

    .latest-price-product-item--full {
        grid-column: auto;
    }
}