/* EA商品一覧プラグイン - メインスタイル（レスポンシブ対応版） */

/* 基本レイアウト */
.ea-listing-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 30px;
    padding: 40px 20px;
    min-height: calc(100vh - 80px);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* メインコンテンツ */
.ea-main-content {
    flex: 1;
    min-width: 0;
}

/* ローディング */
.ea-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.ea-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: eaSpin 1s linear infinite;
    margin-bottom: 16px;
}

.ea-loading-text {
    color: #374151;
    font-size: 1rem;
    font-weight: 500;
}

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

/* ソートコントロール */
.ea-sort-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    background: white;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.ea-sort-btn {
    padding: 10px 18px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #374151;
    flex: 1;
    text-align: center;
    min-width: 120px;
}

.ea-sort-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.ea-sort-btn.active {
    background: #1f2937;
    color: white;
    border-color: #1f2937;
}

/* 商品グリッド - レスポンシブ対応強化 */
.ea-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.ea-product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 380px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.ea-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: #d1d5db;
}

/* 商品画像部分 */
.ea-product-image {
    width: 100%;
    height: 140px;
    background: #f8fafc;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ea-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ea-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 500;
}

/* カテゴリバッジ */
.ea-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* カテゴリ別の色分け - 提供デザインに基づく */
.ea-category-scalping, 
.ea-category-スキャルピング { 
    background: linear-gradient(135deg, #fecaca, #f87171);
    color: #7f1d1d;
}

.ea-category-grid, 
.ea-category-グリッド { 
    background: linear-gradient(135deg, #dbeafe, #60a5fa);
    color: #1e3a8a;
}

.ea-category-swing, 
.ea-category-スイング { 
    background: linear-gradient(135deg, #d1fae5, #34d399);
    color: #064e3b;
}

.ea-category-daytrading, 
.ea-category-デイトレード,
.ea-category-デイトレ { 
    background: linear-gradient(135deg, #fed7aa, #fb923c);
    color: #9a3412;
}

.ea-category-martingale, 
.ea-category-ナンピンマーチン,
.ea-category-ナンピン { 
    background: linear-gradient(135deg, #e9d5ff, #a78bfa);
    color: #581c87;
}

.ea-category-hedge, 
.ea-category-ヘッジ { 
    background: linear-gradient(135deg, #cffafe, #22d3ee);
    color: #164e63;
}

.ea-category-morning, 
.ea-category-朝スキャ,
.ea-category-朝スキャルピング { 
    background: linear-gradient(135deg, #fef3c7, #fbbf24);
    color: #92400e;
}

.ea-category-anomaly, 
.ea-category-アノマリー { 
    background: linear-gradient(135deg, #dcfce7, #4ade80);
    color: #15803d;
}

.ea-category-ebook, 
.ea-category-e-book,
.ea-category-電子書籍 { 
    background: linear-gradient(135deg, #e0e7ff, #818cf8);
    color: #3730a3;
}

.ea-category-indicator, 
.ea-category-インジケーター { 
    background: linear-gradient(135deg, #fce7f3, #f472b6);
    color: #be185d;
}

.ea-category-other, 
.ea-category-その他 { 
    background: linear-gradient(135deg, #f3f4f6, #9ca3af);
    color: #374151;
}

/* カテゴリバッジのホバーエフェクト */
.ea-product-card:hover .ea-category-badge {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 通貨ペア */
.ea-currency-pair {
    position: absolute;
    top: 50px;
    left: 12px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(10px);
}

/* 通貨ペアのホバーエフェクト */
.ea-product-card:hover .ea-currency-pair {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* 商品コンテンツ */
.ea-product-content {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ea-product-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 4px;
    line-height: 1.3;
}

.ea-store-name {
    color: #6b7280;
    font-size: 0.85rem;
    margin-bottom: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ea-store-name:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.ea-store-name::before {
    content: "🏪 ";
    margin-right: 4px;
}

/* カート追加ダイアログ */
.ea-cart-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ea-cart-dialog.show {
    opacity: 1;
    visibility: visible;
}

.ea-cart-dialog-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.ea-cart-dialog.show .ea-cart-dialog-content {
    transform: translateY(0);
}

.ea-cart-dialog-icon {
    width: 60px;
    height: 60px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: white;
    margin: 0 auto 20px auto;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.ea-cart-dialog-message {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
}

.ea-cart-dialog-count {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 25px;
}

.ea-cart-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.ea-cart-dialog-close {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.ea-cart-dialog-close:hover {
    background: #e5e7eb;
}

.ea-cart-dialog-view {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.ea-cart-dialog-view:hover {
    background: #2563eb;
}

/* 統計情報 - コンパクト化 */
.ea-product-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 8px 0;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    position: relative;
}

.ea-stat-item {
    text-align: center;
}

.ea-stat-label {
    font-size: 0.65rem;
    color: #6b7280;
    margin-bottom: 2px;
    font-weight: 500;
    line-height: 1;
}

.ea-stat-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.ea-profit-positive {
    color: #059669;
}

.ea-profit-negative {
    color: #dc2626;
}

/* 価格セクション */
.ea-price-section {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.ea-version-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ea-version-row:last-child {
    margin-bottom: 0;
}

.ea-version-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

/* ボタンサイズ統一 */
.ea-download-btn {
    background: #f97316;
    color: white;
    padding: 0;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 90px;
    height: 32px;
    text-align: center;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ea-download-btn:hover {
    background: #ea580c;
}

.ea-price-btn {
    background: #3b82f6;
    color: white;
    padding: 0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 90px;
    height: 32px;
    text-align: center;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ea-price-btn:hover {
    background: #2563eb;
}

/* 結果概要 - グリッド下部 */
.ea-result-summary {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    text-align: center;
    margin-top: 20px;
}

.ea-result-summary-text {
    font-size: 1rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
}

/* サイドバー */
.ea-sidebar {
    width: 320px;
    height: fit-content;
    position: sticky;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* フィルター枠 */
.ea-filter-box {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.ea-search-section, .ea-filter-section {
    margin-bottom: 25px;
}

.ea-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 12px;
}

.ea-search-input, .ea-filter-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fafafa;
    transition: all 0.2s ease;
}

.ea-search-input:focus, .ea-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ea-clear-filters {
    width: 100%;
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-top: 20px;
}

.ea-clear-filters:hover {
    background: #dc2626;
}

/* 最近閲覧された商品枠 - WooCommerce純正のまま */
.ea-recently-viewed-box {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

/* 最近閲覧商品のタイトル装飾 - 他のセクションタイトルと統一 */
.ea-recently-viewed-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 20px 0;
    padding: 0;
}

/* WooCommerce純正スタイルはそのまま使用 - 装飾なし */
.ea-no-recent-products {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.9rem;
}

/* レスポンシブ対応 */

/* タブレット・中画面 (1200px以下) */
@media (max-width: 1200px) {
    .ea-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .ea-listing-container {
        gap: 25px;
        padding: 30px 15px;
    }
    
    .ea-sidebar {
        width: 280px;
    }
}

/* タブレット (1024px以下) */
@media (max-width: 1024px) {
    .ea-listing-container {
        flex-direction: column-reverse;
        padding: 20px 15px;
        gap: 30px;
    }
    
    .ea-sidebar {
        width: 100%;
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .ea-filter-box {
        grid-column: 1 / -1;
    }
    
    .ea-recently-viewed-box {
        grid-column: 1 / -1;
    }
    
    .ea-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    
    .ea-product-card {
        min-height: 340px;
    }
}

/* モバイル・小画面 (768px以下) */
@media (max-width: 768px) {
    .ea-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ea-sort-controls {
        padding: 15px;
        gap: 8px;
    }
    
    .ea-sort-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
        min-width: 100px;
    }
    
    .ea-listing-container {
        padding: 15px 10px;
    }
    
    .ea-sidebar {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ea-filter-box {
        padding: 20px;
    }
    
    .ea-product-card {
        min-height: 320px;
    }
    
    .ea-product-content {
        padding: 12px;
    }
    
    .ea-product-title {
        font-size: 1rem;
    }
    
    .ea-store-name {
        font-size: 0.8rem;
    }
    
    .ea-product-image {
        height: 120px;
    }
    
    .ea-category-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .ea-currency-pair {
        font-size: 0.7rem;
        padding: 3px 6px;
        top: 40px;
    }
    
    /* ボタンサイズを調整 */
    .ea-download-btn, .ea-price-btn {
        width: 80px;
        height: 28px;
        font-size: 0.65rem;
    }
    
    .ea-version-label {
        font-size: 0.8rem;
    }
    
    /* 統計情報を調整 */
    .ea-product-stats {
        padding: 8px;
        gap: 4px;
    }
    
    .ea-stat-label {
        font-size: 0.6rem;
    }
    
    .ea-stat-value {
        font-size: 0.8rem;
    }
}

/* 超小画面 (480px以下) */
@media (max-width: 480px) {
    .ea-listing-container {
        padding: 10px 5px;
    }
    
    .ea-product-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ea-product-card {
        min-height: 300px;
        max-width: 100%;
    }
    
    .ea-sort-controls {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
    }
    
    .ea-sort-btn {
        width: 100%;
        min-width: auto;
        justify-content: center;
    }
    
    .ea-filter-box {
        padding: 15px;
    }
    
    .ea-search-input, .ea-filter-select {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .ea-product-content {
        padding: 10px;
    }
    
    .ea-product-title {
        font-size: 0.95rem;
        line-height: 1.2;
    }
    
    .ea-store-name {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .ea-product-image {
        height: 100px;
    }
    
    .ea-category-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
        top: 8px;
        left: 8px;
    }
    
    .ea-currency-pair {
        font-size: 0.65rem;
        padding: 2px 4px;
        top: 32px;
        left: 8px;
    }
    
    /* ボタンをさらに小さく */
    .ea-download-btn, .ea-price-btn {
        width: 70px;
        height: 24px;
        font-size: 0.6rem;
    }
    
    .ea-version-label {
        font-size: 0.75rem;
    }
    
    /* 統計情報をさらにコンパクト */
    .ea-product-stats {
        padding: 6px;
        gap: 3px;
        margin: 6px 0;
    }
    
    .ea-stat-label {
        font-size: 0.55rem;
        margin-bottom: 1px;
    }
    
    .ea-stat-value {
        font-size: 0.75rem;
    }
    
    /* 結果概要のフォントサイズ調整 */
    .ea-result-summary {
        padding: 15px;
    }
    
    .ea-result-summary-text {
        font-size: 0.9rem;
    }
    
    /* ダイアログのレスポンシブ対応 */
    .ea-cart-dialog-content {
        padding: 20px;
        margin: 10px;
    }
    
    .ea-cart-dialog-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .ea-cart-dialog-message {
        font-size: 1rem;
    }
    
    .ea-cart-dialog-count {
        font-size: 0.8rem;
        margin-bottom: 20px;
    }
    
    .ea-cart-dialog-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .ea-cart-dialog-close,
    .ea-cart-dialog-view {
        width: 100%;
        padding: 12px;
    }
}

/* 超極小画面 (360px以下) */
@media (max-width: 360px) {
    .ea-listing-container {
        padding: 8px 3px;
    }
    
    .ea-product-grid {
        gap: 12px;
    }
    
    .ea-product-card {
        min-height: 280px;
    }
    
    .ea-product-content {
        padding: 8px;
    }
    
    .ea-product-title {
        font-size: 0.9rem;
    }
    
    .ea-store-name {
        font-size: 0.7rem;
    }
    
    .ea-product-image {
        height: 90px;
    }
    
    .ea-filter-box {
        padding: 12px;
    }
    
    .ea-result-summary {
        padding: 12px;
    }
    
    .ea-result-summary-text {
        font-size: 0.85rem;
    }
}

/* ホバーエフェクトの無効化（タッチデバイス） */
@media (hover: none) and (pointer: coarse) {
    .ea-product-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .ea-sort-btn:hover,
    .ea-download-btn:hover,
    .ea-price-btn:hover,
    .ea-clear-filters:hover {
        background: inherit;
    }
    
    .ea-store-name:hover {
        color: inherit;
        text-decoration: none;
    }
    
    .ea-product-card:hover .ea-category-badge,
    .ea-product-card:hover .ea-currency-pair {
        transform: none;
        box-shadow: inherit;
    }
}

/* 高DPI画面対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ea-loading-spinner {
        border-width: 2px;
    }
    
    .ea-category-badge,
    .ea-currency-pair {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
}

/* ダークモード対応（プリファレンス） */
@media (prefers-color-scheme: dark) {
    .ea-listing-container {
        background: #1f2937;
    }
    
    .ea-product-card,
    .ea-filter-box,
    .ea-recently-viewed-box,
    .ea-result-summary,
    .ea-sort-controls {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .ea-product-title {
        color: #f9fafb;
    }
    
    .ea-store-name {
        color: #d1d5db;
    }
    
    .ea-section-title {
        color: #f9fafb;
    }
    
    .ea-search-input,
    .ea-filter-select {
        background: #4b5563;
        color: #f9fafb;
        border-color: #6b7280;
    }
    
    .ea-search-input:focus,
    .ea-filter-select:focus {
        background: #374151;
        border-color: #60a5fa;
    }
    
    .ea-product-stats {
        background: #4b5563;
        border-color: #6b7280;
    }
    
    .ea-stat-value {
        color: #f9fafb;
    }
    
    .ea-result-summary-text {
        color: #60a5fa;
    }
}

/* プリント用スタイル */
@media print {
    .ea-sidebar,
    .ea-sort-controls,
    .ea-download-btn,
    .ea-price-btn,
    .ea-cart-dialog {
        display: none !important;
    }
    
    .ea-listing-container {
        flex-direction: column;
        max-width: none;
        padding: 0;
    }
    
    .ea-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .ea-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .ea-product-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .ea-category-badge,
    .ea-currency-pair {
        position: static;
        display: inline-block;
        margin: 5px;
    }
}