/* 改良されたAmazon商品カルーセル表示 - サイズ固定版 */
.amazon-products.akp-carousel-container {
    margin: 20px 0;
    width: 100%; /* 幅を100%に変更 */
    position: relative;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    user-select: none;
    cursor: grab;
    /* 全体の高さを固定 */
    height: 560px;
    display: flex;
    flex-direction: column;
}

.amazon-products.akp-carousel-container:active {
    cursor: grabbing;
}

/* カルーセルヘッダー（固定サイズ） */
.akp-carousel-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #ff9900 0%, #ffb84d 100%);
    color: white;
    /* ヘッダーの高さを固定 */
    height: 50px;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
}

/* 広告表示ラベル（左上） */
.akp-ad-label {
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* 簡略化されたコントロール */
.akp-carousel-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.akp-carousel-counter {
    font-size: 12px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    white-space: nowrap;
}

.akp-carousel-auto-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.akp-carousel-auto-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* カルーセル本体（商品表示部分 - 可変サイズ） */
.akp-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
    /* 残りのスペースを全て使用 */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.akp-carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
}

.akp-carousel-item {
    display: none;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(0);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: absolute;
    top: 0;
    left: 0;
}

.akp-carousel-item.akp-carousel-active {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    position: relative;
}

/* スライドアニメーション */
.akp-carousel-item.akp-slide-out-left {
    display: flex;
    opacity: 0;
    transform: translateX(-100%);
    position: absolute;
}

.akp-carousel-item.akp-slide-out-right {
    display: flex;
    opacity: 0;
    transform: translateX(100%);
    position: absolute;
}

.akp-carousel-item.akp-slide-in-left {
    display: flex;
    opacity: 0;
    transform: translateX(-100%);
    position: absolute;
}

.akp-carousel-item.akp-slide-in-right {
    display: flex;
    opacity: 0;
    transform: translateX(100%);
    position: absolute;
}

/* スワイプヒント */
.akp-swipe-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.5s ease;
    pointer-events: none;
    animation: akp-hint-pulse 2s infinite;
}

@keyframes akp-hint-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.4; }
}

/* 商品カード（カルーセル用 - サイズ固定） */
.akp-carousel-container .akp-product {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: none;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    text-align: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    justify-content: space-between;
}

.akp-carousel-container .akp-image {
    align-self: center;
    margin-bottom: 15px;
    flex-shrink: 0;
    /* 画像エリアの高さを固定 */
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.akp-carousel-container .akp-image img {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.akp-carousel-container .akp-image img:hover {
    transform: scale(1.05);
}

.akp-carousel-container .akp-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    justify-content: space-between;
}

.akp-carousel-container .akp-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.4;
    /* タイトルの高さを固定 */
    height: 56px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

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

.akp-carousel-container .akp-title a:hover {
    text-decoration: underline;
    color: #ff9900;
}

.akp-carousel-container .akp-release-date {
    color: #666;
    font-size: 12px;
    margin-bottom: 15px;
    /* 発売日の高さを固定 */
    height: 16px;
    flex-shrink: 0;
}

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

/* ボタン（カルーセル用 - サイズ固定） */
.akp-carousel-container .akp-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
}

.akp-carousel-container .akp-btn {
    display: block;
    padding: 10px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    width: 100%;
    box-sizing: border-box;
    /* ボタンの高さを固定 */
    height: 40px;
    line-height: 18px;
}

.akp-carousel-container .akp-btn-amazon {
    background: linear-gradient(135deg, #ff9900 0%, #ffb84d 100%);
    color: #fff;
    border: 2px solid transparent;
}

.akp-carousel-container .akp-btn-amazon:hover {
    background: linear-gradient(135deg, #e68900 0%, #ff9900 100%);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 153, 0, 0.4);
}

.akp-carousel-container .akp-btn-similar {
    background: #fff;
    color: #0066c0;
    border: 2px solid #0066c0;
}

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

/* インジケーター（固定サイズ） */
.akp-carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 15px;
    background-color: #f8f9fa;
    /* インジケーターの高さを固定 */
    height: 38px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.akp-carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.akp-carousel-indicator:hover {
    background-color: #ff9900;
    transform: scale(1.2);
}

.akp-carousel-indicator.akp-indicator-active {
    background-color: #ff9900;
    transform: scale(1.3);
}

/* 自動再生状態の視覚的フィードバック */
.akp-carousel-auto-toggle[data-auto="true"] {
    background: rgba(76, 175, 80, 0.8);
}

.akp-carousel-auto-toggle[data-auto="false"] {
    background: rgba(244, 67, 54, 0.8);
}

/* ローディング状態 */
.akp-carousel-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.akp-carousel-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #ff9900;
    border-radius: 50%;
    animation: akp-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes akp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .amazon-products.akp-carousel-container {
        margin: 15px 0;
        /* モバイルでは少し高さを調整 */
        height: 520px;
    }
    
    .akp-carousel-header {
        padding: 12px;
        height: 50px;
        justify-content: center;
    }
    
    .akp-carousel-container .akp-product {
        padding: 15px;
    }
    
    .akp-carousel-container .akp-image {
        height: 160px;
    }
    
    .akp-carousel-container .akp-image img {
        max-width: 150px;
        max-height: 150px;
    }
    
    .akp-carousel-container .akp-title {
        font-size: 13px;
        height: 52px;
    }
    
    .akp-carousel-container .akp-btn {
        font-size: 12px;
        padding: 8px 12px;
        height: 36px;
        line-height: 18px;
    }
    
    .akp-swipe-hint {
        bottom: 50px;
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* タブレット対応 */
@media (min-width: 481px) and (max-width: 768px) {
    .amazon-products.akp-carousel-container {
        height: 580px;
    }
    
    .akp-carousel-container .akp-image {
        height: 220px;
    }
    
    .akp-carousel-container .akp-image img {
        max-width: 200px;
        max-height: 200px;
    }
}

/* 大画面対応 */
@media (min-width: 769px) {
    .amazon-products.akp-carousel-container {
        height: 560px;
    }
    
    .akp-carousel-container .akp-image {
        height: 200px;
    }
    
    .akp-carousel-container .akp-image img {
        max-width: 200px;
        max-height: 180px;
    }
    
    /* デスクトップではマウスホバーでヒントを表示 */
    .amazon-products.akp-carousel-container:hover .akp-swipe-hint {
        opacity: 0.9;
    }
}

/* フォーカス・アクセシビリティ */
.akp-carousel-indicator:focus,
.akp-carousel-auto-toggle:focus,
.amazon-products.akp-carousel-container:focus {
    outline: 2px solid #0066c0;
    outline-offset: 2px;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .amazon-products.akp-carousel-container {
        border: 2px solid #000;
    }
    
    .akp-carousel-indicator {
        border: 1px solid #000;
    }
}

/* 動きを抑制する設定への対応 */
@media (prefers-reduced-motion: reduce) {
    .akp-carousel-item,
    .akp-carousel-container .akp-image img,
    .akp-carousel-indicator {
        transition: none;
    }
    
    .akp-hint-pulse {
        animation: none;
    }
}

/* ボタン固定版カルーセル専用スタイル */
.amazon-products.akp-fixed-buttons {
    display: flex;
    flex-direction: column;
}

/* 商品情報エリア（可変サイズ） */
.akp-fixed-buttons .akp-carousel-wrapper {
    /* ボタンエリア分の高さを調整 */
    flex: 1;
    min-height: 0; /* flexアイテムのmin-heightをリセット */
}

/* 商品カード（ボタン固定版 - ボタンエリアを除外） */
.akp-fixed-buttons .akp-product {
    padding: 20px;
    /* ボタンエリアを含まないように調整 */
    padding-bottom: 10px;
}

/* ボタンエリアを商品カードから除外 */
.akp-fixed-buttons .akp-carousel-item .akp-buttons {
    display: none;
}

/* 固定ボタンエリア（常に表示） */
.akp-fixed-buttons-area {
    padding: 15px 20px;
    background-color: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    /* 固定エリアの高さを明示 */
    height: 80px; /* 2つのボタン + パディング */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.akp-fixed-buttons-area .akp-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 280px;
}

/* 固定ボタンのスタイル（既存のボタンスタイルを継承） */
.akp-fixed-buttons-area .akp-btn {
    display: block;
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    width: 100%;
    box-sizing: border-box;
    height: 32px; /* 固定版は少し小さく */
    line-height: 16px;
}

.akp-fixed-buttons-area .akp-btn-amazon {
    background: linear-gradient(135deg, #ff9900 0%, #ffb84d 100%);
    color: #fff;
    border: 2px solid transparent;
}

.akp-fixed-buttons-area .akp-btn-amazon:hover {
    background: linear-gradient(135deg, #e68900 0%, #ff9900 100%);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 153, 0, 0.4);
}

.akp-fixed-buttons-area .akp-btn-similar {
    background: #fff;
    color: #0066c0;
    border: 2px solid #0066c0;
}

.akp-fixed-buttons-area .akp-btn-similar:hover {
    background: #0066c0;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 192, 0.4);
}

/* インジケーターの位置調整 */
.akp-fixed-buttons .akp-carousel-indicators {
    /* 固定ボタンエリアの上に配置 */
    order: -1; /* ボタンエリアより前に表示 */
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
}

/* スワイプヒントの位置調整 */
.akp-fixed-buttons .akp-swipe-hint {
    /* 固定ボタンエリアを考慮した位置 */
    bottom: 120px;
}

/* 高さの再計算（固定ボタン版） */
.akp-fixed-buttons {
    /* 全体の高さ = ヘッダー + 商品エリア + ボタンエリア + インジケーター */
    height: 560px;
}

.akp-fixed-buttons .akp-carousel-wrapper {
    /* 商品エリア = 全体 - (ヘッダー + ボタンエリア + インジケーター) */
    height: calc(100% - 50px - 80px - 38px); /* ヘッダー50px、ボタン80px、インジケーター38px */
}

/* レスポンシブ対応（固定ボタン版） */
@media (max-width: 480px) {
    .akp-fixed-buttons {
        height: 520px;
    }
    
    .akp-fixed-buttons-area {
        padding: 12px 15px;
        height: 72px;
    }
    
    .akp-fixed-buttons-area .akp-btn {
        font-size: 12px;
        padding: 6px 12px;
        height: 28px;
        line-height: 16px;
    }
    
    .akp-fixed-buttons .akp-carousel-wrapper {
        height: calc(100% - 50px - 72px - 38px);
    }
    
    .akp-fixed-buttons .akp-swipe-hint {
        bottom: 100px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .akp-fixed-buttons {
        height: 580px;
    }
    
    .akp-fixed-buttons .akp-carousel-wrapper {
        height: calc(100% - 50px - 80px - 38px);
    }
}

/* アニメーション効果（ボタンURL更新時） */
.akp-fixed-buttons-area .akp-btn {
    transform-origin: center;
}

.akp-fixed-buttons-area .akp-btn:active {
    transform: scale(0.98);
}

/* フォーカス状態（固定ボタン版） */
.akp-fixed-buttons-area .akp-btn:focus {
    outline: 2px solid #0066c0;
    outline-offset: 2px;
}

/* 高コントラストモード（固定ボタン版） */
@media (prefers-contrast: high) {
    .akp-fixed-buttons-area {
        border-top: 2px solid #000;
    }
    
    .akp-fixed-buttons-area .akp-btn {
        border-width: 2px;
    }
}