/* 改良されたAmazon商品カルーセル表示 - サイズ固定版 */
.amazon-products.akp-carousel-container {
    margin: 20px 0;
    max-width: 300px;
    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;
}

/* 簡略化されたコントロール */
.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 {
        max-width: 100%;
        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 {
        max-width: 350px;
        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 {
        max-width: 320px;
        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;
    }
}