/**
 * Product Comparison Frontend Styles
 * AFFINGER6EX最適化版
 */

/* 基本設定 */
.product-comparison-wrapper,
.product-spec-wrapper,
.product-list-wrapper {
    max-width: 100%;
    margin: 20px 0;
    font-family: inherit;
}

.affinger-optimized {
    --primary-color: #007cba;
    --secondary-color: #666;
    --border-color: #ddd;
    --background-color: #f9f9f9;
    --text-color: #333;
    --highlight-color: #ff4500;
}

/* 商品比較テーブル */
.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 8px;
}

.comparison-title {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5em;
}

.comparison-count {
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
}

.comparison-table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.product-comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.product-comparison-table th,
.product-comparison-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.product-comparison-table th {
    background: var(--background-color);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.spec-label {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    width: 150px;
    min-width: 150px;
}

.product-header {
    text-align: center;
    min-width: 200px;
}

.product-header img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.product-name {
    font-weight: bold;
    margin: 5px 0;
}

.product-brand {
    color: var(--secondary-color);
    font-size: 0.9em;
}

.product-price {
    color: var(--highlight-color);
    font-weight: bold;
    font-size: 1.1em;
}

.spec-row:nth-child(even) {
    background: #f8f9fa;
}

.spec-value {
    text-align: center;
}

/* 比較カード */
.comparison-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.product-comparison-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.product-comparison-card:hover {
    transform: translateY(-5px);
}

.card-header {
    text-align: center;
    margin-bottom: 15px;
}

.card-header img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 10px;
}

.card-specs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.spec-key {
    font-weight: bold;
    color: var(--secondary-color);
}

.spec-value {
    color: var(--text-color);
}

/* 単一商品スペック */
.product-spec-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.product-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.product-image {
    flex-shrink: 0;
}

.product-image img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
}

.product-info {
    flex: 1;
}

.product-info h3 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.product-specifications h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-add-comparison,
.btn-view-spec,
.btn-view-similar {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-add-comparison {
    background: var(--primary-color);
    color: white;
}

.btn-add-comparison:hover {
    background: #005a87;
}

.btn-view-spec,
.btn-view-similar {
    background: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-view-spec:hover,
.btn-view-similar:hover {
    background: var(--border-color);
}

/* 商品一覧 */
.product-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 8px;
}

.list-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
}

.layout-toggle {
    display: flex;
    gap: 5px;
}

.layout-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
}

.layout-btn.active {
    background: var(--primary-color);
    color: white;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.product-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.product-item:hover {
    transform: translateY(-3px);
}

.product-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.products-list .product-item-list {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.products-list .product-image {
    flex-shrink: 0;
}

.products-list .product-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.products-list .product-info {
    flex: 1;
}

.product-specs {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.spec-item {
    background: var(--background-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* 比較パネル */
.comparison-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.comparison-panel .comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px 12px 0 0;
}

.close-panel {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
}

.comparison-items {
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.comparison-actions {
    padding: 15px;
    display: flex;
    gap: 10px;
}

.btn-compare,
.btn-clear {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-compare {
    background: var(--primary-color);
    color: white;
}

.btn-clear {
    background: var(--secondary-color);
    color: white;
}

/* フッター */
.comparison-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background: var(--background-color);
    border-radius: 8px;
}

.comparison-reset,
.comparison-share {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.comparison-reset {
    background: var(--secondary-color);
    color: white;
}

.comparison-share {
    background: var(--highlight-color);
    color: white;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .comparison-header,
    .product-list-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .product-header {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .comparison-table-container {
        font-size: 0.9em;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .products-list .product-item-list {
        flex-direction: column;
        text-align: center;
    }
    
    .comparison-panel {
        width: 90%;
        right: 5%;
    }
}

/* エラーメッセージ */
.product-comparison-error,
.product-spec-error,
.product-list-error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}