/**
 * 商品カード改善スタイル
 * Phase 2: ビジュアル改善実装 - レスポンシブ対応
 * 
 * @package FurusatoNanae
 * @since v0.3.0
 */

/* ========================================
   0. レイアウト調整
   ======================================== */
.henreihin-content.full-width {
    grid-template-columns: 1fr;
    max-width: none;
}

.henreihin-main.full-width {
    width: 100%;
    max-width: none;
}

/* ========================================
   1. 商品カード基本スタイル
   ======================================== */
.product-card {
    /* デザイン */
    background: var(--bg-white);
    border-radius: 16px;
    overflow: visible; /* 内容が見切れないように変更 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    /* トランジション */
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    
    /* PC表示: 横長レイアウト */
    display: flex;
    flex-direction: row;
    min-height: 200px; /* heightからmin-heightに変更 */
    width: 100%;
}

/* SP表示: 縦長レイアウト */
@media (max-width: 768px) {
    .product-card {
        flex-direction: column;
        min-height: 400px;
        height: auto;
        width: 100%;
        max-width: 100%; /* 最大幅を100%に変更 */
        margin: 0 auto;
        overflow: visible;
    }
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
}

/* ========================================
   2. 画像エリア
   ======================================== */
.product-image-wrapper {
    /* PC表示: 左側60% */
    width: 60%;
    min-height: 200px; /* 固定高さを最小高さに */
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
    flex-shrink: 0;
    border-radius: 16px 0 0 16px; /* 左側の角丸を追加 */
}

/* SP表示: 上部 */
@media (max-width: 768px) {
    .product-image-wrapper {
        width: 100%;
        height: 220px; /* 固定高さに変更 */
        min-height: 220px;
        border-radius: 16px 16px 0 0; /* 上部の角丸 */
    }
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

/* No Image フォールバック */
.product-image-wrapper.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.product-image-wrapper.no-image::before {
    content: "📷";
    font-size: 48px;
    opacity: 0.3;
}

/* ========================================
   3. 季節バッジ
   ======================================== */
.seasonal-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 季節別カラーリング */
.seasonal-badge.spring {
    background-color: rgba(255, 224, 230, 0.95);
    color: #E91E63;
}

.seasonal-badge.summer {
    background-color: rgba(225, 245, 254, 0.95);
    color: #0277BD;
}

.seasonal-badge.autumn {
    background-color: rgba(255, 243, 224, 0.95);
    color: #EF6C00;
}

.seasonal-badge.winter {
    background-color: rgba(243, 229, 245, 0.95);
    color: #7B1FA2;
}

/* ========================================
   4. カテゴリ・サブカテゴリバッジ
   ======================================== */
.category-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

.category-badge,
.subcategory-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    text-align: center;
}

.category-badge {
    background-color: rgba(33, 150, 243, 0.9);
    color: white;
}

.subcategory-badge {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.subcategory-badge.fruits::before {
    content: "🍎 ";
}

.subcategory-badge.vegetables::before {
    content: "🥬 ";
}

/* ========================================
   5. 情報エリア
   ======================================== */
.product-info {
    /* PC表示: 右側40% */
    width: 40%;
    min-height: 200px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow: visible; /* 内容が見切れないように */
}

/* SP表示: 下部 */
@media (max-width: 768px) {
    .product-info {
        width: 100%;
        min-height: 180px;
        height: auto; /* 内容に応じて拡張 */
        padding: 16px;
        box-sizing: border-box; /* パディングを幅に含める */
        overflow: visible;
    }
}

/* 商品タイトル */
.product-title {
    font-size: 15px; /* 少しサイズを小さく */
    font-weight: bold;
    line-height: 1.3;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%; /* 幅を100%に設定 */
}

.product-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-title a:hover {
    color: #2196F3;
}

/* 人気度スコア */
.popularity-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px; /* フォントサイズを小さく */
    margin: 4px 0;
    width: 100%; /* 幅を100%に設定 */
}

.popularity-display .stars {
    color: #FFB400;
    letter-spacing: 2px;
}

.popularity-display .score-text {
    color: #666;
    font-size: 12px;
}

/* 価格表示 */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 6px 0; /* マージンを少し減らす */
    width: 100%; /* 幅を100%に設定 */
}

.price-label {
    font-size: 12px;
    color: #666;
}

.price-amount {
    font-size: 20px; /* フォントサイズを小さく */
    font-weight: bold;
    color: #D32F2F;
}

/* 商品説明 */
.product-description {
    flex-grow: 0; /* flex-growを0に変更 */
    margin: 8px 0;
}

.product-description p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* PC表示では2行に制限 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
}

/* SP表示では3行まで表示 */
@media (max-width: 768px) {
    .product-description p {
        -webkit-line-clamp: 3;
        font-size: 12px; /* フォントサイズを調整 */
    }
}

/* ホバー時の全文表示（ツールチップ） */
.product-description[data-full-text]::after {
    content: attr(data-full-text);
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
    white-space: normal;
}

.product-description:hover::after {
    opacity: 1;
}

/* ========================================
   6. ポータルリンクボタン
   ======================================== */
.portal-links {
    display: flex;
    flex-direction: column; /* 縦並びに変更 */
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    width: 100%;
    align-items: center; /* 中央揃え */
}

.portal-button {
    /* PC表示: 426x122のサイズ */
    width: 426px;
    height: 122px;
    padding: 0;
    border-radius: 6px;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 8px 0;
}

/* ポータルサイト別ブランドカラー */
.portal-button.furusato-choice {
    background: linear-gradient(45deg, #FF6B35, #FF8A50);
}

.portal-button.rakuten {
    background: linear-gradient(45deg, #BF0000, #E60012);
}

.portal-button.satofull {
    background: linear-gradient(45deg, #00A0DC, #0077C8);
}

.portal-button.au-paymarket {
    background: linear-gradient(45deg, #FFA500, #FFB833);
}

.portal-button.other {
    background: linear-gradient(45deg, #757575, #9E9E9E);
}

.portal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: white;
}

/* ========================================
   検索機能スタイル (v0.3.0)
   ======================================== */

.search-section {
    margin:  0 0 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #e9ecef 100%);
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.search-container {
    margin: 0 auto;
}

.search-box-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 12px 20px 12px 50px;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.search-input::placeholder {
    color: #6c757d;
}

.search-icon {
    position: absolute;
    left: 18px;
    font-size: 18px;
    color: #6c757d;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 15px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.search-clear:hover {
    background: #c82333;
}

.search-results-info {
    text-align: center;
    margin-top: 1rem;
    color: #495057;
    font-size: 14px;
}

/* 検索結果スタイル */
.search-results-wrapper {
    margin-top: 2rem;
}

.search-results-title {
    color: #2e7d32;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2e7d32;
}

.search-highlight {
    background: linear-gradient(120deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

/* 検索結果なし */
.search-no-results {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-primary);
    border-radius: 6px;
    margin: 2rem 0;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.no-results-title {
    color: #495057;
    margin-bottom: 1rem;
}

.no-results-message {
    color: #6c757d;
    line-height: 1.6;
}

.link-button {
    background: none;
    border: none;
    color: #2e7d32;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
}

.link-button:hover {
    color: #1b5e20;
}

/* ローディング */
.search-loading {
    text-align: center;
    padding: 3rem 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2e7d32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* エラー表示 */
.search-error {
    text-align: center;
    padding: 2rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    margin: 2rem 0;
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.retry-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
}

.retry-button:hover {
    background: #c82333;
}

/* 検索利用不可メッセージ */
.search-unavailable {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.unavailable-icon {
    font-size: 64px;
    margin-bottom: 20px;
    color: #ff9800;
}

.unavailable-title {
    color: #d84315;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
}

.unavailable-message {
    color: #555;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.unavailable-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.btn-primary {
    background: #2e7d32;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    background: #1b5e20;
}

.btn-secondary {
    background: transparent;
    color: #2e7d32;
    border: 2px solid #2e7d32;
    padding: 10px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #2e7d32;
    color: white;
}

.contact-info {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    max-width: 400px;
    margin: 0 auto;
}

.contact-info p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.contact-info p:first-child {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .search-section {
        margin: 1rem 0;
        padding: 1rem;
    }

    .search-input {
        padding: 10px 15px 10px 40px;
        font-size: 14px;
    }

    .search-icon {
        left: 12px;
        font-size: 16px;
    }

    .no-results-icon {
        font-size: 3rem;
    }
}

/* ========================================
   7. アクションボタン - 後日追加予定
   ======================================== */
/*
.product-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    width: 100%;
    gap: 8px;
}

.detail-button {
    padding: 5px 12px;
    background: #2196F3;
    color: white;
    border-radius: 16px;
    text-decoration: none;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-grow: 1;
    text-align: center;
    max-width: 120px;
}

.detail-button:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.favorite-button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.favorite-button:hover {
    background: #FFF3E0;
    border-color: #FF9800;
}

.favorite-button .favorite-icon {
    font-size: 16px;
    color: #FF9800;
}
*/

/* ========================================
   8. グリッドレイアウト - レスポンシブ対応
   ======================================== */
.products-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 0;
}

/* PC表示: 1列で横長カード */
@media (min-width: 769px) {
    .products-grid {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* SP表示: 1列で縦長カード */
@media (max-width: 768px) {
    .products-grid {
        display: grid;
        grid-template-columns: 1fr; /* 1列に変更 */
        gap: 16px;
        padding: 16px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .portal-button {
        /* SP表示: タッチしやすいサイズ */
        width: 100%;
        height: 60px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    .portal-links {
        gap: 12px;
    }
}

/* 極小画面: 1列 */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .product-card {
        min-height: auto;
        height: auto;
        width: 100%;
        max-width: 100%;
    }
    
    .product-image-wrapper {
        height: 180px;
        min-height: 180px;
        width: 100%;
    }
    
    .product-info {
        min-height: auto;
        padding: 12px;
        width: 100%;
    }
    
    .product-title {
        font-size: 14px;
        -webkit-line-clamp: 3;
    }
    
    .price-amount {
        font-size: 18px;
    }
    
    .portal-button {
        width: 100%;
        height: 50px;
        font-size: 14px;
    }
}

/* ========================================
   9. アニメーション
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-item {
    animation: fadeIn 0.5s ease backwards;
}

.product-item:nth-child(1) { animation-delay: 0.05s; }
.product-item:nth-child(2) { animation-delay: 0.1s; }
.product-item:nth-child(3) { animation-delay: 0.15s; }
.product-item:nth-child(4) { animation-delay: 0.2s; }
.product-item:nth-child(5) { animation-delay: 0.25s; }
.product-item:nth-child(6) { animation-delay: 0.3s; }
.product-item:nth-child(7) { animation-delay: 0.35s; }
.product-item:nth-child(8) { animation-delay: 0.4s; }

/* ========================================
   10. アクセシビリティ
   ======================================== */
.product-card:focus-within {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
}

.portal-button:focus,
.detail-button:focus,
.favorite-button:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

/* スクリーンリーダー用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}