/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* ヘッダー（Amazon風に寄せる） */
.site-header {
    background: #232f3e; /* ダークネイビー */
    color: white;
    padding: 0.6rem 0.8rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.site-header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
}

.logo-mark { font-size: 1.6rem; }
.logo-text { font-weight: 700; font-size: 1.1rem; color: #ffb84d; }

.search-wrap { display: none; }
/* 検索バーは不要のため関連スタイルを削除済み */

.header-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

/* 商品一覧ボタンスタイル（ヘッダー内） */
.show-products-btn {
    background: transparent;
    color: #ffebc6; /* 見た目をヘッダーに馴染ませる */
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}
.show-products-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    transform: translateY(-1px);
}
.show-products-btn:focus {
    outline: 2px solid rgba(255,189,77,0.32);
    outline-offset: 2px;
}

.nav-link {
    color: #e6eef9;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover { 
    color: #fff; 
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

/* ヘッダー内カテゴリドロップダウン */

.header-categories {
    margin-right: 0.6rem; /* アカウントリンクのすぐ左に表示 */
}

#category-dropdown {
    background: #fff;
    color: #232f3e;
    border: 1px solid #ddd;
    padding: 0.35rem 0.55rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* メインコンテンツ */
main {
    /* より広い表示領域を確保 */
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
    overflow: hidden; /* はみ出し防止 */
}

/* 2カラムレイアウト：商品一覧 + サイドバー(フィルタ／カート) */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
    justify-items: stretch;
    width: 100%;
    min-width: 0;
}

/* サイドバー表示時は商品一覧を非表示に */
.main-grid.sidebar-visible .content {
    display: none;
}

.main-grid.sidebar-visible .sidebar {
    grid-column: 1;
}

.sidebar {
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #eee;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-radius: 12px;
    display: none;
    position: relative;
}

.sidebar.visible {
    display: block;
}

/* sidebar close button removed - using header navigation to return to products */

.sidebar-content {
    margin-top: 1rem;
}

.sidebar-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #232f3e;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.8rem;
}

.sidebar-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.sidebar-content ul {
    list-style: none;
    padding: 0;
}

.sidebar-content ul li {
    padding: 1rem;
    margin-bottom: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* コンテンツ領域は常に中寄せ表示（products-grid を中央に） */
.content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%; /* カラム幅いっぱいに広げて content を充満させる */
    min-width: 0; /* グリッドアイテムの縮小を許可 */
}

/* カートは普段非表示（買い物中は不要）。最終支払い時のみフローティングボタンで表示 */
/* cart-section styles removed */

/* フローティングチェックアウトボタン */
#floating-checkout {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1100;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #ff9900;
    color: #0f1111;
    border: 1px solid #f0a000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.hidden {
    display: none !important;
}

/* カテゴリフィルター */
.category-filter {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* 商品グリッド */
.products-grid {
    display: grid;
    /* レスポンシブグリッド: デスクトップ3列、タブレット2列、モバイル1列 */
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0 3rem 0;
    width: 100%;
    max-width: 1200px; /* より広い表示領域 */
    min-width: 0; /* グリッド内縮小を許可 */
}

/* 商品情報部分はカード幅に合わせて常に100%にする */
.product-info {
    width: 100%;
    box-sizing: border-box;
}

.product-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    width: 100%; /* レスポンシブに対応 */
    max-width: 100%;
    margin: 0 auto;
    min-height: 460px; /* 高さを揃えてレイアウトの安定化 */
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
}

.product-image {
    width: 100%;
    height: 260px; /* 画像を大きく見せる */
    background: linear-gradient(45deg, #f6f7fb, #eef2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #cfcfcf;
}

.product-info {
    padding: 1.6rem;
    flex: 1 1 auto; /* カード内で情報領域が伸びるようにしてボタンを下に固定 */
    display: flex;
    flex-direction: column;
}

/* デスクトップ向け：今すぐ購入ボタンの強化 */
.buy-now-btn {
    display: inline-block;
    background: linear-gradient(180deg, #ffbf66 0%, #ff9900 100%);
    color: #0f1111;
    border: none;
    padding: 0.8rem 1.5rem;
    font-weight: 800;
    font-size: 1.1rem;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(255,153,0,0.25), inset 0 -2px 0 rgba(0,0,0,0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.12s ease;
    cursor: pointer;
    width: 100%;
    text-align: center;
    margin-top: auto; /* カード下部に固定 */
}
.buy-now-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(255,153,0,0.35), inset 0 -2px 0 rgba(0,0,0,0.08);
    background: linear-gradient(180deg, #ffc87a 0%, #ffad1a 100%);
}
.buy-now-btn:active {
    transform: translateY(-1px) scale(0.995);
}
.buy-now-btn:focus {
    outline: 3px solid rgba(255,153,0,0.5);
    outline-offset: 2px;
}

.product-name {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.product-price {
    font-size: 1.6rem;
    color: #232f3e; /* Amazon系のダークカラーで上品に */
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.product-description {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.product-category {
    display: inline-block;
    background: #e8f0fe;
    color: #1967d2;
    padding: 0.3rem 0.9rem;
    border-radius: 15px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* カート関連のスタイルは撤去されました（単一購入フローを使用） */

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s ease;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #ccc;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.payment-info {
    text-align: center;
}

.qr-codes-section {
    margin: 2rem 0;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.qr-codes-section::-webkit-scrollbar {
    width: 8px;
}

.qr-codes-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.qr-codes-section::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.qr-codes-section::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.product-qr-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.product-qr-item:last-child {
    margin-bottom: 0;
}

.product-qr-header {
    margin-bottom: 1rem;
}

.product-qr-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.product-qr-details {
    color: #666;
    font-size: 0.9rem;
}

.product-qr-code {
    max-width: 150px;
    border: 2px solid #eee;
    border-radius: 10px;
    margin: 1rem auto;
    display: block;
}

.qr-section {
    margin: 2rem 0;
}

.qr-section img {
    max-width: 200px;
    border: 2px solid #eee;
    border-radius: 10px;
}

.payment-instructions {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 10px;
    margin: 1.5rem 0;
    text-align: left;
}

.payment-instructions h3 {
    margin-bottom: 0.8rem;
    color: #333;
    font-size: 1rem;
}

.payment-instructions ol {
    padding-left: 1.2rem;
    font-size: 0.9rem;
}

.payment-instructions li {
    margin-bottom: 0.3rem;
}

.payment-instructions p {
    font-size: 0.85rem;
    margin-top: 0.8rem;
}

.complete-btn {
    width: 100%;
    background: #28a745;
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.complete-btn:hover {
    background: #218838;
}

/* 決済取り消しボタン */
.cancel-btn {
    width: 100%;
    background: #dc3545;
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    margin-top: 1rem;
    transition: background 0.2s ease;
}

.cancel-btn:hover {
    background: #c82333;
}

.cancel-btn:active {
    background: #bd2130;
}

/* フッター */
footer {
    text-align: center;
    padding: 1.5rem 1rem;
    background: #333;
    color: white;
    margin-top: 2rem;
    font-size: 0.9rem;
}

/* アニメーション */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* タブレット対応 */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.2rem;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .site-header {
        padding: 0.5rem 0.6rem;
    }

    .site-header .header-inner {
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }

    #category-dropdown {
        flex: 1;
        min-width: 0;
    }

    .nav-link {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
    }

    /* モバイル時は1カラムにして順序を調整 */
    .main-grid,
    .main-grid.sidebar-visible {
        grid-template-columns: 1fr;
    }

    .main-grid.sidebar-visible .content {
        display: none;
    }
    
    .sidebar {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: none;
        border-radius: 10px;
    }

    /* sidebar close button removed */
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1.5rem 0 2rem 0;
    }

    /* モバイルではカードを幅いっぱいにするオーバーライド */
    .product-card {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
        margin: 0;
        min-height: auto;
    }

    .product-image {
        height: 220px;
    }
    
    .category-filter {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .filter-btn {
        white-space: nowrap;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    footer {
        padding: 1rem 0.5rem;
        margin-top: 1.5rem;
        font-size: 0.8rem;
    }
}

/* この設定は削除（上のメディアクエリで統合） */

/* 追加のモバイル改善スタイル */
@media (max-width: 768px) {
    /* モバイルでは購入ボタンを大きくフル幅にしてタップしやすくする */
    .buy-now-btn {
        width: 100%;
        padding: 1rem 1rem;
        font-size: 1.05rem;
        border-radius: 8px;
    }
}

/* 中間幅（タブレット）対応 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        max-width: 500px;
        padding: 1.5rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 0.4rem 0.5rem;
    }
    
    .logo-mark {
        font-size: 1.3rem;
    }

    .logo-text {
        font-size: 0.9rem;
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 0.25rem 0.4rem;
    }
    
    main {
        padding: 0 0.5rem;
    }
    
    .products-grid {
        gap: 0.8rem;
        margin: 1rem 0;
    }

    .product-card {
        border-radius: 10px;
    }

    .product-image {
        height: 180px;
    }

    .product-info {
        padding: 1.2rem;
    }

    .product-name {
        font-size: 1.1rem;
    }

    .product-price {
        font-size: 1.4rem;
    }
    
    footer {
        padding: 0.8rem 0.5rem;
        font-size: 0.75rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 10% auto;
    }
}

/* 非表示クラス */
.hidden {
    display: none !important;
}

/* ローディングスピナー */
.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ポーリングインジケーターのアニメーション */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* QRコードエラー表示 */
.qr-error {
    background-color: #fff3cd;
    border-left: 4px solid #ff9800;
    color: #856404;
}

/* 決済ステータス表示 */
.payment-status {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.payment-status.completed {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.payment-status.pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.payment-status.failed {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
