/**
 * アフィリエイト推奨UIのスタイルシート
 * FPモードでAmazon商品推奨を美しく表示
 */

/* ==========================================================================
   アフィリエイトコンテナ
   ========================================================================== */

.affiliate-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e8ed;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
}

.affiliate-container.visible {
    transform: translateY(0);
    opacity: 1;
}

.affiliate-container.hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
}

.affiliate-container.fade-in {
    animation: affiliateSlideIn 0.4s ease-out;
}

@keyframes affiliateSlideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
   ヘッダー
   ========================================================================== */

.affiliate-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.affiliate-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.affiliate-title .icon-shopping-bag {
    margin-right: 8px;
    font-size: 18px;
}

.affiliate-subtitle {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.affiliate-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.affiliate-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.affiliate-close .icon-x {
    font-size: 16px;
}

/* ==========================================================================
   コンテンツ
   ========================================================================== */

.affiliate-content {
    max-height: 480px;
    overflow-y: auto;
    padding: 0;
}

.affiliate-content::-webkit-scrollbar {
    width: 6px;
}

.affiliate-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.affiliate-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.affiliate-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   商品カード
   ========================================================================== */

.affiliate-product-card {
    display: flex;
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
    position: relative;
}

.affiliate-product-card:hover {
    background-color: #f8fafc;
}

.affiliate-product-card:last-child {
    border-bottom: none;
}

.product-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    margin-right: 12px;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f5f9;
}

.product-info {
    flex: 1;
    min-width: 0;
    padding-right: 8px;
}

.product-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    color: #1e293b;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-reason {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-rating {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.star-rating {
    display: flex;
    margin-right: 6px;
}

.star-rating .icon-star-full {
    color: #fbbf24;
    font-size: 12px;
}

.star-rating .icon-star-half {
    color: #fbbf24;
    font-size: 12px;
}

.star-rating .icon-star-empty {
    color: #d1d5db;
    font-size: 12px;
}

.rating-count {
    font-size: 11px;
    color: #9ca3af;
}

.product-price {
    font-weight: 700;
    font-size: 16px;
    color: #dc2626;
    margin-bottom: 8px;
}

.product-benefits {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.benefit-tag {
    background: #e0f2fe;
    color: #0891b2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

/* ==========================================================================
   アクションボタン
   ========================================================================== */

.product-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.affiliate-link-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}

.affiliate-link-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.35);
    text-decoration: none;
    color: white;
}

.affiliate-link-btn .icon-external-link {
    margin-right: 4px;
    font-size: 12px;
}

/* ==========================================================================
   フッター
   ========================================================================== */

.affiliate-footer {
    padding: 12px 20px;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
    border-top: 1px solid #f1f5f9;
}

.affiliate-disclaimer {
    font-size: 11px;
    color: #64748b;
    text-align: center;
    line-height: 1.3;
}

/* ==========================================================================
   レスポンシブデザイン
   ========================================================================== */

@media (max-width: 768px) {
    .affiliate-container {
        right: 10px;
        bottom: 10px;
        width: 340px;
        max-width: calc(100vw - 20px);
    }

    .affiliate-header {
        padding: 14px 16px;
    }

    .affiliate-title {
        font-size: 15px;
    }

    .affiliate-subtitle {
        font-size: 12px;
    }

    .affiliate-product-card {
        padding: 14px 16px;
    }

    .product-image {
        width: 70px;
        height: 70px;
        margin-right: 10px;
    }

    .product-name {
        font-size: 13px;
    }

    .product-price {
        font-size: 15px;
    }

    .affiliate-link-btn {
        padding: 7px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .affiliate-container {
        right: 8px;
        bottom: 8px;
        width: 320px;
        max-width: calc(100vw - 16px);
    }

    .affiliate-product-card {
        padding: 12px 14px;
    }

    .product-image {
        width: 60px;
        height: 60px;
        margin-right: 8px;
    }

    .product-name {
        font-size: 12px;
    }

    .product-reason {
        font-size: 11px;
    }

    .product-price {
        font-size: 14px;
    }

    .benefit-tag {
        font-size: 9px;
        padding: 1px 6px;
    }

    .affiliate-link-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
}

/* ==========================================================================
   アクセシビリティ
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .affiliate-container,
    .affiliate-link-btn,
    .affiliate-product-card {
        transition: none;
    }

    .affiliate-container.fade-in {
        animation: none;
    }
}

/* フォーカスリング */
.affiliate-close:focus,
.affiliate-link-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

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

    .affiliate-header {
        background: #000;
        color: #fff;
    }

    .affiliate-link-btn {
        background: #000;
        border: 2px solid #fff;
    }

    .product-name {
        color: #000;
    }
}

/* ==========================================================================
   ダークモード対応
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .affiliate-container {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }

    .affiliate-header {
        background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    }

    .affiliate-product-card:hover {
        background-color: #374151;
    }

    .affiliate-product-card {
        border-bottom-color: #374151;
    }

    .product-name {
        color: #f9fafb;
    }

    .product-reason {
        color: #9ca3af;
    }

    .product-price {
        color: #f87171;
    }

    .affiliate-footer {
        background: #374151;
        border-top-color: #4b5563;
    }

    .affiliate-disclaimer {
        color: #9ca3af;
    }

    .product-image img {
        background: #374151;
    }

    .affiliate-content::-webkit-scrollbar-track {
        background: #374151;
    }

    .affiliate-content::-webkit-scrollbar-thumb {
        background: #6b7280;
    }

    .affiliate-content::-webkit-scrollbar-thumb:hover {
        background: #9ca3af;
    }
}

/* ==========================================================================
   アイコンフォント（Feather Icons使用を想定）
   ========================================================================== */

.icon-shopping-bag::before {
    content: "🛍️";
}

.icon-x::before {
    content: "✕";
}

.icon-external-link::before {
    content: "↗";
}

.icon-star-full::before {
    content: "★";
}

.icon-star-half::before {
    content: "☆"; /* 実際にはハーフスター文字を使用 */
}

.icon-star-empty::before {
    content: "☆";
}