/**
 * 買取カゴ スタイルシート
 * WordPressテーマ用
 */

/* カゴアイコン */
.kaitoriCart-icon {
    position: relative;
    display: inline-block;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}

.kaitoriCart-icon:hover {
    opacity: 0.8;
}

.kaitoriCart-icon .cart-icon {
    font-size: 24px;
    display: inline-block;
}

.kaitoriCart-icon .cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    display: none;
}

.kaitoriCart-icon.has-items .cart-count {
    display: block;
}

/* カゴ追加ボタン */
.kaitoriCart-add-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.kaitoriCart-add-btn:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.kaitoriCart-add-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* カゴ一覧 */
#kaitoriCart-list {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

#kaitoriCart-list h3 {
    margin-top: 0;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.cart-items-container {
    margin: 20px 0;
}

.cart-items {
    display: grid;
    gap: 15px;
}

.cart-item {
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 6px;
    background: #fafafa;
    transition: box-shadow 0.3s ease;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cart-item h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

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

.cart-item .remove-from-cart {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: background 0.3s ease;
}

.cart-item .remove-from-cart:hover {
    background: #c82333;
}

/* CSV出力エリア */
.cart-csv-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.cart-csv-section h4 {
    margin-top: 0;
    color: #495057;
}

.cart-csv-section textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: white;
    resize: vertical;
}

#copy-csv-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s ease;
}

#copy-csv-btn:hover {
    background: #218838;
}

/* メッセージ */
.kaitoriCart-message {
    animation: slideInRight 0.3s ease-out;
}

.kaitoriCart-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.kaitoriCart-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* モーダル */
#kaitoriCart-modal {
    animation: fadeIn 0.3s ease-out;
}

#kaitoriCart-modal .modal-content {
    animation: scaleIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #kaitoriCart-list {
        margin: 10px;
        padding: 15px;
    }
    
    .cart-item {
        padding: 12px;
    }
    
    .cart-item h4 {
        font-size: 14px;
    }
    
    .cart-item p {
        font-size: 13px;
    }
    
    .cart-csv-section textarea {
        height: 120px;
        font-size: 11px;
    }
    
    .kaitoriCart-message {
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
    }
    
    #kaitoriCart-modal .modal-content {
        max-width: 95%;
        max-height: 90%;
        margin: 0 10px;
    }
}

/* 条件付きアイテム表示用スタイル */
.cart-item-conditions {
    margin: 10px 0;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
}

.cart-item-conditions h5 {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 14px;
}

.cart-item-conditions label {
    display: block;
    margin: 5px 0;
    font-size: 13px;
    color: #856404;
}

.cart-item-conditions input[type="checkbox"],
.cart-item-conditions input[type="radio"] {
    margin-right: 6px;
}

/* アクセシビリティ */
.kaitoriCart-add-btn:focus,
.remove-from-cart:focus,
#copy-csv-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* プリント用スタイル */
@media print {
    .kaitoriCart-icon,
    .kaitoriCart-add-btn,
    .remove-from-cart,
    #copy-csv-btn,
    .kaitoriCart-message,
    #kaitoriCart-modal {
        display: none !important;
    }
    
    .cart-csv-section textarea {
        border: none;
        background: transparent;
        height: auto;
    }
}