/* Amazon商品表示の基本スタイル */
.amazon-products {
    margin-top: 20px;
    margin-bottom: 20px;
}

.akp-product {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

/* コンテナ幅に基づく縦表示切り替え（サイドバー対応） */
@container (max-width: 400px) {
    .akp-product {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 12px;
    }
    
    .akp-image {
        align-self: center;
        margin-right: 0;
        margin-bottom: 10px;
        padding-top: 0; /* 縦並び時はリセット */
    }
    
    .akp-image img {
        width: 120px;
        max-width: 120px;
    }
    
    .akp-info {
        text-align: left;
    }
    
    .akp-title {
        text-align: center;
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 15px;
        padding-top: 0; /* 縦並び時はリセット */
    }
    
    .akp-release-date {
        text-align: center;
        margin-bottom: 15px;
        font-size: 13px;
    }
    
    .akp-buttons {
        flex-direction: column;
        gap: 6px;
        margin-top: 15px;
    }
    
    .akp-btn {
        width: 100%;
        padding: 10px 15px;
        font-size: 13px;
        min-width: auto;
    }
}

/* Container Queriesが使えない場合のフォールバック */
.amazon-products {
    container-type: inline-size;
}

/* PRバッジのスタイル */
.akp-pr-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: #ff9900;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 10;
    letter-spacing: 0.5px;
}

/* PRバッジ内のリンクスタイル */
.akp-pr-badge a {
    color: inherit;
    text-decoration: none;
}

.akp-pr-badge a:hover {
    text-decoration: underline;
}

.akp-image {
    flex-shrink: 0;
    margin-right: 15px;
    padding-top: 20px; /* PRバッジとの重なりを防ぐスペース */
}

.akp-image img {
    width: 120px;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    max-width: 120px;
}

.akp-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.akp-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    padding-top: 20px; /* PRバッジとの重なりを防ぐスペース */
}

.akp-title a {
    color: #232f3e;
    text-decoration: none;
}

.akp-title a:hover {
    text-decoration: underline;
}

/* レビュー評価のスタイル */
.akp-review-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.akp-stars {
    display: flex;
    align-items: center;
}

.akp-star {
    color: #ffa41c;
    font-size: 16px;
    line-height: 1;
}

.akp-star-full {
    color: #ffa41c;
}

.akp-star-half {
    color: #ffa41c;
}

.akp-star-empty {
    color: #ddd;
}

.akp-rating-text {
    color: #565959;
    font-size: 14px;
    font-weight: normal;
}

.akp-release-date {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.akp-release-date span {
    font-weight: bold;
    color: #232f3e;
}

/* ボタンのスタイル */
.akp-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.akp-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    min-width: 120px;
}

/* Amazonで見るボタン */
.akp-btn-amazon {
    background-color: #ff9900;
    color: #fff;
    border: 2px solid #ff9900;
}

.akp-btn-amazon:hover {
    background-color: #e68900;
    border-color: #e68900;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 153, 0, 0.3);
}

/* 関連商品を探すボタン */
.akp-btn-similar {
    background-color: #fff;
    color: #0066c0;
    border: 2px solid #0066c0;
}

.akp-btn-similar:hover {
    background-color: #0066c0;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 192, 0.3);
}

/* タブレットサイズ対応 */
@media (max-width: 1024px) {
    .akp-product {
        gap: 15px;
        padding: 12px;
    }
    
    .akp-image img {
        width: 100px;
        max-width: 100px;
    }
}

/* スマホサイズ対応 */
@media (max-width: 768px) {
    .akp-product {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        text-align: center;
    }
    
    .akp-image {
        align-self: center;
        margin-right: 0;
        margin-bottom: 10px;
        padding-top: 0; /* スマホ時はPRバッジが上部にあるためリセット */
    }
    
    .akp-image img {
        width: 150px;
        max-width: 150px;
    }
    
    .akp-info {
        text-align: left;
    }
    
    .akp-title {
        font-size: 15px;
        line-height: 1.4;
        text-align: center;
        margin-bottom: 15px;
        padding-top: 0; /* スマホ時はPRバッジが上部にあるためリセット */
    }
    
    .akp-release-date {
        text-align: center;
        margin-bottom: 20px;
    }
    
    .akp-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 20px;
    }
    
    .akp-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
        min-width: auto;
    }
    
    .akp-review-rating {
        flex-direction: column;
        align-items: center;
        gap: 5px;
        text-align: center;
    }
    
    /* スマホ時のPRバッジ調整 */
    .akp-pr-badge {
        top: 10px;
        left: 10px;
        font-size: 11px;
        padding: 3px 7px;
    }
}

/* 小さいスマホサイズ対応 */
@media (max-width: 480px) {
    .amazon-products {
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .akp-product {
        padding: 12px;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .akp-image img {
        width: 120px;
        max-width: 120px;
    }
    
    .akp-title {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .akp-release-date {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .akp-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .akp-buttons {
        gap: 6px;
        margin-top: 15px;
    }
}

/* Container Queriesがサポートされていない場合のフォールバック */
/* サイドバーなど狭いコンテナでの表示対応 */
@supports not (container-type: inline-size) {
    .amazon-products {
        max-width: 100%;
    }
    
    /* 親要素の幅が狭い場合の検出（推定） */
    .akp-product {
        min-width: 0; /* フレックスアイテムの最小幅制限を解除 */
    }
    
    @media (max-width: 400px), (max-width: 768px) and (min-width: 300px) {
        .akp-product {
            flex-direction: column;
            text-align: center;
            gap: 15px;
            padding: 12px;
        }
        
        .akp-image {
            align-self: center;
            margin-right: 0;
            margin-bottom: 10px;
            padding-top: 0; /* 縦並び時はリセット */
        }
        
        .akp-image img {
            width: 120px;
            max-width: 120px;
        }
        
        .akp-info {
            text-align: left;
        }
        
        .akp-title {
            text-align: center;
            font-size: 14px;
            line-height: 1.4;
            margin-bottom: 15px;
            padding-top: 0; /* 縦並び時はリセット */
        }
        
        .akp-release-date {
            text-align: center;
            margin-bottom: 15px;
            font-size: 13px;
        }
        
        .akp-buttons {
            flex-direction: column;
            gap: 6px;
            margin-top: 15px;
        }
        
        .akp-btn {
            width: 100%;
            padding: 10px 15px;
            font-size: 13px;
            min-width: auto;
        }
    }
}

/* 管理画面用スタイル */
.akp-columns::after {
    content: '';
    display: table;
    clear: both;
}

.akp-sortable-box {
    width: 100%;
    margin-bottom: 30px;
    padding: 10px;
    background: #f9f9f9;
    border: 2px solid #ccc;
    border-radius: 6px;
}

.akp-col-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    color: #0073aa;
}

.akp-sortable {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 100px;
}

.akp-sortable li {
    background: #ffffff;
    border: 1px solid #ccc;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: move;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

.akp-sortable li::before {
    content: '\1F4E6'; /* 📦 */
    margin-right: 6px;
}

#akp-selected li::before {
    counter-increment: akp-num;
    content: counter(akp-num) '. ';
    font-weight: bold;
    margin-right: 6px;
    color: #0073aa;
}

#akp-selected {
    counter-reset: akp-num;
    background-color: #eaf7ff;
}

#akp-available {
    background-color: #fefefe;
}

.akp-highlight {
    background: #cce5ff !important;
    border: 2px dashed #0073aa;
    height: 40px;
    margin-bottom: 6px;
}